23static void release_ycbcrhelper(
void* releaseContext) {
24 VkYcbcrSamplerHelper* ycbcrHelper =
reinterpret_cast<VkYcbcrSamplerHelper*
>(releaseContext);
31class YCbCrImageGM :
public GM {
34 this->setBGColor(0xFFCCCCCC);
45 std::unique_ptr<VkYcbcrSamplerHelper> ycbcrHelper(
new VkYcbcrSamplerHelper(dContext));
47 if (!ycbcrHelper->isYCbCrSupported()) {
48 *errorMsg =
"YCbCr sampling not supported.";
53 *errorMsg =
"Failed to create I420 backend texture.";
59 ycbcrHelper->backendTexture(),
66 ycbcrHelper.release();
68 *errorMsg =
"Failed to create I420 image.";
69 return DrawResult::kFail;
72 return DrawResult::kOk;
78 return DrawResult::kSkip;
82 *errorMsg =
"This GM requires a Vulkan context.";
83 return DrawResult::kSkip;
87 if (
result != DrawResult::kOk) {
91 return DrawResult::kOk;
94 void onGpuTeardown()
override {
95 fYCbCrImage =
nullptr;
102 return DrawResult::kOk;
107 static const int kPad = 8;
116DEF_GM(
return new YCbCrImageGM;)
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kTopLeft_GrSurfaceOrigin
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
#define INHERITED(method,...)
SK_API GrBackendApi backend() const
bool abandoned() override
virtual GrRecordingContext * recordingContext() const
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static const int kImageSize
SK_API sk_sp< SkImage > BorrowTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
static constexpr SkISize Make(int32_t w, int32_t h)