diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp index fac167ed63..4f8b59c04a 100644 --- a/gm/bitmapcopy.cpp +++ b/gm/bitmapcopy.cpp @@ -27,25 +27,25 @@ namespace { static const char* color_type_name(SkColorType colorType) { switch (colorType) { - case kUnknown_SkColorType: return "unknown"; - case kAlpha_8_SkColorType: return "A8"; - case kRGB_565_SkColorType: return "565"; - case kARGB_4444_SkColorType: return "4444"; - case kRGBA_8888_SkColorType: return "8888"; - case kRGB_888x_SkColorType: return "888x"; - case kBGRA_8888_SkColorType: return "8888"; - case kRGBA_1010102_SkColorType: return "1010102"; - case kRGB_101010x_SkColorType: return "101010x"; - case kGray_8_SkColorType: return "G8"; - case kRGBA_F16Norm_SkColorType: return "F16Norm"; - case kRGBA_F16_SkColorType: return "F16"; - case kRGBA_F32_SkColorType: return "F32"; - case kRG_88_SkColorType: return "RG88"; - case kAlpha_16_SkColorType: return "A16"; - case kRG_1616_SkColorType: return "RG1616"; - case kAlpha_F16_SkColorType: return "A_F16"; - case kRG_F16_SkColorType: return "RG_F16"; - case kRGBA_16161616_SkColorType:return "16161616"; + case kUnknown_SkColorType: return "unknown"; + case kAlpha_8_SkColorType: return "A8"; + case kRGB_565_SkColorType: return "565"; + case kARGB_4444_SkColorType: return "4444"; + case kRGBA_8888_SkColorType: return "8888"; + case kRGB_888x_SkColorType: return "888x"; + case kBGRA_8888_SkColorType: return "8888"; + case kRGBA_1010102_SkColorType: return "1010102"; + case kRGB_101010x_SkColorType: return "101010x"; + case kGray_8_SkColorType: return "G8"; + case kRGBA_F16Norm_SkColorType: return "F16Norm"; + case kRGBA_F16_SkColorType: return "F16"; + case kRGBA_F32_SkColorType: return "F32"; + case kR8G8_unorm_SkColorType: return "R8G8_unorm"; + case kA16_unorm_SkColorType: return "A16_unorm"; + case kR16G16_unorm_SkColorType: return "R16G16_unorm"; + case kA16_float_SkColorType: return "A16_float"; + case kR16G16_float_SkColorType: return "R16G16_float"; + case kR16G16B16A16_unorm_SkColorType: return "R16G16B16A16_unorm"; } return ""; } diff --git a/gm/wacky_yuv_formats.cpp b/gm/wacky_yuv_formats.cpp index afe5ca015f..119143ed63 100644 --- a/gm/wacky_yuv_formats.cpp +++ b/gm/wacky_yuv_formats.cpp @@ -599,7 +599,7 @@ static SkBitmap make_quarter_2_channel(const SkBitmap& fullY, result.allocPixels(SkImageInfo::Make(fullY.width()/2, fullY.height()/2, - kRG_88_SkColorType, + kR8G8_unorm_SkColorType, kUnpremul_SkAlphaType)); for (int y = 0; y < fullY.height()/2; ++y) { @@ -649,7 +649,7 @@ static void create_YUV(const PlaneData& planes, YUVFormat yuvFormat, switch (yuvFormat) { case kY416_YUVFormat: { - resultBMs[nextLayer++] = make_16(planes.fFull, kRGBA_16161616_SkColorType, + resultBMs[nextLayer++] = make_16(planes.fFull, kR16G16B16A16_unorm_SkColorType, [] (uint16_t* dstPixel, const float* srcPixel) { dstPixel[0] = flt_2_uint16(srcPixel[1]); // U dstPixel[1] = flt_2_uint16(srcPixel[0]); // Y @@ -715,14 +715,14 @@ static void create_YUV(const PlaneData& planes, YUVFormat yuvFormat, } case kP016_YUVFormat: // fall through case kP010_YUVFormat: { - resultBMs[nextLayer++] = make_16(planes.fFull, kAlpha_16_SkColorType, + resultBMs[nextLayer++] = make_16(planes.fFull, kA16_unorm_SkColorType, [tenBitsPP = (yuvFormat == kP010_YUVFormat)] (uint16_t* dstPixel, const float* srcPixel) { uint16_t val16 = flt_2_uint16(srcPixel[0]); dstPixel[0] = tenBitsPP ? (val16 & 0xFFC0) : val16; }); - resultBMs[nextLayer++] = make_16(planes.fQuarter, kRG_1616_SkColorType, + resultBMs[nextLayer++] = make_16(planes.fQuarter, kR16G16_unorm_SkColorType, [tenBitsPP = (yuvFormat == kP010_YUVFormat)] (uint16_t* dstPixel, const float* srcPixel) { uint16_t u16 = flt_2_uint16(srcPixel[1]); @@ -731,7 +731,7 @@ static void create_YUV(const PlaneData& planes, YUVFormat yuvFormat, dstPixel[1] = tenBitsPP ? (v16 & 0xFFC0) : v16; }); if (!opaque) { - resultBMs[nextLayer] = make_16(planes.fFull, kAlpha_16_SkColorType, + resultBMs[nextLayer] = make_16(planes.fFull, kA16_unorm_SkColorType, [tenBitsPP = (yuvFormat == kP010_YUVFormat)] (uint16_t* dstPixel, const float* srcPixel) { uint16_t val16 = flt_2_uint16(srcPixel[3]); @@ -743,17 +743,17 @@ static void create_YUV(const PlaneData& planes, YUVFormat yuvFormat, return; } case kP016F_YUVFormat: { - resultBMs[nextLayer++] = make_16(planes.fFull, kAlpha_F16_SkColorType, + resultBMs[nextLayer++] = make_16(planes.fFull, kA16_float_SkColorType, [] (uint16_t* dstPixel, const float* srcPixel) { dstPixel[0] = SkFloatToHalf(srcPixel[0]); }); - resultBMs[nextLayer++] = make_16(planes.fQuarter, kRG_F16_SkColorType, + resultBMs[nextLayer++] = make_16(planes.fQuarter, kR16G16_float_SkColorType, [] (uint16_t* dstPixel, const float* srcPixel) { dstPixel[0] = SkFloatToHalf(srcPixel[1]); dstPixel[1] = SkFloatToHalf(srcPixel[2]); }); if (!opaque) { - resultBMs[nextLayer] = make_16(planes.fFull, kAlpha_F16_SkColorType, + resultBMs[nextLayer] = make_16(planes.fFull, kA16_float_SkColorType, [] (uint16_t* dstPixel, const float* srcPixel) { dstPixel[0] = SkFloatToHalf(srcPixel[3]); }); @@ -814,14 +814,14 @@ static uint8_t look_up(float x1, float y1, const SkBitmap& bm, SkColorChannel ch SkASSERT(SkColorChannel::kA == channel || SkColorChannel::kR == channel); result = *bm.getAddr8(x, y); } else if (kAlpha_8_SkColorType == bm.colorType() || - kAlpha_16_SkColorType == bm.colorType() || - kAlpha_F16_SkColorType == bm.colorType()) { + kA16_unorm_SkColorType == bm.colorType() || + kA16_float_SkColorType == bm.colorType()) { SkASSERT(SkColorChannel::kA == channel); SkColor c = bm.getColor(x, y); result = SkColorGetA(c); - } else if (kRG_88_SkColorType == bm.colorType() || - kRG_1616_SkColorType == bm.colorType() || - kRG_F16_SkColorType == bm.colorType()) { + } else if (kR8G8_unorm_SkColorType == bm.colorType() || + kR16G16_unorm_SkColorType == bm.colorType() || + kR16G16_float_SkColorType == bm.colorType()) { SkASSERT(SkColorChannel::kR == channel || SkColorChannel::kG == channel); SkColor c = bm.getColor(x, y); @@ -842,7 +842,7 @@ static uint8_t look_up(float x1, float y1, const SkBitmap& bm, SkColorChannel ch } else { SkASSERT(kRGBA_1010102_SkColorType == bm.colorType() || kRGBA_8888_SkColorType == bm.colorType() || - kRGBA_16161616_SkColorType == bm.colorType()); + kR16G16B16A16_unorm_SkColorType == bm.colorType()); SkColor c = bm.getColor(x, y); @@ -1060,22 +1060,22 @@ static GrBackendTexture create_yuva_texture(GrContext* context, const SkBitmap& if (2 == channelCount) { if (format_uses_16_bpp(yuvFormat)) { if (yuvFormat == kP016F_YUVFormat) { - SkASSERT(kRG_F16_SkColorType == bm.colorType()); + SkASSERT(kR16G16_float_SkColorType == bm.colorType()); } else { SkASSERT(yuvFormat == kP016_YUVFormat || yuvFormat == kP010_YUVFormat); - SkASSERT(kRG_1616_SkColorType == bm.colorType()); + SkASSERT(kR16G16_unorm_SkColorType == bm.colorType()); } } else { - SkASSERT(kRG_88_SkColorType == bm.colorType()); + SkASSERT(kR8G8_unorm_SkColorType == bm.colorType()); } } else { if (yuvFormat == kY416_YUVFormat) { - SkASSERT(kRGBA_16161616_SkColorType == bm.colorType()); + SkASSERT(kR16G16B16A16_unorm_SkColorType == bm.colorType()); } else if (yuvFormat == kP016F_YUVFormat) { - SkASSERT(kAlpha_F16_SkColorType == bm.colorType()); + SkASSERT(kA16_float_SkColorType == bm.colorType()); } else { SkASSERT(yuvFormat == kP016_YUVFormat || yuvFormat == kP010_YUVFormat); - SkASSERT(kAlpha_16_SkColorType == bm.colorType()); + SkASSERT(kA16_unorm_SkColorType == bm.colorType()); } } } diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h index 87984138aa..c70cd979ef 100644 --- a/include/core/SkImageInfo.h +++ b/include/core/SkImageInfo.h @@ -87,16 +87,16 @@ enum SkColorType { kRGBA_F32_SkColorType, //!< pixel using C float for red, green, blue, alpha; in 128-bit word // The following 6 colortypes are just for reading from - not for rendering to - kRG_88_SkColorType, //("FillType") .value("Winding", SkPath::FillType::kWinding_FillType) diff --git a/src/core/SkConvertPixels.cpp b/src/core/SkConvertPixels.cpp index 1000d6195d..ca50a95784 100644 --- a/src/core/SkConvertPixels.cpp +++ b/src/core/SkConvertPixels.cpp @@ -84,7 +84,7 @@ static bool convert_to_alpha8(const SkImageInfo& dstInfo, void* vdst, size return false; } - case kAlpha_16_SkColorType: { + case kA16_unorm_SkColorType: { auto src16 = (const uint16_t*) src; for (int y = 0; y < srcInfo.height(); y++) { for (int x = 0; x < srcInfo.width(); x++) { @@ -98,9 +98,9 @@ static bool convert_to_alpha8(const SkImageInfo& dstInfo, void* vdst, size case kGray_8_SkColorType: case kRGB_565_SkColorType: - case kRG_88_SkColorType: - case kRG_1616_SkColorType: - case kRG_F16_SkColorType: + case kR8G8_unorm_SkColorType: + case kR16G16_unorm_SkColorType: + case kR16G16_float_SkColorType: case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: { for (int y = 0; y < srcInfo.height(); ++y) { @@ -172,7 +172,7 @@ static bool convert_to_alpha8(const SkImageInfo& dstInfo, void* vdst, size return true; } - case kAlpha_F16_SkColorType: { + case kA16_float_SkColorType: { auto srcF16 = (const uint16_t*) src; for (int y = 0; y < srcInfo.height(); y++) { for (int x = 0; x < srcInfo.width(); x++) { @@ -184,7 +184,7 @@ static bool convert_to_alpha8(const SkImageInfo& dstInfo, void* vdst, size return true; } - case kRGBA_16161616_SkColorType: { + case kR16G16B16A16_unorm_SkColorType: { auto src64 = (const uint64_t*) src; for (int y = 0; y < srcInfo.height(); y++) { for (int x = 0; x < srcInfo.width(); x++) { diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp index 99793816ee..b03896b7c8 100644 --- a/src/core/SkImageInfo.cpp +++ b/src/core/SkImageInfo.cpp @@ -12,25 +12,25 @@ int SkColorTypeBytesPerPixel(SkColorType ct) { switch (ct) { - case kUnknown_SkColorType: return 0; - case kAlpha_8_SkColorType: return 1; - case kRGB_565_SkColorType: return 2; - case kARGB_4444_SkColorType: return 2; - case kRGBA_8888_SkColorType: return 4; - case kBGRA_8888_SkColorType: return 4; - case kRGB_888x_SkColorType: return 4; - case kRGBA_1010102_SkColorType: return 4; - case kRGB_101010x_SkColorType: return 4; - case kGray_8_SkColorType: return 1; - case kRGBA_F16Norm_SkColorType: return 8; - case kRGBA_F16_SkColorType: return 8; - case kRGBA_F32_SkColorType: return 16; - case kRG_88_SkColorType: return 2; - case kAlpha_16_SkColorType: return 2; - case kRG_1616_SkColorType: return 4; - case kAlpha_F16_SkColorType: return 2; - case kRG_F16_SkColorType: return 4; - case kRGBA_16161616_SkColorType: return 8; + case kUnknown_SkColorType: return 0; + case kAlpha_8_SkColorType: return 1; + case kRGB_565_SkColorType: return 2; + case kARGB_4444_SkColorType: return 2; + case kRGBA_8888_SkColorType: return 4; + case kBGRA_8888_SkColorType: return 4; + case kRGB_888x_SkColorType: return 4; + case kRGBA_1010102_SkColorType: return 4; + case kRGB_101010x_SkColorType: return 4; + case kGray_8_SkColorType: return 1; + case kRGBA_F16Norm_SkColorType: return 8; + case kRGBA_F16_SkColorType: return 8; + case kRGBA_F32_SkColorType: return 16; + case kR8G8_unorm_SkColorType: return 2; + case kA16_unorm_SkColorType: return 2; + case kR16G16_unorm_SkColorType: return 4; + case kA16_float_SkColorType: return 2; + case kR16G16_float_SkColorType: return 4; + case kR16G16B16A16_unorm_SkColorType: return 8; } SkUNREACHABLE; } @@ -73,8 +73,8 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, alphaType = kUnknown_SkAlphaType; break; case kAlpha_8_SkColorType: // fall-through - case kAlpha_16_SkColorType: // fall-through - case kAlpha_F16_SkColorType: + case kA16_unorm_SkColorType: // fall-through + case kA16_float_SkColorType: if (kUnpremul_SkAlphaType == alphaType) { alphaType = kPremul_SkAlphaType; } @@ -86,15 +86,15 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, case kRGBA_F16Norm_SkColorType: case kRGBA_F16_SkColorType: case kRGBA_F32_SkColorType: - case kRGBA_16161616_SkColorType: + case kR16G16B16A16_unorm_SkColorType: if (kUnknown_SkAlphaType == alphaType) { return false; } break; case kGray_8_SkColorType: - case kRG_88_SkColorType: - case kRG_1616_SkColorType: - case kRG_F16_SkColorType: + case kR8G8_unorm_SkColorType: + case kR16G16_unorm_SkColorType: + case kR16G16_float_SkColorType: case kRGB_565_SkColorType: case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp index d0c85c124a..748b7eaf70 100644 --- a/src/core/SkMipMap.cpp +++ b/src/core/SkMipMap.cpp @@ -464,7 +464,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) { proc_3_2 = downsample_3_2; proc_3_3 = downsample_3_3; break; - case kRG_88_SkColorType: + case kR8G8_unorm_SkColorType: proc_1_2 = downsample_1_2; proc_1_3 = downsample_1_3; proc_2_1 = downsample_2_1; @@ -474,7 +474,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) { proc_3_2 = downsample_3_2; proc_3_3 = downsample_3_3; break; - case kRG_1616_SkColorType: + case kR16G16_unorm_SkColorType: proc_1_2 = downsample_1_2; proc_1_3 = downsample_1_3; proc_2_1 = downsample_2_1; @@ -484,7 +484,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) { proc_3_2 = downsample_3_2; proc_3_3 = downsample_3_3; break; - case kAlpha_16_SkColorType: + case kA16_unorm_SkColorType: proc_1_2 = downsample_1_2; proc_1_3 = downsample_1_3; proc_2_1 = downsample_2_1; @@ -504,7 +504,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) { proc_3_2 = downsample_3_2; proc_3_3 = downsample_3_3; break; - case kAlpha_F16_SkColorType: + case kA16_float_SkColorType: proc_1_2 = downsample_1_2; proc_1_3 = downsample_1_3; proc_2_1 = downsample_2_1; @@ -514,7 +514,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) { proc_3_2 = downsample_3_2; proc_3_3 = downsample_3_3; break; - case kRG_F16_SkColorType: + case kR16G16_float_SkColorType: proc_1_2 = downsample_1_2; proc_1_3 = downsample_1_3; proc_2_1 = downsample_2_1; @@ -524,7 +524,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) { proc_3_2 = downsample_3_2; proc_3_3 = downsample_3_3; break; - case kRGBA_16161616_SkColorType: + case kR16G16B16A16_unorm_SkColorType: proc_1_2 = downsample_1_2; proc_1_3 = downsample_1_3; proc_2_1 = downsample_2_1; diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp index 876675c27e..353c252af5 100644 --- a/src/core/SkPixmap.cpp +++ b/src/core/SkPixmap.cpp @@ -100,9 +100,9 @@ float SkPixmap::getAlphaf(int x, int y) const { case kUnknown_SkColorType: return 0; case kGray_8_SkColorType: - case kRG_88_SkColorType: - case kRG_1616_SkColorType: - case kRG_F16_SkColorType: + case kR8G8_unorm_SkColorType: + case kR16G16_unorm_SkColorType: + case kR16G16_float_SkColorType: case kRGB_565_SkColorType: case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: @@ -110,10 +110,10 @@ float SkPixmap::getAlphaf(int x, int y) const { case kAlpha_8_SkColorType: value = static_cast(srcPtr)[0] * (1.0f/255); break; - case kAlpha_16_SkColorType: + case kA16_unorm_SkColorType: value = static_cast(srcPtr)[0] * (1.0f/65535); break; - case kAlpha_F16_SkColorType: { + case kA16_float_SkColorType: { SkHalf half = static_cast(srcPtr)[0]; value = SkHalfToFloat(half); break; @@ -132,7 +132,7 @@ float SkPixmap::getAlphaf(int x, int y) const { value = (u32 >> 30) * (1.0f/3); break; } - case kRGBA_16161616_SkColorType: { + case kR16G16B16A16_unorm_SkColorType: { uint64_t u64 = static_cast(srcPtr)[0]; value = (u64 >> 48) * (1.0f/65535); break; @@ -277,11 +277,11 @@ SkColor SkPixmap::getColor(int x, int y) const { case kAlpha_8_SkColorType: { return SkColorSetA(0, *this->addr8(x, y)); } - case kAlpha_16_SkColorType: { + case kA16_unorm_SkColorType: { uint16_t value = *this->addr16(x, y); return SkColorSetA(0, value * (255 / 65535.0f)); } - case kAlpha_F16_SkColorType: { + case kA16_float_SkColorType: { SkHalf value = *this->addr16(x, y); return SkColorSetA(0, 255 * SkHalfToFloat(value)); } @@ -293,19 +293,19 @@ SkColor SkPixmap::getColor(int x, int y) const { SkPMColor c = SkPixel4444ToPixel32(value); return toColor(c); } - case kRG_88_SkColorType: { + case kR8G8_unorm_SkColorType: { uint16_t value = *this->addr16(x, y); return (uint32_t)( ((value >> 0) & 0xff) ) << 16 | (uint32_t)( ((value >> 8) & 0xff) ) << 8 | 0xff000000; } - case kRG_1616_SkColorType: { + case kR16G16_unorm_SkColorType: { uint32_t value = *this->addr32(x, y); return (uint32_t)( ((value >> 0) & 0xffff) * (255/65535.0f) ) << 16 | (uint32_t)( ((value >> 16) & 0xffff) * (255/65535.0f) ) << 8 | 0xff000000; } - case kRG_F16_SkColorType: { + case kR16G16_float_SkColorType: { uint32_t value = *this->addr32(x, y); uint32_t r = 255 * SkHalfToFloat((value >> 0) & 0xffff); uint32_t g = 255 * SkHalfToFloat((value >> 16) & 0xffff); @@ -350,7 +350,7 @@ SkColor SkPixmap::getColor(int x, int y) const { | (uint32_t)( b * 255.0f ) << 0 | (uint32_t)( a * 255.0f ) << 24; } - case kRGBA_16161616_SkColorType: { + case kR16G16B16A16_unorm_SkColorType: { uint64_t value = *this->addr64(x, y); float r = ((value ) & 0xffff) * (1/65535.0f), @@ -419,7 +419,7 @@ bool SkPixmap::computeIsOpaque() const { } return true; } - case kAlpha_16_SkColorType: { + case kA16_unorm_SkColorType: { unsigned a = 0xFFFF; for (int y = 0; y < height; ++y) { const uint16_t* row = this->addr16(0, y); @@ -432,7 +432,7 @@ bool SkPixmap::computeIsOpaque() const { } return true; } - case kAlpha_F16_SkColorType: { + case kA16_float_SkColorType: { for (int y = 0; y < height; ++y) { const SkHalf* row = this->addr16(0, y); for (int x = 0; x < width; ++x) { @@ -445,9 +445,9 @@ bool SkPixmap::computeIsOpaque() const { } case kRGB_565_SkColorType: case kGray_8_SkColorType: - case kRG_88_SkColorType: - case kRG_1616_SkColorType: - case kRG_F16_SkColorType: + case kR8G8_unorm_SkColorType: + case kR16G16_unorm_SkColorType: + case kR16G16_float_SkColorType: case kRGB_888x_SkColorType: case kRGB_101010x_SkColorType: return true; @@ -517,7 +517,7 @@ bool SkPixmap::computeIsOpaque() const { } return true; } - case kRGBA_16161616_SkColorType: { + case kR16G16B16A16_unorm_SkColorType: { uint16_t acc = 0xFFFF; for (int y = 0; y < height; ++y) { const uint64_t* row = this->addr64(0, y); diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp index 7fa573f095..1ff515e450 100644 --- a/src/core/SkRasterPipeline.cpp +++ b/src/core/SkRasterPipeline.cpp @@ -165,36 +165,36 @@ void SkRasterPipeline::append_load(SkColorType ct, const SkRasterPipeline_Memory switch (ct) { case kUnknown_SkColorType: SkASSERT(false); break; - case kAlpha_8_SkColorType: this->append(load_a8, ctx); break; - case kAlpha_16_SkColorType: this->append(load_a16, ctx); break; - case kAlpha_F16_SkColorType: this->append(load_af16, ctx); break; - case kRGB_565_SkColorType: this->append(load_565, ctx); break; - case kARGB_4444_SkColorType: this->append(load_4444, ctx); break; - case kRG_88_SkColorType: this->append(load_rg88, ctx); break; - case kRG_1616_SkColorType: this->append(load_rg1616, ctx); break; - case kRG_F16_SkColorType: this->append(load_rgf16, ctx); break; - case kRGBA_8888_SkColorType: this->append(load_8888, ctx); break; - case kRGBA_1010102_SkColorType: this->append(load_1010102, ctx); break; - case kRGBA_16161616_SkColorType:this->append(load_16161616,ctx); break; + case kAlpha_8_SkColorType: this->append(load_a8, ctx); break; + case kA16_unorm_SkColorType: this->append(load_a16, ctx); break; + case kA16_float_SkColorType: this->append(load_af16, ctx); break; + case kRGB_565_SkColorType: this->append(load_565, ctx); break; + case kARGB_4444_SkColorType: this->append(load_4444, ctx); break; + case kR8G8_unorm_SkColorType: this->append(load_rg88, ctx); break; + case kR16G16_unorm_SkColorType: this->append(load_rg1616, ctx); break; + case kR16G16_float_SkColorType: this->append(load_rgf16, ctx); break; + case kRGBA_8888_SkColorType: this->append(load_8888, ctx); break; + case kRGBA_1010102_SkColorType: this->append(load_1010102, ctx); break; + case kR16G16B16A16_unorm_SkColorType:this->append(load_16161616,ctx); break; case kRGBA_F16Norm_SkColorType: - case kRGBA_F16_SkColorType: this->append(load_f16, ctx); break; - case kRGBA_F32_SkColorType: this->append(load_f32, ctx); break; + case kRGBA_F16_SkColorType: this->append(load_f16, ctx); break; + case kRGBA_F32_SkColorType: this->append(load_f32, ctx); break; - case kGray_8_SkColorType: this->append(load_a8, ctx); - this->append(alpha_to_gray); - break; + case kGray_8_SkColorType: this->append(load_a8, ctx); + this->append(alpha_to_gray); + break; - case kRGB_888x_SkColorType: this->append(load_8888, ctx); - this->append(force_opaque); - break; + case kRGB_888x_SkColorType: this->append(load_8888, ctx); + this->append(force_opaque); + break; - case kRGB_101010x_SkColorType: this->append(load_1010102, ctx); - this->append(force_opaque); - break; + case kRGB_101010x_SkColorType: this->append(load_1010102, ctx); + this->append(force_opaque); + break; - case kBGRA_8888_SkColorType: this->append(load_8888, ctx); - this->append(swap_rb); - break; + case kBGRA_8888_SkColorType: this->append(load_8888, ctx); + this->append(swap_rb); + break; } } @@ -202,36 +202,36 @@ void SkRasterPipeline::append_load_dst(SkColorType ct, const SkRasterPipeline_Me switch (ct) { case kUnknown_SkColorType: SkASSERT(false); break; - case kAlpha_8_SkColorType: this->append(load_a8_dst, ctx); break; - case kAlpha_16_SkColorType: this->append(load_a16_dst, ctx); break; - case kAlpha_F16_SkColorType: this->append(load_af16_dst, ctx); break; - case kRGB_565_SkColorType: this->append(load_565_dst, ctx); break; - case kARGB_4444_SkColorType: this->append(load_4444_dst, ctx); break; - case kRG_88_SkColorType: this->append(load_rg88_dst, ctx); break; - case kRG_1616_SkColorType: this->append(load_rg1616_dst, ctx); break; - case kRG_F16_SkColorType: this->append(load_rgf16_dst, ctx); break; - case kRGBA_8888_SkColorType: this->append(load_8888_dst, ctx); break; - case kRGBA_1010102_SkColorType: this->append(load_1010102_dst, ctx); break; - case kRGBA_16161616_SkColorType:this->append(load_16161616_dst,ctx); break; + case kAlpha_8_SkColorType: this->append(load_a8_dst, ctx); break; + case kA16_unorm_SkColorType: this->append(load_a16_dst, ctx); break; + case kA16_float_SkColorType: this->append(load_af16_dst, ctx); break; + case kRGB_565_SkColorType: this->append(load_565_dst, ctx); break; + case kARGB_4444_SkColorType: this->append(load_4444_dst, ctx); break; + case kR8G8_unorm_SkColorType: this->append(load_rg88_dst, ctx); break; + case kR16G16_unorm_SkColorType: this->append(load_rg1616_dst, ctx); break; + case kR16G16_float_SkColorType: this->append(load_rgf16_dst, ctx); break; + case kRGBA_8888_SkColorType: this->append(load_8888_dst, ctx); break; + case kRGBA_1010102_SkColorType: this->append(load_1010102_dst, ctx); break; + case kR16G16B16A16_unorm_SkColorType: this->append(load_16161616_dst,ctx); break; case kRGBA_F16Norm_SkColorType: - case kRGBA_F16_SkColorType: this->append(load_f16_dst, ctx); break; - case kRGBA_F32_SkColorType: this->append(load_f32_dst, ctx); break; + case kRGBA_F16_SkColorType: this->append(load_f16_dst, ctx); break; + case kRGBA_F32_SkColorType: this->append(load_f32_dst, ctx); break; - case kGray_8_SkColorType: this->append(load_a8_dst, ctx); - this->append(alpha_to_gray_dst); - break; + case kGray_8_SkColorType: this->append(load_a8_dst, ctx); + this->append(alpha_to_gray_dst); + break; - case kRGB_888x_SkColorType: this->append(load_8888_dst, ctx); - this->append(force_opaque_dst); - break; + case kRGB_888x_SkColorType: this->append(load_8888_dst, ctx); + this->append(force_opaque_dst); + break; - case kRGB_101010x_SkColorType: this->append(load_1010102_dst, ctx); - this->append(force_opaque_dst); - break; + case kRGB_101010x_SkColorType: this->append(load_1010102_dst, ctx); + this->append(force_opaque_dst); + break; - case kBGRA_8888_SkColorType: this->append(load_8888_dst, ctx); - this->append(swap_rb_dst); - break; + case kBGRA_8888_SkColorType: this->append(load_8888_dst, ctx); + this->append(swap_rb_dst); + break; } } @@ -239,36 +239,36 @@ void SkRasterPipeline::append_store(SkColorType ct, const SkRasterPipeline_Memor switch (ct) { case kUnknown_SkColorType: SkASSERT(false); break; - case kAlpha_8_SkColorType: this->append(store_a8, ctx); break; - case kAlpha_16_SkColorType: this->append(store_a16, ctx); break; - case kAlpha_F16_SkColorType: this->append(store_af16, ctx); break; - case kRGB_565_SkColorType: this->append(store_565, ctx); break; - case kARGB_4444_SkColorType: this->append(store_4444, ctx); break; - case kRG_88_SkColorType: this->append(store_rg88, ctx); break; - case kRG_1616_SkColorType: this->append(store_rg1616, ctx); break; - case kRG_F16_SkColorType: this->append(store_rgf16, ctx); break; - case kRGBA_8888_SkColorType: this->append(store_8888, ctx); break; - case kRGBA_1010102_SkColorType: this->append(store_1010102, ctx); break; - case kRGBA_16161616_SkColorType:this->append(store_16161616,ctx); break; + case kAlpha_8_SkColorType: this->append(store_a8, ctx); break; + case kA16_unorm_SkColorType: this->append(store_a16, ctx); break; + case kA16_float_SkColorType: this->append(store_af16, ctx); break; + case kRGB_565_SkColorType: this->append(store_565, ctx); break; + case kARGB_4444_SkColorType: this->append(store_4444, ctx); break; + case kR8G8_unorm_SkColorType: this->append(store_rg88, ctx); break; + case kR16G16_unorm_SkColorType: this->append(store_rg1616, ctx); break; + case kR16G16_float_SkColorType: this->append(store_rgf16, ctx); break; + case kRGBA_8888_SkColorType: this->append(store_8888, ctx); break; + case kRGBA_1010102_SkColorType: this->append(store_1010102, ctx); break; + case kR16G16B16A16_unorm_SkColorType: this->append(store_16161616,ctx); break; case kRGBA_F16Norm_SkColorType: - case kRGBA_F16_SkColorType: this->append(store_f16, ctx); break; - case kRGBA_F32_SkColorType: this->append(store_f32, ctx); break; + case kRGBA_F16_SkColorType: this->append(store_f16, ctx); break; + case kRGBA_F32_SkColorType: this->append(store_f32, ctx); break; - case kRGB_888x_SkColorType: this->append(force_opaque); - this->append(store_8888, ctx); - break; + case kRGB_888x_SkColorType: this->append(force_opaque); + this->append(store_8888, ctx); + break; - case kRGB_101010x_SkColorType: this->append(force_opaque); - this->append(store_1010102, ctx); - break; + case kRGB_101010x_SkColorType: this->append(force_opaque); + this->append(store_1010102, ctx); + break; - case kGray_8_SkColorType: this->append(bt709_luminance_or_luma_to_alpha); - this->append(store_a8, ctx); - break; + case kGray_8_SkColorType: this->append(bt709_luminance_or_luma_to_alpha); + this->append(store_a8, ctx); + break; - case kBGRA_8888_SkColorType: this->append(swap_rb); - this->append(store_8888, ctx); - break; + case kBGRA_8888_SkColorType: this->append(swap_rb); + this->append(store_8888, ctx); + break; } } diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index a523386fee..ca1ee2378a 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -257,17 +257,17 @@ GrPixelConfig SkColorType2GrPixelConfig(const SkColorType type) { return kRGBA_half_GrPixelConfig; case kRGBA_F32_SkColorType: return kRGBA_float_GrPixelConfig; - case kRG_88_SkColorType: + case kR8G8_unorm_SkColorType: return kRG_88_GrPixelConfig; - case kRG_1616_SkColorType: + case kR16G16_unorm_SkColorType: return kRG_1616_GrPixelConfig; - case kAlpha_16_SkColorType: + case kA16_unorm_SkColorType: return kAlpha_16_GrPixelConfig; - case kAlpha_F16_SkColorType: + case kA16_float_SkColorType: return kAlpha_half_GrPixelConfig; - case kRG_F16_SkColorType: + case kR16G16_float_SkColorType: return kRG_half_GrPixelConfig; - case kRGBA_16161616_SkColorType: + case kR16G16B16A16_unorm_SkColorType: return kRGBA_16161616_GrPixelConfig; } SkUNREACHABLE; diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp index c587e82192..f6e4c4f161 100644 --- a/src/image/SkSurface_Raster.cpp +++ b/src/image/SkSurface_Raster.cpp @@ -42,12 +42,12 @@ bool SkSurfaceValidateRasterInfo(const SkImageInfo& info, size_t rowBytes) { return false; } - if (info.colorType() == kRG_88_SkColorType || - info.colorType() == kRG_1616_SkColorType || - info.colorType() == kRG_F16_SkColorType || - info.colorType() == kAlpha_16_SkColorType || - info.colorType() == kAlpha_F16_SkColorType || - info.colorType() == kRGBA_16161616_SkColorType) { + if (info.colorType() == kR8G8_unorm_SkColorType || + info.colorType() == kR16G16_unorm_SkColorType || + info.colorType() == kR16G16_float_SkColorType || + info.colorType() == kA16_unorm_SkColorType || + info.colorType() == kA16_float_SkColorType || + info.colorType() == kR16G16B16A16_unorm_SkColorType) { return false; } diff --git a/src/images/SkPngEncoder.cpp b/src/images/SkPngEncoder.cpp index 20c1a5f271..48045e97df 100644 --- a/src/images/SkPngEncoder.cpp +++ b/src/images/SkPngEncoder.cpp @@ -315,12 +315,12 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info) { return transform_scanline_101010x; case kAlpha_8_SkColorType: return transform_scanline_A8_to_GrayAlpha; - case kRG_88_SkColorType: - case kRG_1616_SkColorType: - case kRG_F16_SkColorType: - case kAlpha_16_SkColorType: - case kAlpha_F16_SkColorType: - case kRGBA_16161616_SkColorType: + case kR8G8_unorm_SkColorType: + case kR16G16_unorm_SkColorType: + case kR16G16_float_SkColorType: + case kA16_unorm_SkColorType: + case kA16_float_SkColorType: + case kR16G16B16A16_unorm_SkColorType: return nullptr; } SkASSERT(false); diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp index 5b6d6c836a..ef4e163ea7 100644 --- a/src/shaders/SkImageShader.cpp +++ b/src/shaders/SkImageShader.cpp @@ -421,16 +421,17 @@ bool SkImageShader::doStages(const SkStageRec& rec, SkImageStageUpdater* updater void* ctx = gather; switch (info.colorType()) { case kAlpha_8_SkColorType: p->append(SkRasterPipeline::gather_a8, ctx); break; - case kAlpha_16_SkColorType: p->append(SkRasterPipeline::gather_a16, ctx); break; - case kAlpha_F16_SkColorType: p->append(SkRasterPipeline::gather_af16, ctx); break; + case kA16_unorm_SkColorType: p->append(SkRasterPipeline::gather_a16, ctx); break; + case kA16_float_SkColorType: p->append(SkRasterPipeline::gather_af16, ctx); break; case kRGB_565_SkColorType: p->append(SkRasterPipeline::gather_565, ctx); break; case kARGB_4444_SkColorType: p->append(SkRasterPipeline::gather_4444, ctx); break; - case kRG_88_SkColorType: p->append(SkRasterPipeline::gather_rg88, ctx); break; - case kRG_1616_SkColorType: p->append(SkRasterPipeline::gather_rg1616, ctx); break; - case kRG_F16_SkColorType: p->append(SkRasterPipeline::gather_rgf16, ctx); break; + case kR8G8_unorm_SkColorType: p->append(SkRasterPipeline::gather_rg88, ctx); break; + case kR16G16_unorm_SkColorType: p->append(SkRasterPipeline::gather_rg1616, ctx); break; + case kR16G16_float_SkColorType: p->append(SkRasterPipeline::gather_rgf16, ctx); break; case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::gather_8888, ctx); break; case kRGBA_1010102_SkColorType: p->append(SkRasterPipeline::gather_1010102, ctx); break; - case kRGBA_16161616_SkColorType:p->append(SkRasterPipeline::gather_16161616,ctx); break; + case kR16G16B16A16_unorm_SkColorType: + p->append(SkRasterPipeline::gather_16161616,ctx); break; case kRGBA_F16Norm_SkColorType: case kRGBA_F16_SkColorType: p->append(SkRasterPipeline::gather_f16, ctx); break; case kRGBA_F32_SkColorType: p->append(SkRasterPipeline::gather_f32, ctx); break; diff --git a/tests/BackendAllocationTest.cpp b/tests/BackendAllocationTest.cpp index 651d07ec2e..5c7db55bf6 100644 --- a/tests/BackendAllocationTest.cpp +++ b/tests/BackendAllocationTest.cpp @@ -409,27 +409,27 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ColorTypeBackendAllocationTest, reporter, ctx SkColorType fColorType; SkColor4f fColor; } combinations[] = { - { kAlpha_8_SkColorType, kTransCol }, - { kRGB_565_SkColorType, SkColors::kRed }, - { kARGB_4444_SkColorType, SkColors::kGreen }, - { kRGBA_8888_SkColorType, SkColors::kBlue }, - { kRGB_888x_SkColorType, SkColors::kCyan }, + { kAlpha_8_SkColorType, kTransCol }, + { kRGB_565_SkColorType, SkColors::kRed }, + { kARGB_4444_SkColorType, SkColors::kGreen }, + { kRGBA_8888_SkColorType, SkColors::kBlue }, + { kRGB_888x_SkColorType, SkColors::kCyan }, // TODO: readback is busted when alpha = 0.5f (perhaps premul vs. unpremul) - { kBGRA_8888_SkColorType, { 1, 0, 0, 1.0f } }, + { kBGRA_8888_SkColorType, { 1, 0, 0, 1.0f } }, // TODO: readback is busted when alpha = 0.5f (perhaps premul vs. unpremul) - { kRGBA_1010102_SkColorType, { .25f, .5f, .75f, 1.0f }}, + { kRGBA_1010102_SkColorType, { .25f, .5f, .75f, 1.0f }}, // The kRGB_101010x_SkColorType has no Ganesh correlate - { kRGB_101010x_SkColorType, { 0, 0.5f, 0, 0.5f } }, - { kGray_8_SkColorType, kGrayCol }, - { kRGBA_F16Norm_SkColorType, SkColors::kLtGray }, - { kRGBA_F16_SkColorType, SkColors::kYellow }, - { kRGBA_F32_SkColorType, SkColors::kGray }, - { kRG_88_SkColorType, { .25f, .75f, 0, 0 } }, - { kRG_1616_SkColorType, SkColors::kGreen }, - { kAlpha_16_SkColorType, kTransCol }, - { kAlpha_F16_SkColorType, kTransCol }, - { kRG_F16_SkColorType, { .25f, .75f, 0, 0 } }, - { kRGBA_16161616_SkColorType,{ .25f, .5f, .75f, 1 } }, + { kRGB_101010x_SkColorType, { 0, 0.5f, 0, 0.5f } }, + { kGray_8_SkColorType, kGrayCol }, + { kRGBA_F16Norm_SkColorType, SkColors::kLtGray }, + { kRGBA_F16_SkColorType, SkColors::kYellow }, + { kRGBA_F32_SkColorType, SkColors::kGray }, + { kR8G8_unorm_SkColorType, { .25f, .75f, 0, 0 } }, + { kR16G16_unorm_SkColorType, SkColors::kGreen }, + { kA16_unorm_SkColorType, kTransCol }, + { kA16_float_SkColorType, kTransCol }, + { kR16G16_float_SkColorType, { .25f, .75f, 0, 0 } }, + { kR16G16B16A16_unorm_SkColorType,{ .25f, .5f, .75f, 1 } }, }; GR_STATIC_ASSERT(kLastEnum_SkColorType == SK_ARRAY_COUNT(combinations)); diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp index 33710f8603..e21d7275b2 100644 --- a/tests/BitmapTest.cpp +++ b/tests/BitmapTest.cpp @@ -330,26 +330,26 @@ DEF_TEST(getalphaf, reporter) { SkColorType fColorType; bool (*fPred)(float, float); } recs[] = { - { kRGB_565_SkColorType, opaque }, - { kGray_8_SkColorType, opaque }, - { kRG_88_SkColorType, opaque }, - { kRG_1616_SkColorType, opaque }, - { kRG_F16_SkColorType, opaque }, - { kRGB_888x_SkColorType, opaque }, - { kRGB_101010x_SkColorType, opaque }, + { kRGB_565_SkColorType, opaque }, + { kGray_8_SkColorType, opaque }, + { kR8G8_unorm_SkColorType, opaque }, + { kR16G16_unorm_SkColorType, opaque }, + { kR16G16_float_SkColorType, opaque }, + { kRGB_888x_SkColorType, opaque }, + { kRGB_101010x_SkColorType, opaque }, - { kAlpha_8_SkColorType, nearly }, - { kAlpha_16_SkColorType, nearly }, - { kAlpha_F16_SkColorType, nearly_half }, - { kRGBA_8888_SkColorType, nearly }, - { kBGRA_8888_SkColorType, nearly }, - { kRGBA_16161616_SkColorType, nearly }, - { kRGBA_F16_SkColorType, nearly_half }, - { kRGBA_F32_SkColorType, nearly }, + { kAlpha_8_SkColorType, nearly }, + { kA16_unorm_SkColorType, nearly }, + { kA16_float_SkColorType, nearly_half }, + { kRGBA_8888_SkColorType, nearly }, + { kBGRA_8888_SkColorType, nearly }, + { kR16G16B16A16_unorm_SkColorType, nearly }, + { kRGBA_F16_SkColorType, nearly_half }, + { kRGBA_F32_SkColorType, nearly }, - { kRGBA_1010102_SkColorType, nearly2bit }, + { kRGBA_1010102_SkColorType, nearly2bit }, - { kARGB_4444_SkColorType, nearly4bit }, + { kARGB_4444_SkColorType, nearly4bit }, }; for (const auto& rec : recs) { diff --git a/tests/ExtendedSkColorTypeTests.cpp b/tests/ExtendedSkColorTypeTests.cpp index 151694d74e..5de5bd5f79 100644 --- a/tests/ExtendedSkColorTypeTests.cpp +++ b/tests/ExtendedSkColorTypeTests.cpp @@ -53,24 +53,24 @@ struct TestCase { }; static const TestCase gTests[] = { - { kAlpha_8_SkColorType, kPremul_SkAlphaType, kAlpha_SkColorTypeComponentFlag, true }, - { kAlpha_16_SkColorType, kPremul_SkAlphaType, kAlpha_SkColorTypeComponentFlag, false }, - { kAlpha_F16_SkColorType, kPremul_SkAlphaType, kAlpha_SkColorTypeComponentFlag, false }, - { kRGB_565_SkColorType, kOpaque_SkAlphaType, kRGB_SkColorTypeComponentFlags, true }, - { kARGB_4444_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, - { kRGBA_8888_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, - { kRGB_888x_SkColorType, kOpaque_SkAlphaType, kRGB_SkColorTypeComponentFlags, true }, - { kBGRA_8888_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, - { kRGBA_1010102_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, - { kRGB_101010x_SkColorType, kOpaque_SkAlphaType, kRGB_SkColorTypeComponentFlags, true }, - { kGray_8_SkColorType, kOpaque_SkAlphaType, kGray_SkColorTypeComponentFlag, true }, - { kRGBA_F16Norm_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, - { kRGBA_F16_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, - { kRGBA_F32_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, - { kRG_88_SkColorType, kOpaque_SkAlphaType, kRG_SkColorTypeComponentFlags, false }, - { kRG_1616_SkColorType, kOpaque_SkAlphaType, kRG_SkColorTypeComponentFlags, false }, - { kRG_F16_SkColorType, kOpaque_SkAlphaType, kRG_SkColorTypeComponentFlags, false }, - { kRGBA_16161616_SkColorType,kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, false }, + { kAlpha_8_SkColorType, kPremul_SkAlphaType, kAlpha_SkColorTypeComponentFlag, true }, + { kA16_unorm_SkColorType, kPremul_SkAlphaType, kAlpha_SkColorTypeComponentFlag, false }, + { kA16_float_SkColorType, kPremul_SkAlphaType, kAlpha_SkColorTypeComponentFlag, false }, + { kRGB_565_SkColorType, kOpaque_SkAlphaType, kRGB_SkColorTypeComponentFlags, true }, + { kARGB_4444_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, + { kRGBA_8888_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, + { kRGB_888x_SkColorType, kOpaque_SkAlphaType, kRGB_SkColorTypeComponentFlags, true }, + { kBGRA_8888_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, + { kRGBA_1010102_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, + { kRGB_101010x_SkColorType, kOpaque_SkAlphaType, kRGB_SkColorTypeComponentFlags, true }, + { kGray_8_SkColorType, kOpaque_SkAlphaType, kGray_SkColorTypeComponentFlag, true }, + { kRGBA_F16Norm_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, + { kRGBA_F16_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, + { kRGBA_F32_SkColorType, kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, true }, + { kR8G8_unorm_SkColorType, kOpaque_SkAlphaType, kRG_SkColorTypeComponentFlags, false }, + { kR16G16_unorm_SkColorType, kOpaque_SkAlphaType, kRG_SkColorTypeComponentFlags, false }, + { kR16G16_float_SkColorType, kOpaque_SkAlphaType, kRG_SkColorTypeComponentFlags, false }, + { kR16G16B16A16_unorm_SkColorType,kPremul_SkAlphaType, kRGBA_SkColorTypeComponentFlags, false }, }; static void raster_tests(skiatest::Reporter* reporter, const TestCase& test) { diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index a7280bdb5a..b91fdff5c3 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -622,25 +622,25 @@ DEF_TEST(ReadPixels_ValidConversion, reporter) { static int min_rgb_channel_bits(SkColorType ct) { switch (ct) { - case kUnknown_SkColorType: return 0; - case kAlpha_8_SkColorType: return 8; - case kAlpha_16_SkColorType: return 16; - case kAlpha_F16_SkColorType: return 16; - case kRGB_565_SkColorType: return 5; - case kARGB_4444_SkColorType: return 4; - case kRG_88_SkColorType: return 8; - case kRG_1616_SkColorType: return 16; - case kRG_F16_SkColorType: return 16; - case kRGBA_8888_SkColorType: return 8; - case kRGB_888x_SkColorType: return 8; - case kBGRA_8888_SkColorType: return 8; - case kRGBA_1010102_SkColorType: return 10; - case kRGB_101010x_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 - case kRGBA_F32_SkColorType: return 23; // just counting the mantissa - case kRGBA_16161616_SkColorType:return 16; + case kUnknown_SkColorType: return 0; + case kAlpha_8_SkColorType: return 8; + case kA16_unorm_SkColorType: return 16; + case kA16_float_SkColorType: return 16; + case kRGB_565_SkColorType: return 5; + case kARGB_4444_SkColorType: return 4; + case kR8G8_unorm_SkColorType: return 8; + case kR16G16_unorm_SkColorType: return 16; + case kR16G16_float_SkColorType: return 16; + case kRGBA_8888_SkColorType: return 8; + case kRGB_888x_SkColorType: return 8; + case kBGRA_8888_SkColorType: return 8; + case kRGBA_1010102_SkColorType: return 10; + case kRGB_101010x_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 + case kRGBA_F32_SkColorType: return 23; // just counting the mantissa + case kR16G16B16A16_unorm_SkColorType: return 16; } SK_ABORT("Unexpected color type."); } diff --git a/tools/DDLPromiseImageHelper.cpp b/tools/DDLPromiseImageHelper.cpp index c35d83d80f..63901b182d 100644 --- a/tools/DDLPromiseImageHelper.cpp +++ b/tools/DDLPromiseImageHelper.cpp @@ -67,7 +67,7 @@ static GrBackendTexture create_yuva_texture(GrContext* context, const SkPixmap& } } if (2 == channelCount) { - SkASSERT(kRG_88_SkColorType == pm.colorType()); + SkASSERT(kR8G8_unorm_SkColorType == pm.colorType()); } #endif @@ -275,7 +275,7 @@ int DDLPromiseImageHelper::addImage(SkImage* image) { if (kUnknown_SkColorType == colorTypes[texIdx]) { colorTypes[texIdx] = kAlpha_8_SkColorType; } else { - colorTypes[texIdx] = kRG_88_SkColorType; + colorTypes[texIdx] = kR8G8_unorm_SkColorType; } } diff --git a/tools/HashAndEncode.cpp b/tools/HashAndEncode.cpp index 8acceb9894..76d4b76f3e 100644 --- a/tools/HashAndEncode.cpp +++ b/tools/HashAndEncode.cpp @@ -22,29 +22,29 @@ HashAndEncode::HashAndEncode(const SkBitmap& bitmap) : fSize(bitmap.info().dimen skcms_PixelFormat srcFmt; switch (bitmap.colorType()) { - case kUnknown_SkColorType: return; + case kUnknown_SkColorType: return; - case kAlpha_8_SkColorType: srcFmt = skcms_PixelFormat_A_8; break; - case kRGB_565_SkColorType: srcFmt = skcms_PixelFormat_BGR_565; break; - case kARGB_4444_SkColorType: srcFmt = skcms_PixelFormat_ABGR_4444; break; - case kRGBA_8888_SkColorType: srcFmt = skcms_PixelFormat_RGBA_8888; break; - case kBGRA_8888_SkColorType: srcFmt = skcms_PixelFormat_BGRA_8888; break; - case kRGBA_1010102_SkColorType: srcFmt = skcms_PixelFormat_RGBA_1010102; break; - case kGray_8_SkColorType: srcFmt = skcms_PixelFormat_G_8; break; - case kRGBA_F16Norm_SkColorType: srcFmt = skcms_PixelFormat_RGBA_hhhh; break; - case kRGBA_F16_SkColorType: srcFmt = skcms_PixelFormat_RGBA_hhhh; break; - case kRGBA_F32_SkColorType: srcFmt = skcms_PixelFormat_RGBA_ffff; break; + case kAlpha_8_SkColorType: srcFmt = skcms_PixelFormat_A_8; break; + case kRGB_565_SkColorType: srcFmt = skcms_PixelFormat_BGR_565; break; + case kARGB_4444_SkColorType: srcFmt = skcms_PixelFormat_ABGR_4444; break; + case kRGBA_8888_SkColorType: srcFmt = skcms_PixelFormat_RGBA_8888; break; + case kBGRA_8888_SkColorType: srcFmt = skcms_PixelFormat_BGRA_8888; break; + case kRGBA_1010102_SkColorType: srcFmt = skcms_PixelFormat_RGBA_1010102; break; + case kGray_8_SkColorType: srcFmt = skcms_PixelFormat_G_8; break; + case kRGBA_F16Norm_SkColorType: srcFmt = skcms_PixelFormat_RGBA_hhhh; break; + case kRGBA_F16_SkColorType: srcFmt = skcms_PixelFormat_RGBA_hhhh; break; + case kRGBA_F32_SkColorType: srcFmt = skcms_PixelFormat_RGBA_ffff; break; - case kRGB_888x_SkColorType: srcFmt = skcms_PixelFormat_RGBA_8888; - srcAlpha = skcms_AlphaFormat_Opaque; break; - case kRGB_101010x_SkColorType: srcFmt = skcms_PixelFormat_RGBA_1010102; - srcAlpha = skcms_AlphaFormat_Opaque; break; - case kRG_88_SkColorType: return; - case kRG_1616_SkColorType: return; - case kRG_F16_SkColorType: return; - case kAlpha_16_SkColorType: return; - case kAlpha_F16_SkColorType: return; - case kRGBA_16161616_SkColorType:return; + case kRGB_888x_SkColorType: srcFmt = skcms_PixelFormat_RGBA_8888; + srcAlpha = skcms_AlphaFormat_Opaque; break; + case kRGB_101010x_SkColorType: srcFmt = skcms_PixelFormat_RGBA_1010102; + srcAlpha = skcms_AlphaFormat_Opaque; break; + case kR8G8_unorm_SkColorType: return; + case kR16G16_unorm_SkColorType: return; + case kR16G16_float_SkColorType: return; + case kA16_unorm_SkColorType: return; + case kA16_float_SkColorType: return; + case kR16G16B16A16_unorm_SkColorType: return; } skcms_ICCProfile srcProfile = *skcms_sRGB_profile(); diff --git a/tools/ToolUtils.cpp b/tools/ToolUtils.cpp index 4fce704402..99e25ee799 100644 --- a/tools/ToolUtils.cpp +++ b/tools/ToolUtils.cpp @@ -48,25 +48,25 @@ const char* alphatype_name(SkAlphaType at) { const char* colortype_name(SkColorType ct) { switch (ct) { - case kUnknown_SkColorType: return "Unknown"; - case kAlpha_8_SkColorType: return "Alpha_8"; - case kAlpha_16_SkColorType: return "Alpha_16"; - case kAlpha_F16_SkColorType: return "Alpha_F16"; - case kRGB_565_SkColorType: return "RGB_565"; - case kARGB_4444_SkColorType: return "ARGB_4444"; - case kRGBA_8888_SkColorType: return "RGBA_8888"; - case kRGB_888x_SkColorType: return "RGB_888x"; - case kBGRA_8888_SkColorType: return "BGRA_8888"; - case kRGBA_1010102_SkColorType: return "RGBA_1010102"; - case kRGB_101010x_SkColorType: return "RGB_101010x"; - case kGray_8_SkColorType: return "Gray_8"; - case kRGBA_F16Norm_SkColorType: return "RGBA_F16Norm"; - case kRGBA_F16_SkColorType: return "RGBA_F16"; - case kRGBA_F32_SkColorType: return "RGBA_F32"; - case kRG_88_SkColorType: return "RG_88"; - case kRG_1616_SkColorType: return "RG_1616"; - case kRG_F16_SkColorType: return "RG_F16"; - case kRGBA_16161616_SkColorType:return "RGBA_16161616"; + case kUnknown_SkColorType: return "Unknown"; + case kAlpha_8_SkColorType: return "Alpha_8"; + case kA16_unorm_SkColorType: return "Alpha_16"; + case kA16_float_SkColorType: return "A16_float"; + case kRGB_565_SkColorType: return "RGB_565"; + case kARGB_4444_SkColorType: return "ARGB_4444"; + case kRGBA_8888_SkColorType: return "RGBA_8888"; + case kRGB_888x_SkColorType: return "RGB_888x"; + case kBGRA_8888_SkColorType: return "BGRA_8888"; + case kRGBA_1010102_SkColorType: return "RGBA_1010102"; + case kRGB_101010x_SkColorType: return "RGB_101010x"; + case kGray_8_SkColorType: return "Gray_8"; + case kRGBA_F16Norm_SkColorType: return "RGBA_F16Norm"; + case kRGBA_F16_SkColorType: return "RGBA_F16"; + case kRGBA_F32_SkColorType: return "RGBA_F32"; + case kR8G8_unorm_SkColorType: return "R8G8_unorm"; + case kR16G16_unorm_SkColorType: return "R16G16_unorm"; + case kR16G16_float_SkColorType: return "R16G16_float"; + case kR16G16B16A16_unorm_SkColorType: return "R16G16B16A16_unorm"; } SkASSERT(false); return "unexpected colortype"; @@ -74,25 +74,25 @@ const char* colortype_name(SkColorType ct) { const char* colortype_depth(SkColorType ct) { switch (ct) { - case kUnknown_SkColorType: return "Unknown"; - case kAlpha_8_SkColorType: return "A8"; - case kAlpha_16_SkColorType: return "A16"; - case kAlpha_F16_SkColorType: return "AF16"; - case kRGB_565_SkColorType: return "565"; - case kARGB_4444_SkColorType: return "4444"; - case kRGBA_8888_SkColorType: return "8888"; - case kRGB_888x_SkColorType: return "888"; - case kBGRA_8888_SkColorType: return "8888"; - case kRGBA_1010102_SkColorType: return "1010102"; - case kRGB_101010x_SkColorType: return "101010"; - case kGray_8_SkColorType: return "G8"; - case kRGBA_F16Norm_SkColorType: return "F16Norm"; // TODO: "F16"? - case kRGBA_F16_SkColorType: return "F16"; - case kRGBA_F32_SkColorType: return "F32"; - case kRG_88_SkColorType: return "88"; - case kRG_1616_SkColorType: return "1616"; - case kRG_F16_SkColorType: return "F16F16"; - case kRGBA_16161616_SkColorType:return "16161616"; + case kUnknown_SkColorType: return "Unknown"; + case kAlpha_8_SkColorType: return "A8"; + case kA16_unorm_SkColorType: return "A16"; + case kA16_float_SkColorType: return "AF16"; + case kRGB_565_SkColorType: return "565"; + case kARGB_4444_SkColorType: return "4444"; + case kRGBA_8888_SkColorType: return "8888"; + case kRGB_888x_SkColorType: return "888"; + case kBGRA_8888_SkColorType: return "8888"; + case kRGBA_1010102_SkColorType: return "1010102"; + case kRGB_101010x_SkColorType: return "101010"; + case kGray_8_SkColorType: return "G8"; + case kRGBA_F16Norm_SkColorType: return "F16Norm"; // TODO: "F16"? + case kRGBA_F16_SkColorType: return "F16"; + case kRGBA_F32_SkColorType: return "F32"; + case kR8G8_unorm_SkColorType: return "88"; + case kR16G16_unorm_SkColorType: return "1616"; + case kR16G16_float_SkColorType: return "F16F16"; + case kR16G16B16A16_unorm_SkColorType: return "16161616"; } SkASSERT(false); return "unexpected colortype";