diff --git a/docs/examples/unexpected_setAlphaType.cpp b/docs/examples/unexpected_setAlphaType.cpp index a87701779e97..94e3fa9e4d4e 100644 --- a/docs/examples/unexpected_setAlphaType.cpp +++ b/docs/examples/unexpected_setAlphaType.cpp @@ -28,6 +28,7 @@ static const char* colortype_name(SkColorType ct) { case kRGB_101010x_SkColorType: return "RGB_101010x"; case kBGRA_1010102_SkColorType: return "BGRA_1010102"; case kBGR_101010x_SkColorType: return "BGR_101010x"; + case kBGR_101010x_XR_SkColorType: return "BGR_101010x_xr"; case kGray_8_SkColorType: return "Gray_8"; case kRGBA_F16Norm_SkColorType: return "RGBA_F16Norm"; case kRGBA_F16_SkColorType: return "RGBA_F16"; diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp index 3ca81356f42d..0618c2a2ab14 100644 --- a/gm/bitmapcopy.cpp +++ b/gm/bitmapcopy.cpp @@ -38,6 +38,7 @@ static const char* color_type_name(SkColorType colorType) { case kRGB_101010x_SkColorType: return "101010x"; case kBGRA_1010102_SkColorType: return "bgra1010102"; case kBGR_101010x_SkColorType: return "bgr101010x"; + case kBGR_101010x_XR_SkColorType: return "bgr101010x_xr"; case kGray_8_SkColorType: return "G8"; case kRGBA_F16Norm_SkColorType: return "F16Norm"; case kRGBA_F16_SkColorType: return "F16"; diff --git a/include/core/SkColorType.h b/include/core/SkColorType.h index b51aa7b96f96..a68dc833b49b 100644 --- a/include/core/SkColorType.h +++ b/include/core/SkColorType.h @@ -28,6 +28,7 @@ enum SkColorType : int { kBGRA_1010102_SkColorType, //!< 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word kRGB_101010x_SkColorType, //!< pixel with 10 bits each for red, green, blue; in 32-bit word kBGR_101010x_SkColorType, //!< pixel with 10 bits each for blue, green, red; in 32-bit word + kBGR_101010x_XR_SkColorType, //!< pixel with 10 bits each for blue, green, red; in 32-bit word, extended range kGray_8_SkColorType, //!< pixel with grayscale level in 8-bit byte kRGBA_F16Norm_SkColorType, //!< pixel with half floats in [0,1] for red, green, blue, alpha; // in 64-bit word diff --git a/include/private/gpu/ganesh/GrTypesPriv.h b/include/private/gpu/ganesh/GrTypesPriv.h index c390899a1662..bfed6cf555d0 100644 --- a/include/private/gpu/ganesh/GrTypesPriv.h +++ b/include/private/gpu/ganesh/GrTypesPriv.h @@ -644,6 +644,7 @@ static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct) { case kRGB_101010x_SkColorType: return GrColorType::kUnknown; case kBGRA_1010102_SkColorType: return GrColorType::kBGRA_1010102; case kBGR_101010x_SkColorType: return GrColorType::kUnknown; + case kBGR_101010x_XR_SkColorType: return GrColorType::kUnknown; case kRGBA_F32_SkColorType: return GrColorType::kRGBA_F32; case kR8G8_unorm_SkColorType: return GrColorType::kRG_88; case kA16_unorm_SkColorType: return GrColorType::kAlpha_16; diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp index da4d6ca80ad5..b7d992c6bdd5 100644 --- a/src/codec/SkCodec.cpp +++ b/src/codec/SkCodec.cpp @@ -720,6 +720,9 @@ bool sk_select_xform_format(SkColorType colorType, bool forColorTable, case kRGBA_F16_SkColorType: *outFormat = skcms_PixelFormat_RGBA_hhhh; break; + case kBGR_101010x_XR_SkColorType: + *outFormat = skcms_PixelFormat_BGR_101010x_XR; + break; case kGray_8_SkColorType: *outFormat = skcms_PixelFormat_G_8; break; @@ -734,7 +737,8 @@ bool SkCodec::initializeColorXform(const SkImageInfo& dstInfo, SkEncodedInfo::Al fXformTime = kNo_XformTime; bool needsColorXform = false; if (this->usesColorXform()) { - if (kRGBA_F16_SkColorType == dstInfo.colorType()) { + if (kRGBA_F16_SkColorType == dstInfo.colorType() || + kBGR_101010x_XR_SkColorType == dstInfo.colorType()) { needsColorXform = true; if (dstInfo.colorSpace()) { dstInfo.colorSpace()->toProfile(&fDstProfile); diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp index e361a4dd4099..3a433ea7ee60 100644 --- a/src/codec/SkJpegCodec.cpp +++ b/src/codec/SkJpegCodec.cpp @@ -477,6 +477,7 @@ bool SkJpegCodec::conversionSupported(const SkImageInfo& dstInfo, bool srcIsOpaq fDecoderMgr->dinfo()->out_color_space = JCS_GRAYSCALE; } break; + case kBGR_101010x_XR_SkColorType: case kRGBA_F16_SkColorType: SkASSERT(needsColorXform); fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA; diff --git a/src/core/SkConvertPixels.cpp b/src/core/SkConvertPixels.cpp index 53ca52dc0699..fe28a331e155 100644 --- a/src/core/SkConvertPixels.cpp +++ b/src/core/SkConvertPixels.cpp @@ -104,6 +104,7 @@ static bool convert_to_alpha8(const SkImageInfo& dstInfo, void* vdst, size case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: case kBGR_101010x_SkColorType: + case kBGR_101010x_XR_SkColorType: case kR8_unorm_SkColorType: { for (int y = 0; y < srcInfo.height(); ++y) { memset(dst, 0xFF, srcInfo.width()); diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp index f2ef0e87aa03..b717c07d9747 100644 --- a/src/core/SkImageInfo.cpp +++ b/src/core/SkImageInfo.cpp @@ -26,6 +26,7 @@ int SkColorTypeBytesPerPixel(SkColorType ct) { case kRGB_101010x_SkColorType: return 4; case kBGRA_1010102_SkColorType: return 4; case kBGR_101010x_SkColorType: return 4; + case kBGR_101010x_XR_SkColorType: return 4; case kGray_8_SkColorType: return 1; case kRGBA_F16Norm_SkColorType: return 8; case kRGBA_F16_SkColorType: return 8; @@ -223,6 +224,7 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: case kBGR_101010x_SkColorType: + case kBGR_101010x_XR_SkColorType: case kR8_unorm_SkColorType: alphaType = kOpaque_SkAlphaType; break; diff --git a/src/core/SkImageInfoPriv.h b/src/core/SkImageInfoPriv.h index 70b9d715f06b..2d42d5fdc5c4 100644 --- a/src/core/SkImageInfoPriv.h +++ b/src/core/SkImageInfoPriv.h @@ -24,6 +24,7 @@ static inline uint32_t SkColorTypeChannelFlags(SkColorType ct) { case kRGB_101010x_SkColorType: return kRGB_SkColorChannelFlags; case kBGRA_1010102_SkColorType: return kRGBA_SkColorChannelFlags; case kBGR_101010x_SkColorType: return kRGB_SkColorChannelFlags; + case kBGR_101010x_XR_SkColorType: return kRGB_SkColorChannelFlags; case kGray_8_SkColorType: return kGray_SkColorChannelFlag; case kRGBA_F16Norm_SkColorType: return kRGBA_SkColorChannelFlags; case kRGBA_F16_SkColorType: return kRGBA_SkColorChannelFlags; @@ -61,6 +62,7 @@ static int SkColorTypeShiftPerPixel(SkColorType ct) { case kRGB_101010x_SkColorType: return 2; case kBGRA_1010102_SkColorType: return 2; case kBGR_101010x_SkColorType: return 2; + case kBGR_101010x_XR_SkColorType: return 2; case kGray_8_SkColorType: return 0; case kRGBA_F16Norm_SkColorType: return 3; case kRGBA_F16_SkColorType: return 3; @@ -116,6 +118,7 @@ static inline bool SkColorTypeIsNormalized(SkColorType ct) { case kR8_unorm_SkColorType: return true; + case kBGR_101010x_XR_SkColorType: case kRGBA_F16_SkColorType: case kRGBA_F32_SkColorType: case kR16G16_float_SkColorType: @@ -149,6 +152,7 @@ static inline int SkColorTypeMaxBitsPerChannel(SkColorType ct) { case kRGB_101010x_SkColorType: case kBGRA_1010102_SkColorType: case kBGR_101010x_SkColorType: + case kBGR_101010x_XR_SkColorType: return 10; case kRGBA_F16Norm_SkColorType: diff --git a/src/core/SkMipmap.cpp b/src/core/SkMipmap.cpp index 1c6454991c4c..3cc9b7ce46cf 100644 --- a/src/core/SkMipmap.cpp +++ b/src/core/SkMipmap.cpp @@ -546,6 +546,7 @@ SkMipmap* SkMipmap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact, case kRGB_888x_SkColorType: // TODO: use 8888? case kRGB_101010x_SkColorType: // TODO: use 1010102? case kBGR_101010x_SkColorType: // TODO: use 1010102? + case kBGR_101010x_XR_SkColorType: // TODO: use 1010102? case kRGBA_F32_SkColorType: return nullptr; diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp index 7499ff3e7cae..9ef77d4310a8 100644 --- a/src/core/SkPixmap.cpp +++ b/src/core/SkPixmap.cpp @@ -106,6 +106,7 @@ float SkPixmap::getAlphaf(int x, int y) const { case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: case kBGR_101010x_SkColorType: + case kBGR_101010x_XR_SkColorType: case kR8_unorm_SkColorType: return 1; case kAlpha_8_SkColorType: @@ -274,6 +275,10 @@ SkColor SkPixmap::getColor(int x, int y) const { | (uint32_t)( ((value >> 20) & 0x3ff) * (255/1023.0f) ) << 0 | 0xff000000; } + case kBGR_101010x_XR_SkColorType: { + SkASSERT(false); + return 0; + } case kBGR_101010x_SkColorType: { uint32_t value = *this->addr32(x, y); // Convert 10-bit bgr to 8-bit bgr, and mask in 0xff alpha at the top. @@ -448,6 +453,10 @@ SkColor4f SkPixmap::getColor4f(int x, int y) const { } return SkColor4f{r, g, b, a}; } + case kBGR_101010x_XR_SkColorType: { + SkASSERT(false); + return {}; + } case kRGB_101010x_SkColorType: { uint32_t value = *this->addr32(x, y); // Convert 10-bit rgb to float rgb, and mask in 0xff alpha at the top. @@ -575,6 +584,7 @@ bool SkPixmap::computeIsOpaque() const { case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: case kBGR_101010x_SkColorType: + case kBGR_101010x_XR_SkColorType: case kR8_unorm_SkColorType: return true; case kARGB_4444_SkColorType: { diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp index cc0d62848dc5..207699232f60 100644 --- a/src/core/SkRasterPipeline.cpp +++ b/src/core/SkRasterPipeline.cpp @@ -224,6 +224,11 @@ void SkRasterPipeline::append_load(SkColorType ct, const SkRasterPipeline_Memory this->append(Op::swap_rb); break; + case kBGR_101010x_XR_SkColorType: this->append(Op::load_1010102_xr, ctx); + this->append(Op::force_opaque); + this->append(Op::swap_rb); + break; + case kBGRA_8888_SkColorType: this->append(Op::load_8888, ctx); this->append(Op::swap_rb); break; @@ -279,6 +284,11 @@ void SkRasterPipeline::append_load_dst(SkColorType ct, const SkRasterPipeline_Me this->append(Op::swap_rb_dst); break; + case kBGR_101010x_XR_SkColorType: this->append(Op::load_1010102_xr_dst, ctx); + this->append(Op::force_opaque_dst); + this->append(Op::swap_rb_dst); + break; + case kBGRA_8888_SkColorType: this->append(Op::load_8888_dst, ctx); this->append(Op::swap_rb_dst); break; @@ -330,6 +340,11 @@ void SkRasterPipeline::append_store(SkColorType ct, const SkRasterPipeline_Memor this->append(Op::store_1010102, ctx); break; + case kBGR_101010x_XR_SkColorType: this->append(Op::force_opaque); + this->append(Op::swap_rb); + this->append(Op::store_1010102_xr, ctx); + break; + case kGray_8_SkColorType: this->append(Op::bt709_luminance_or_luma_to_alpha); this->append(Op::store_a8, ctx); break; diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp index 6d73f600286a..4aaf36bc78cf 100644 --- a/src/core/SkRasterPipelineBlitter.cpp +++ b/src/core/SkRasterPipelineBlitter.cpp @@ -229,6 +229,7 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst, case kUnknown_SkColorType: case kAlpha_8_SkColorType: + case kBGR_101010x_XR_SkColorType: case kRGBA_F16_SkColorType: case kRGBA_F16Norm_SkColorType: case kRGBA_F32_SkColorType: diff --git a/src/core/SkRasterPipelineOpList.h b/src/core/SkRasterPipelineOpList.h index dc246d348788..6d1c9da76586 100644 --- a/src/core/SkRasterPipelineOpList.h +++ b/src/core/SkRasterPipelineOpList.h @@ -67,6 +67,7 @@ M(load_f32) M(load_f32_dst) M(store_f32) M(gather_f32) \ M(load_rgf32) M(store_rgf32) \ M(load_1010102) M(load_1010102_dst) M(store_1010102) M(gather_1010102) \ + M(load_1010102_xr) M(load_1010102_xr_dst) M(store_1010102_xr) \ M(store_u16_be) \ M(store_src_rg) M(load_src_rg) \ M(byte_tables) \ diff --git a/src/core/SkVM.cpp b/src/core/SkVM.cpp index 523a0f02e195..3c72ffaa59aa 100644 --- a/src/core/SkVM.cpp +++ b/src/core/SkVM.cpp @@ -1210,6 +1210,7 @@ namespace skvm { case kBGRA_1010102_SkColorType: return {UNORM, 10,10,10,2, 20,10, 0,30}; case kRGB_101010x_SkColorType: return {UNORM, 10,10,10,0, 0,10,20, 0}; case kBGR_101010x_SkColorType: return {UNORM, 10,10,10,0, 20,10, 0, 0}; + case kBGR_101010x_XR_SkColorType: SkDEBUGFAIL("Not implemented."); return {UNORM, 10,10,10,0, 20,10, 0, 0}; case kR8G8_unorm_SkColorType: return {UNORM, 8, 8,0, 0, 0, 8,0,0}; case kR16G16_unorm_SkColorType: return {UNORM, 16,16,0, 0, 0,16,0,0}; diff --git a/src/core/SkVMBlitter.cpp b/src/core/SkVMBlitter.cpp index 653160a91b8a..4b0702666f98 100644 --- a/src/core/SkVMBlitter.cpp +++ b/src/core/SkVMBlitter.cpp @@ -147,6 +147,7 @@ namespace { case kUnknown_SkColorType: case kAlpha_8_SkColorType: + case kBGR_101010x_XR_SkColorType: case kRGBA_F16_SkColorType: case kRGBA_F16Norm_SkColorType: case kRGBA_F32_SkColorType: diff --git a/src/encode/SkPngEncoder.cpp b/src/encode/SkPngEncoder.cpp index b2a2f66d8a13..55ca9f5239bf 100644 --- a/src/encode/SkPngEncoder.cpp +++ b/src/encode/SkPngEncoder.cpp @@ -350,6 +350,7 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info) { } case kRGB_101010x_SkColorType: return transform_scanline_101010x; case kBGR_101010x_SkColorType: return transform_scanline_bgr_101010x; + case kBGR_101010x_XR_SkColorType: SkASSERT(false); return nullptr; case kAlpha_8_SkColorType: return transform_scanline_A8_to_GrayAlpha; diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h index 6c52fb07034d..b665d56ebaeb 100644 --- a/src/opts/SkRasterPipeline_opts.h +++ b/src/opts/SkRasterPipeline_opts.h @@ -1404,6 +1404,15 @@ SI void from_1010102(U32 rgba, F* r, F* g, F* b, F* a) { *b = cast((rgba >> 20) & 0x3ff) * (1/1023.0f); *a = cast((rgba >> 30) ) * (1/ 3.0f); } +SI void from_1010102_xr(U32 rgba, F* r, F* g, F* b, F* a) { + static constexpr float min = -0.752941f; + static constexpr float max = 1.25098f; + static constexpr float range = max - min; + *r = cast((rgba ) & 0x3ff) * (1/1023.0f) * range + min; + *g = cast((rgba >> 10) & 0x3ff) * (1/1023.0f) * range + min; + *b = cast((rgba >> 20) & 0x3ff) * (1/1023.0f) * range + min; + *a = cast((rgba >> 30) ) * (1/ 3.0f); +} SI void from_1616(U32 _1616, F* r, F* g) { *r = cast((_1616 ) & 0xffff) * (1/65535.0f); *g = cast((_1616 >> 16) & 0xffff) * (1/65535.0f); @@ -2570,6 +2579,14 @@ STAGE(load_1010102_dst, const SkRasterPipeline_MemoryCtx* ctx) { auto ptr = ptr_at_xy(ctx, dx,dy); from_1010102(load(ptr, tail), &dr,&dg,&db,&da); } +STAGE(load_1010102_xr, const SkRasterPipeline_MemoryCtx* ctx) { + auto ptr = ptr_at_xy(ctx, dx,dy); + from_1010102_xr(load(ptr, tail), &r,&g,&b,&a); +} +STAGE(load_1010102_xr_dst, const SkRasterPipeline_MemoryCtx* ctx) { + auto ptr = ptr_at_xy(ctx, dx,dy); + from_1010102_xr(load(ptr, tail), &dr,&dg,&db,&da); +} STAGE(gather_1010102, const SkRasterPipeline_GatherCtx* ctx) { const uint32_t* ptr; U32 ix = ix_and_ptr(&ptr, ctx, r,g); @@ -2584,6 +2601,17 @@ STAGE(store_1010102, const SkRasterPipeline_MemoryCtx* ctx) { | to_unorm(a, 3) << 30; store(ptr, px, tail); } +STAGE(store_1010102_xr, const SkRasterPipeline_MemoryCtx* ctx) { + auto ptr = ptr_at_xy(ctx, dx,dy); + static constexpr float min = -0.752941f; + static constexpr float max = 1.25098f; + static constexpr float range = max - min; + U32 px = to_unorm((r - min) / range, 1023) + | to_unorm((g - min) / range, 1023) << 10 + | to_unorm((b - min) / range, 1023) << 20 + | to_unorm(a, 3) << 30; + store(ptr, px, tail); +} STAGE(load_f16, const SkRasterPipeline_MemoryCtx* ctx) { auto ptr = ptr_at_xy(ctx, dx,dy); diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp index abf9e8df987f..7c16ca9ddf52 100644 --- a/src/shaders/SkImageShader.cpp +++ b/src/shaders/SkImageShader.cpp @@ -661,6 +661,10 @@ bool SkImageShader::appendStages(const SkStageRec& rec, const MatrixRec& mRec) c p->append(SkRasterPipelineOp::force_opaque); break; + case kBGR_101010x_XR_SkColorType: + SkASSERT(false); + break; + case kBGR_101010x_SkColorType: p->append(SkRasterPipelineOp::gather_1010102, ctx); p->append(SkRasterPipelineOp::force_opaque); diff --git a/tests/BackendAllocationTest.cpp b/tests/BackendAllocationTest.cpp index ceeca02880dd..0c134e17f813 100644 --- a/tests/BackendAllocationTest.cpp +++ b/tests/BackendAllocationTest.cpp @@ -617,6 +617,7 @@ void color_type_backend_allocation_test(const sk_gpu_test::ContextInfo& ctxInfo, // RGB/BGR 101010x have no Ganesh correlate { kRGB_101010x_SkColorType, { 0, 0.5f, 0, 0.5f } }, { kBGR_101010x_SkColorType, { 0, 0.5f, 0, 0.5f } }, + { kBGR_101010x_XR_SkColorType, { 0, 0.5f, 0, 0.5f } }, { kGray_8_SkColorType, kGrayCol }, { kRGBA_F16Norm_SkColorType, SkColors::kLtGray }, { kRGBA_F16_SkColorType, SkColors::kYellow }, @@ -642,6 +643,12 @@ void color_type_backend_allocation_test(const sk_gpu_test::ContextInfo& ctxInfo, } } + if (colorType == kBGR_101010x_XR_SkColorType) { + // Creating a texture with kBGR_101010x_XR_SkColorType is not + // implemented. + continue; + } + for (auto mipmapped : {GrMipmapped::kNo, GrMipmapped::kYes}) { if (GrMipmapped::kYes == mipmapped && !caps->mipmapSupport()) { continue; diff --git a/tests/ReadWritePixelsGpuTest.cpp b/tests/ReadWritePixelsGpuTest.cpp index ba5b18874f9f..0fcff04dead6 100644 --- a/tests/ReadWritePixelsGpuTest.cpp +++ b/tests/ReadWritePixelsGpuTest.cpp @@ -86,6 +86,7 @@ static constexpr int min_rgb_channel_bits(SkColorType ct) { case kRGB_101010x_SkColorType: return 10; case kBGRA_1010102_SkColorType: return 10; case kBGR_101010x_SkColorType: return 10; + case kBGR_101010x_XR_SkColorType: return 10; case kGray_8_SkColorType: return 8; // counting gray as "rgb" case kRGBA_F16Norm_SkColorType: return 10; // just counting the mantissa case kRGBA_F16_SkColorType: return 10; // just counting the mantissa @@ -115,6 +116,7 @@ static constexpr int alpha_channel_bits(SkColorType ct) { case kRGB_101010x_SkColorType: return 0; case kBGRA_1010102_SkColorType: return 2; case kBGR_101010x_SkColorType: return 0; + case kBGR_101010x_XR_SkColorType: return 0; case kGray_8_SkColorType: return 0; case kRGBA_F16Norm_SkColorType: return 10; // just counting the mantissa case kRGBA_F16_SkColorType: return 10; // just counting the mantissa diff --git a/tests/graphite/ReadWritePixelsGraphiteTest.cpp b/tests/graphite/ReadWritePixelsGraphiteTest.cpp index 14b5fa894239..9ce73af9c948 100644 --- a/tests/graphite/ReadWritePixelsGraphiteTest.cpp +++ b/tests/graphite/ReadWritePixelsGraphiteTest.cpp @@ -50,6 +50,7 @@ static constexpr int min_rgb_channel_bits(SkColorType ct) { case kRGB_101010x_SkColorType: return 10; case kBGRA_1010102_SkColorType: return 10; case kBGR_101010x_SkColorType: return 10; + case kBGR_101010x_XR_SkColorType: return 10; case kGray_8_SkColorType: return 8; // counting gray as "rgb" case kRGBA_F16Norm_SkColorType: return 10; // just counting the mantissa case kRGBA_F16_SkColorType: return 10; // just counting the mantissa @@ -79,6 +80,7 @@ static constexpr int alpha_channel_bits(SkColorType ct) { case kRGB_101010x_SkColorType: return 0; case kBGRA_1010102_SkColorType: return 2; case kBGR_101010x_SkColorType: return 0; + case kBGR_101010x_XR_SkColorType: return 0; case kGray_8_SkColorType: return 0; case kRGBA_F16Norm_SkColorType: return 10; // just counting the mantissa case kRGBA_F16_SkColorType: return 10; // just counting the mantissa @@ -448,6 +450,7 @@ static void graphite_read_pixels_test_driver(skiatest::Reporter* reporter, // ComparePixels will end up converting these types to kUnknown // because there's no corresponding GrColorType, and hence it will fail if (readCT == kRGB_101010x_SkColorType || + readCT == kBGR_101010x_XR_SkColorType || readCT == kBGR_101010x_SkColorType) { continue; } diff --git a/tools/HashAndEncode.cpp b/tools/HashAndEncode.cpp index ae9ee5f5b3fa..68ab69d55a43 100644 --- a/tools/HashAndEncode.cpp +++ b/tools/HashAndEncode.cpp @@ -36,6 +36,7 @@ HashAndEncode::HashAndEncode(const SkBitmap& bitmap) : fSize(bitmap.info().dimen case kSRGBA_8888_SkColorType: srcFmt = skcms_PixelFormat_RGBA_8888_sRGB; break; case kRGBA_1010102_SkColorType: srcFmt = skcms_PixelFormat_RGBA_1010102; break; case kBGRA_1010102_SkColorType: srcFmt = skcms_PixelFormat_BGRA_1010102; break; + case kBGR_101010x_XR_SkColorType: srcFmt = skcms_PixelFormat_BGR_101010x_XR; break; case kGray_8_SkColorType: srcFmt = skcms_PixelFormat_G_8; break; // skcms doesn't have R_8. Pretend it's G_8, but see below for color space trickery: case kR8_unorm_SkColorType: srcFmt = skcms_PixelFormat_G_8; break; diff --git a/tools/ToolUtils.cpp b/tools/ToolUtils.cpp index 93b8c638eb0e..0bc184678fd6 100644 --- a/tools/ToolUtils.cpp +++ b/tools/ToolUtils.cpp @@ -83,6 +83,7 @@ const char* colortype_name(SkColorType ct) { case kBGRA_1010102_SkColorType: return "BGRA_1010102"; case kRGB_101010x_SkColorType: return "RGB_101010x"; case kBGR_101010x_SkColorType: return "BGR_101010x"; + case kBGR_101010x_XR_SkColorType: return "BGR_101010x_XR"; case kGray_8_SkColorType: return "Gray_8"; case kRGBA_F16Norm_SkColorType: return "RGBA_F16Norm"; case kRGBA_F16_SkColorType: return "RGBA_F16"; @@ -112,6 +113,7 @@ const char* colortype_depth(SkColorType ct) { case kBGRA_1010102_SkColorType: return "1010102"; case kRGB_101010x_SkColorType: return "101010"; case kBGR_101010x_SkColorType: return "101010"; + case kBGR_101010x_XR_SkColorType: return "101010"; case kGray_8_SkColorType: return "G8"; case kRGBA_F16Norm_SkColorType: return "F16Norm"; case kRGBA_F16_SkColorType: return "F16";