1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef TestSurface_DEFINED 9 #define TestSurface_DEFINED 10 11 #include "include/core/SkColorSpace.h" 12 #include "include/core/SkRefCnt.h" 13 #include "include/core/SkSize.h" 14 #include "include/gpu/GpuTypes.h" 15 #include "include/gpu/ganesh/GrTypes.h" 16 #include "include/private/SkColorData.h" 17 18 class GrDirectContext; 19 class SkSurface; 20 class SkSurfaceProps; 21 enum SkColorType : int; 22 struct SkImageInfo; 23 24 #ifdef SK_GRAPHITE 25 namespace skgpu::graphite { 26 class Recorder; 27 } 28 #endif 29 30 namespace sk_gpu_test { 31 32 sk_sp<SkSurface> MakeBackendTextureSurface(GrDirectContext*, 33 const SkImageInfo&, 34 GrSurfaceOrigin, 35 int sampleCnt, 36 skgpu::Mipmapped = skgpu::Mipmapped::kNo, 37 GrProtected = GrProtected::kNo, 38 const SkSurfaceProps* = nullptr); 39 40 sk_sp<SkSurface> MakeBackendTextureSurface(GrDirectContext*, 41 SkISize, 42 GrSurfaceOrigin, 43 int sampleCnt, 44 SkColorType, 45 sk_sp<SkColorSpace> = nullptr, 46 skgpu::Mipmapped = skgpu::Mipmapped::kNo, 47 GrProtected = GrProtected::kNo, 48 const SkSurfaceProps* = nullptr); 49 50 /** Creates an SkSurface backed by a non-textureable render target. */ 51 sk_sp<SkSurface> MakeBackendRenderTargetSurface(GrDirectContext*, 52 const SkImageInfo&, 53 GrSurfaceOrigin, 54 int sampleCnt, 55 GrProtected = GrProtected::kNo, 56 const SkSurfaceProps* = nullptr); 57 58 sk_sp<SkSurface> MakeBackendRenderTargetSurface(GrDirectContext*, 59 SkISize, 60 GrSurfaceOrigin, 61 int sampleCnt, 62 SkColorType, 63 sk_sp<SkColorSpace> = nullptr, 64 GrProtected = GrProtected::kNo, 65 const SkSurfaceProps* = nullptr); 66 67 #ifdef SK_GRAPHITE 68 /* 69 * Graphite version of MakeBackendTextureSurface 70 */ 71 sk_sp<SkSurface> MakeBackendTextureSurface(skgpu::graphite::Recorder*, 72 const SkImageInfo&, 73 skgpu::Mipmapped = skgpu::Mipmapped::kNo, 74 skgpu::Protected = skgpu::Protected::kNo, 75 const SkSurfaceProps* = nullptr); 76 77 #if defined(SK_DAWN) 78 /* 79 * Variation that wraps a WGPUTextureView. Only supported on Dawn backend. 80 */ 81 sk_sp<SkSurface> MakeBackendTextureViewSurface(skgpu::graphite::Recorder*, 82 const SkImageInfo&, 83 skgpu::Mipmapped = skgpu::Mipmapped::kNo, 84 skgpu::Protected = skgpu::Protected::kNo, 85 const SkSurfaceProps* = nullptr); 86 #endif // SK_DAWN 87 88 #endif // SK_GRAPHITE 89 90 } // namespace sk_gpu_test 91 92 #endif 93