| 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 "src/core/SkColorData.h" |
| 16 |
|
| 17 |
#if defined(SK_GANESH) |
| 18 |
#include "include/gpu/ganesh/GrTypes.h" |
| 19 |
#endif |
| 20 |
|
| 21 |
class SkSurface; |
| 22 |
class SkSurfaceProps; |
| 23 |
enum SkColorType : int; |
| 24 |
struct SkImageInfo; |
| 25 |
|
| 26 |
#if defined(SK_GANESH) |
| 27 |
class GrDirectContext; |
| 28 |
#endif |
| 29 |
|
| 30 |
#if defined(SK_GRAPHITE) |
| 31 |
namespace skgpu::graphite { |
| 32 |
class Recorder; |
| 33 |
} |
| 34 |
#endif |
| 35 |
|
| 36 |
namespace sk_gpu_test { |
| 37 |
#if defined(SK_GANESH) |
| 38 |
sk_sp<SkSurface> MakeBackendTextureSurface(GrDirectContext*, |
| 39 |
const SkImageInfo&, |
| 40 |
GrSurfaceOrigin, |
| 41 |
int sampleCnt, |
| 42 |
skgpu::Mipmapped = skgpu::Mipmapped::kNo, |
| 43 |
GrProtected = GrProtected::kNo, |
| 44 |
const SkSurfaceProps* = nullptr); |
| 45 |
|
| 46 |
sk_sp<SkSurface> MakeBackendTextureSurface(GrDirectContext*, |
| 47 |
SkISize, |
| 48 |
GrSurfaceOrigin, |
| 49 |
int sampleCnt, |
| 50 |
SkColorType, |
| 51 |
sk_sp<SkColorSpace> = nullptr, |
| 52 |
skgpu::Mipmapped = skgpu::Mipmapped::kNo, |
| 53 |
GrProtected = GrProtected::kNo, |
| 54 |
const SkSurfaceProps* = nullptr); |
| 55 |
|
| 56 |
/** Creates an SkSurface backed by a non-textureable render target. */ |
| 57 |
sk_sp<SkSurface> MakeBackendRenderTargetSurface(GrDirectContext*, |
| 58 |
const SkImageInfo&, |
| 59 |
GrSurfaceOrigin, |
| 60 |
int sampleCnt, |
| 61 |
GrProtected = GrProtected::kNo, |
| 62 |
const SkSurfaceProps* = nullptr); |
| 63 |
|
| 64 |
sk_sp<SkSurface> MakeBackendRenderTargetSurface(GrDirectContext*, |
| 65 |
SkISize, |
| 66 |
GrSurfaceOrigin, |
| 67 |
int sampleCnt, |
| 68 |
SkColorType, |
| 69 |
sk_sp<SkColorSpace> = nullptr, |
| 70 |
GrProtected = GrProtected::kNo, |
| 71 |
const SkSurfaceProps* = nullptr); |
| 72 |
#endif // SK_GANESH |
| 73 |
|
| 74 |
#ifdef SK_GRAPHITE |
| 75 |
/* |
| 76 |
* Graphite version of MakeBackendTextureSurface |
| 77 |
*/ |
| 78 |
sk_sp<SkSurface> MakeBackendTextureSurface(skgpu::graphite::Recorder*, |
| 79 |
const SkImageInfo&, |
| 80 |
skgpu::Mipmapped = skgpu::Mipmapped::kNo, |
| 81 |
skgpu::Protected = skgpu::Protected::kNo, |
| 82 |
const SkSurfaceProps* = nullptr); |
| 83 |
|
| 84 |
#if defined(SK_DAWN) |
| 85 |
/* |
| 86 |
* Variation that wraps a WGPUTextureView. Only supported on Dawn backend. |
| 87 |
*/ |
| 88 |
sk_sp<SkSurface> MakeBackendTextureViewSurface(skgpu::graphite::Recorder*, |
| 89 |
const SkImageInfo&, |
| 90 |
skgpu::Mipmapped = skgpu::Mipmapped::kNo, |
| 91 |
skgpu::Protected = skgpu::Protected::kNo, |
| 92 |
const SkSurfaceProps* = nullptr); |
| 93 |
#endif // SK_DAWN |
| 94 |
|
| 95 |
#endif // SK_GRAPHITE |
| 96 |
|
| 97 |
} // namespace sk_gpu_test |
| 98 |
|
| 99 |
#endif |