13#if defined(SK_GRAPHITE)
27class RenderToMipmappedYUVImagePlanes :
public GM {
29 RenderToMipmappedYUVImagePlanes() { this->setBGColor(0xFFFFFFFF); }
32 SkString getName()
const override {
return SkString(
"render_to_mipmapped_yuv_image_planes"); }
34 SkISize getISize()
override {
return {96, 32}; }
39 *errorMsg =
"graphite-only test";
45 *errorMsg =
"Could not load src image.";
56 *errorMsg =
"direct to graphite test";
63 Subsampling subsampling;
65 for (
const auto& tc : {
TestCase{PlaneConfig::kY_U_V, Subsampling::k420},
66 TestCase{PlaneConfig::kY_UV, Subsampling::k422},
67 TestCase{PlaneConfig::kYUV, Subsampling::k444}}) {
77 int numPlanes = yuvaInfo.planeDimensions(dimensions);
81 for (
int i = 0;
i < numPlanes; ++
i) {
82 switch (yuvaInfo.numChannelsInPlane(
i)) {
94 for (
int i = 0;
i < numPlanes; ++
i) {
106 if (locations[c].fPlane ==
i) {
107 auto d =
static_cast<int>(locations[c].fChannel);
108 std::copy_n(rgbToYuv + 5 * c, 5,
matrix + 5 *
d);
115 surf->getCanvas()->drawImageRect(fSrcImage,
125 auto dstRect =
SkRect::MakeWH(yuvaImage->width() / 16.f, yuvaImage->height() / 16.f);
138DEF_GM(
return new RenderToMipmappedYUVImagePlanes();)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
static uint32_t SkColorTypeChannelFlags(SkColorType ct)
@ kJPEG_Full_SkYUVColorSpace
describes full range
void translate(SkScalar dx, SkScalar dy)
virtual skgpu::graphite::Recorder * recorder() const
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static SkColorMatrix RGBtoYUV(SkYUVColorSpace)
void getRowMajor(float dst[20]) const
static constexpr int kMaxPlanes
std::array< YUVALocation, kYUVAChannelCount > YUVALocations
static constexpr int kYUVAChannelCount
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
SK_API sk_sp< SkImage > TextureFromYUVAImages(skgpu::graphite::Recorder *recorder, const SkYUVAInfo &yuvaInfo, SkSpan< const sk_sp< SkImage > > images, sk_sp< SkColorSpace > imageColorSpace)
unsigned useCenter Optional< SkMatrix > matrix
SK_API sk_sp< SkImage > AsImage(sk_sp< const SkSurface >)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
SIN Vec< N, float > ceil(const Vec< N, float > &x)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeWH(float w, float h)