New proposed syntax for SkColorTypes
Everything except for SkImageInfo.h is mechanical Change-Id: I2d775c79467fb15f6022e80d21b4a9151272fe2a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242896 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
f8b8b06dde
commit
ea1b30b57b
@ -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 "";
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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, //<! pixel with a uint8_t for red and green
|
||||
kR8G8_unorm_SkColorType, //<! pixel with a uint8_t for red and green
|
||||
|
||||
kAlpha_F16_SkColorType, //<! pixel with a half float for alpha
|
||||
kRG_F16_SkColorType, //<! pixel with a half float for red and green
|
||||
kA16_float_SkColorType, //<! pixel with a half float for alpha
|
||||
kR16G16_float_SkColorType, //<! pixel with a half float for red and green
|
||||
|
||||
kAlpha_16_SkColorType, //<! pixel with a little endian uint16_t for alpha
|
||||
kRG_1616_SkColorType, //<! pixel with a little endian uint16_t for red and green
|
||||
kRGBA_16161616_SkColorType,//<! pixel with a little endian uint16_t for red, green, blue, and alpha
|
||||
kA16_unorm_SkColorType, //<! pixel with a little endian uint16_t for alpha
|
||||
kR16G16_unorm_SkColorType, //<! pixel with a little endian uint16_t for red and green
|
||||
kR16G16B16A16_unorm_SkColorType,//<! pixel with a little endian uint16_t for red, green, blue, and alpha
|
||||
|
||||
kLastEnum_SkColorType = kRGBA_16161616_SkColorType, //!< last valid value
|
||||
kLastEnum_SkColorType = kR16G16B16A16_unorm_SkColorType, //!< last valid value
|
||||
|
||||
#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
|
||||
kN32_SkColorType = kBGRA_8888_SkColorType,//!< native ARGB 32-bit encoding
|
||||
|
@ -247,12 +247,12 @@ public:
|
||||
* use maxSurfaceSampleCountForColorType().
|
||||
*/
|
||||
bool colorTypeSupportedAsSurface(SkColorType colorType) const {
|
||||
if (kRG_88_SkColorType == colorType ||
|
||||
kRG_1616_SkColorType == colorType ||
|
||||
kAlpha_16_SkColorType == colorType ||
|
||||
kAlpha_F16_SkColorType == colorType ||
|
||||
kRG_F16_SkColorType == colorType ||
|
||||
kRGBA_16161616_SkColorType == colorType ||
|
||||
if (kR8G8_unorm_SkColorType == colorType ||
|
||||
kR16G16_unorm_SkColorType == colorType ||
|
||||
kA16_unorm_SkColorType == colorType ||
|
||||
kA16_float_SkColorType == colorType ||
|
||||
kR16G16_float_SkColorType == colorType ||
|
||||
kR16G16B16A16_unorm_SkColorType == colorType ||
|
||||
kGray_8_SkColorType == colorType) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1068,46 +1068,46 @@ static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct) {
|
||||
// Once we add kRGBA_8888_SRGB_SkColorType we should return that here.
|
||||
case GrColorType::kRGBA_8888_SRGB: return kRGBA_8888_SkColorType;
|
||||
case GrColorType::kRGB_888x: return kRGB_888x_SkColorType;
|
||||
case GrColorType::kRG_88: return kRG_88_SkColorType;
|
||||
case GrColorType::kRG_88: return kR8G8_unorm_SkColorType;
|
||||
case GrColorType::kBGRA_8888: return kBGRA_8888_SkColorType;
|
||||
case GrColorType::kRGBA_1010102: return kRGBA_1010102_SkColorType;
|
||||
case GrColorType::kGray_8: return kGray_8_SkColorType;
|
||||
case GrColorType::kAlpha_F16: return kAlpha_F16_SkColorType;
|
||||
case GrColorType::kAlpha_F16: return kA16_float_SkColorType;
|
||||
case GrColorType::kRGBA_F16: return kRGBA_F16_SkColorType;
|
||||
case GrColorType::kRGBA_F16_Clamped: return kRGBA_F16Norm_SkColorType;
|
||||
case GrColorType::kRGBA_F32: return kRGBA_F32_SkColorType;
|
||||
case GrColorType::kAlpha_8xxx: return kUnknown_SkColorType;
|
||||
case GrColorType::kAlpha_F32xxx: return kUnknown_SkColorType;
|
||||
case GrColorType::kGray_8xxx: return kUnknown_SkColorType;
|
||||
case GrColorType::kAlpha_16: return kAlpha_16_SkColorType;
|
||||
case GrColorType::kRG_1616: return kRG_1616_SkColorType;
|
||||
case GrColorType::kRGBA_16161616: return kRGBA_16161616_SkColorType;
|
||||
case GrColorType::kRG_F16: return kRG_F16_SkColorType;
|
||||
case GrColorType::kAlpha_16: return kA16_unorm_SkColorType;
|
||||
case GrColorType::kRG_1616: return kR16G16_unorm_SkColorType;
|
||||
case GrColorType::kRGBA_16161616: return kR16G16B16A16_unorm_SkColorType;
|
||||
case GrColorType::kRG_F16: return kR16G16_float_SkColorType;
|
||||
}
|
||||
SkUNREACHABLE;
|
||||
}
|
||||
|
||||
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct) {
|
||||
switch (ct) {
|
||||
case kUnknown_SkColorType: return GrColorType::kUnknown;
|
||||
case kAlpha_8_SkColorType: return GrColorType::kAlpha_8;
|
||||
case kRGB_565_SkColorType: return GrColorType::kBGR_565;
|
||||
case kARGB_4444_SkColorType: return GrColorType::kABGR_4444;
|
||||
case kRGBA_8888_SkColorType: return GrColorType::kRGBA_8888;
|
||||
case kRGB_888x_SkColorType: return GrColorType::kRGB_888x;
|
||||
case kBGRA_8888_SkColorType: return GrColorType::kBGRA_8888;
|
||||
case kGray_8_SkColorType: return GrColorType::kGray_8;
|
||||
case kRGBA_F16Norm_SkColorType: return GrColorType::kRGBA_F16_Clamped;
|
||||
case kRGBA_F16_SkColorType: return GrColorType::kRGBA_F16;
|
||||
case kRGBA_1010102_SkColorType: return GrColorType::kRGBA_1010102;
|
||||
case kRGB_101010x_SkColorType: return GrColorType::kUnknown;
|
||||
case kRGBA_F32_SkColorType: return GrColorType::kRGBA_F32;
|
||||
case kRG_88_SkColorType: return GrColorType::kRG_88;
|
||||
case kAlpha_16_SkColorType: return GrColorType::kAlpha_16;
|
||||
case kRG_1616_SkColorType: return GrColorType::kRG_1616;
|
||||
case kAlpha_F16_SkColorType: return GrColorType::kAlpha_F16;
|
||||
case kRG_F16_SkColorType: return GrColorType::kRG_F16;
|
||||
case kRGBA_16161616_SkColorType: return GrColorType::kRGBA_16161616;
|
||||
case kUnknown_SkColorType: return GrColorType::kUnknown;
|
||||
case kAlpha_8_SkColorType: return GrColorType::kAlpha_8;
|
||||
case kRGB_565_SkColorType: return GrColorType::kBGR_565;
|
||||
case kARGB_4444_SkColorType: return GrColorType::kABGR_4444;
|
||||
case kRGBA_8888_SkColorType: return GrColorType::kRGBA_8888;
|
||||
case kRGB_888x_SkColorType: return GrColorType::kRGB_888x;
|
||||
case kBGRA_8888_SkColorType: return GrColorType::kBGRA_8888;
|
||||
case kGray_8_SkColorType: return GrColorType::kGray_8;
|
||||
case kRGBA_F16Norm_SkColorType: return GrColorType::kRGBA_F16_Clamped;
|
||||
case kRGBA_F16_SkColorType: return GrColorType::kRGBA_F16;
|
||||
case kRGBA_1010102_SkColorType: return GrColorType::kRGBA_1010102;
|
||||
case kRGB_101010x_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;
|
||||
case kR16G16_unorm_SkColorType: return GrColorType::kRG_1616;
|
||||
case kA16_float_SkColorType: return GrColorType::kAlpha_F16;
|
||||
case kR16G16_float_SkColorType: return GrColorType::kRG_F16;
|
||||
case kR16G16B16A16_unorm_SkColorType: return GrColorType::kRGBA_16161616;
|
||||
}
|
||||
SkUNREACHABLE;
|
||||
}
|
||||
|
@ -27,25 +27,25 @@ enum SkColorTypeComponentFlag {
|
||||
|
||||
static inline uint32_t SkColorTypeComponentFlags(SkColorType ct) {
|
||||
switch (ct) {
|
||||
case kUnknown_SkColorType: return 0;
|
||||
case kAlpha_8_SkColorType: return kAlpha_SkColorTypeComponentFlag;
|
||||
case kRGB_565_SkColorType: return kRGB_SkColorTypeComponentFlags;
|
||||
case kARGB_4444_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGBA_8888_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGB_888x_SkColorType: return kRGB_SkColorTypeComponentFlags;
|
||||
case kBGRA_8888_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGBA_1010102_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGB_101010x_SkColorType: return kRGB_SkColorTypeComponentFlags;
|
||||
case kGray_8_SkColorType: return kGray_SkColorTypeComponentFlag;
|
||||
case kRGBA_F16Norm_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGBA_F16_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGBA_F32_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRG_88_SkColorType: return kRG_SkColorTypeComponentFlags;
|
||||
case kAlpha_16_SkColorType: return kAlpha_SkColorTypeComponentFlag;
|
||||
case kRG_1616_SkColorType: return kRG_SkColorTypeComponentFlags;
|
||||
case kAlpha_F16_SkColorType: return kAlpha_SkColorTypeComponentFlag;
|
||||
case kRG_F16_SkColorType: return kRG_SkColorTypeComponentFlags;
|
||||
case kRGBA_16161616_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kUnknown_SkColorType: return 0;
|
||||
case kAlpha_8_SkColorType: return kAlpha_SkColorTypeComponentFlag;
|
||||
case kRGB_565_SkColorType: return kRGB_SkColorTypeComponentFlags;
|
||||
case kARGB_4444_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGBA_8888_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGB_888x_SkColorType: return kRGB_SkColorTypeComponentFlags;
|
||||
case kBGRA_8888_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGBA_1010102_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGB_101010x_SkColorType: return kRGB_SkColorTypeComponentFlags;
|
||||
case kGray_8_SkColorType: return kGray_SkColorTypeComponentFlag;
|
||||
case kRGBA_F16Norm_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGBA_F16_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kRGBA_F32_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
case kR8G8_unorm_SkColorType: return kRG_SkColorTypeComponentFlags;
|
||||
case kA16_unorm_SkColorType: return kAlpha_SkColorTypeComponentFlag;
|
||||
case kR16G16_unorm_SkColorType: return kRG_SkColorTypeComponentFlags;
|
||||
case kA16_float_SkColorType: return kAlpha_SkColorTypeComponentFlag;
|
||||
case kR16G16_float_SkColorType: return kRG_SkColorTypeComponentFlags;
|
||||
case kR16G16B16A16_unorm_SkColorType: return kRGBA_SkColorTypeComponentFlags;
|
||||
}
|
||||
SkUNREACHABLE;
|
||||
}
|
||||
@ -67,25 +67,25 @@ static inline bool SkColorTypeIsGray(SkColorType ct) {
|
||||
|
||||
static int SkColorTypeShiftPerPixel(SkColorType ct) {
|
||||
switch (ct) {
|
||||
case kUnknown_SkColorType: return 0;
|
||||
case kAlpha_8_SkColorType: return 0;
|
||||
case kRGB_565_SkColorType: return 1;
|
||||
case kARGB_4444_SkColorType: return 1;
|
||||
case kRGBA_8888_SkColorType: return 2;
|
||||
case kRGB_888x_SkColorType: return 2;
|
||||
case kBGRA_8888_SkColorType: return 2;
|
||||
case kRGBA_1010102_SkColorType: return 2;
|
||||
case kRGB_101010x_SkColorType: return 2;
|
||||
case kGray_8_SkColorType: return 0;
|
||||
case kRGBA_F16Norm_SkColorType: return 3;
|
||||
case kRGBA_F16_SkColorType: return 3;
|
||||
case kRGBA_F32_SkColorType: return 4;
|
||||
case kRG_88_SkColorType: return 1;
|
||||
case kAlpha_16_SkColorType: return 1;
|
||||
case kRG_1616_SkColorType: return 2;
|
||||
case kAlpha_F16_SkColorType: return 1;
|
||||
case kRG_F16_SkColorType: return 2;
|
||||
case kRGBA_16161616_SkColorType: return 3;
|
||||
case kUnknown_SkColorType: return 0;
|
||||
case kAlpha_8_SkColorType: return 0;
|
||||
case kRGB_565_SkColorType: return 1;
|
||||
case kARGB_4444_SkColorType: return 1;
|
||||
case kRGBA_8888_SkColorType: return 2;
|
||||
case kRGB_888x_SkColorType: return 2;
|
||||
case kBGRA_8888_SkColorType: return 2;
|
||||
case kRGBA_1010102_SkColorType: return 2;
|
||||
case kRGB_101010x_SkColorType: return 2;
|
||||
case kGray_8_SkColorType: return 0;
|
||||
case kRGBA_F16Norm_SkColorType: return 3;
|
||||
case kRGBA_F16_SkColorType: return 3;
|
||||
case kRGBA_F32_SkColorType: return 4;
|
||||
case kR8G8_unorm_SkColorType: return 1;
|
||||
case kA16_unorm_SkColorType: return 1;
|
||||
case kR16G16_unorm_SkColorType: return 2;
|
||||
case kA16_float_SkColorType: return 1;
|
||||
case kR16G16_float_SkColorType: return 2;
|
||||
case kR16G16B16A16_unorm_SkColorType: return 3;
|
||||
}
|
||||
SkUNREACHABLE;
|
||||
}
|
||||
|
@ -1273,12 +1273,12 @@ EMSCRIPTEN_BINDINGS(Skia) {
|
||||
.value("Gray_8", SkColorType::kGray_8_SkColorType)
|
||||
.value("RGBA_F16", SkColorType::kRGBA_F16_SkColorType)
|
||||
.value("RGBA_F32", SkColorType::kRGBA_F32_SkColorType)
|
||||
.value("RG_88", SkColorType::kRG_88_SkColorType)
|
||||
.value("Alpha_16", SkColorType::kAlpha_16_SkColorType)
|
||||
.value("RG_1616", SkColorType::kRG_1616_SkColorType)
|
||||
.value("Alpha_F16", SkColorType::kAlpha_F16_SkColorType)
|
||||
.value("RG_F16", SkColorType::kRG_F16_SkColorType)
|
||||
.value("RGBA_16161616", SkColorType::kRGBA_16161616_SkColorType);
|
||||
.value("R8G8_unorm", SkColorType::kR8G8_unorm_SkColorType)
|
||||
.value("A16_unorm", SkColorType::kA16_unorm_SkColorType)
|
||||
.value("R16G16_unorm", SkColorType::kR16G16_unorm_SkColorType)
|
||||
.value("A16_float", SkColorType::kA16_float_SkColorType)
|
||||
.value("R16G16_float", SkColorType::kR16G16_float_SkColorType)
|
||||
.value("R16G16B16A16_unorm", SkColorType::kR16G16B16A16_unorm_SkColorType);
|
||||
|
||||
enum_<SkPath::FillType>("FillType")
|
||||
.value("Winding", SkPath::FillType::kWinding_FillType)
|
||||
|
@ -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++) {
|
||||
|
@ -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:
|
||||
|
@ -464,7 +464,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) {
|
||||
proc_3_2 = downsample_3_2<ColorTypeFilter_RGBA_F16>;
|
||||
proc_3_3 = downsample_3_3<ColorTypeFilter_RGBA_F16>;
|
||||
break;
|
||||
case kRG_88_SkColorType:
|
||||
case kR8G8_unorm_SkColorType:
|
||||
proc_1_2 = downsample_1_2<ColorTypeFilter_88>;
|
||||
proc_1_3 = downsample_1_3<ColorTypeFilter_88>;
|
||||
proc_2_1 = downsample_2_1<ColorTypeFilter_88>;
|
||||
@ -474,7 +474,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) {
|
||||
proc_3_2 = downsample_3_2<ColorTypeFilter_88>;
|
||||
proc_3_3 = downsample_3_3<ColorTypeFilter_88>;
|
||||
break;
|
||||
case kRG_1616_SkColorType:
|
||||
case kR16G16_unorm_SkColorType:
|
||||
proc_1_2 = downsample_1_2<ColorTypeFilter_1616>;
|
||||
proc_1_3 = downsample_1_3<ColorTypeFilter_1616>;
|
||||
proc_2_1 = downsample_2_1<ColorTypeFilter_1616>;
|
||||
@ -484,7 +484,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) {
|
||||
proc_3_2 = downsample_3_2<ColorTypeFilter_1616>;
|
||||
proc_3_3 = downsample_3_3<ColorTypeFilter_1616>;
|
||||
break;
|
||||
case kAlpha_16_SkColorType:
|
||||
case kA16_unorm_SkColorType:
|
||||
proc_1_2 = downsample_1_2<ColorTypeFilter_16>;
|
||||
proc_1_3 = downsample_1_3<ColorTypeFilter_16>;
|
||||
proc_2_1 = downsample_2_1<ColorTypeFilter_16>;
|
||||
@ -504,7 +504,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) {
|
||||
proc_3_2 = downsample_3_2<ColorTypeFilter_1010102>;
|
||||
proc_3_3 = downsample_3_3<ColorTypeFilter_1010102>;
|
||||
break;
|
||||
case kAlpha_F16_SkColorType:
|
||||
case kA16_float_SkColorType:
|
||||
proc_1_2 = downsample_1_2<ColorTypeFilter_Alpha_F16>;
|
||||
proc_1_3 = downsample_1_3<ColorTypeFilter_Alpha_F16>;
|
||||
proc_2_1 = downsample_2_1<ColorTypeFilter_Alpha_F16>;
|
||||
@ -514,7 +514,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) {
|
||||
proc_3_2 = downsample_3_2<ColorTypeFilter_Alpha_F16>;
|
||||
proc_3_3 = downsample_3_3<ColorTypeFilter_Alpha_F16>;
|
||||
break;
|
||||
case kRG_F16_SkColorType:
|
||||
case kR16G16_float_SkColorType:
|
||||
proc_1_2 = downsample_1_2<ColorTypeFilter_F16F16>;
|
||||
proc_1_3 = downsample_1_3<ColorTypeFilter_F16F16>;
|
||||
proc_2_1 = downsample_2_1<ColorTypeFilter_F16F16>;
|
||||
@ -524,7 +524,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) {
|
||||
proc_3_2 = downsample_3_2<ColorTypeFilter_F16F16>;
|
||||
proc_3_3 = downsample_3_3<ColorTypeFilter_F16F16>;
|
||||
break;
|
||||
case kRGBA_16161616_SkColorType:
|
||||
case kR16G16B16A16_unorm_SkColorType:
|
||||
proc_1_2 = downsample_1_2<ColorTypeFilter_16161616>;
|
||||
proc_1_3 = downsample_1_3<ColorTypeFilter_16161616>;
|
||||
proc_2_1 = downsample_2_1<ColorTypeFilter_16161616>;
|
||||
|
@ -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<const uint8_t*>(srcPtr)[0] * (1.0f/255);
|
||||
break;
|
||||
case kAlpha_16_SkColorType:
|
||||
case kA16_unorm_SkColorType:
|
||||
value = static_cast<const uint16_t*>(srcPtr)[0] * (1.0f/65535);
|
||||
break;
|
||||
case kAlpha_F16_SkColorType: {
|
||||
case kA16_float_SkColorType: {
|
||||
SkHalf half = static_cast<const SkHalf*>(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<const uint64_t*>(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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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.");
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user