Rename GrColorType::kRGB_565 to kBGR_565

All our other color types put the low bits as the first component in the
name. For 565 B is the low bits and R is the high bits so the name is being
updated to reflect that.

Bug: skia:9170
Change-Id: I67be32440d6c6fa8a345532fe144720d23cf340a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221337
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Greg Daniel 2019-06-18 17:06:43 -04:00 committed by Skia Commit-Bot
parent 514bae628e
commit 48fec763d4
6 changed files with 15 additions and 13 deletions

View File

@ -1180,12 +1180,14 @@ static inline GrSLPrecision GrSLSamplerPrecision(GrPixelConfig config) {
* their type, and width. This exists so that the GPU backend can have private types that have no
* analog in the public facing SkColorType enum and omit types not implemented in the GPU backend.
* It does not refer to a texture format and the mapping to texture formats may be many-to-many.
* It does not specify the sRGB encoding of the stored values.
* It does not specify the sRGB encoding of the stored values. The components are listed in order of
* where they appear in memory. In other words the first component listed is in the low bits and
* the last component in the high bits.
*/
enum class GrColorType {
kUnknown,
kAlpha_8,
kRGB_565,
kBGR_565,
kABGR_4444, // This name differs from SkColorType. kARGB_4444_SkColorType is misnamed.
kRGBA_8888,
kRGB_888x,
@ -1212,7 +1214,7 @@ static inline SkColorType GrColorTypeToSkColorType(GrColorType ct) {
switch (ct) {
case GrColorType::kUnknown: return kUnknown_SkColorType;
case GrColorType::kAlpha_8: return kAlpha_8_SkColorType;
case GrColorType::kRGB_565: return kRGB_565_SkColorType;
case GrColorType::kBGR_565: return kRGB_565_SkColorType;
case GrColorType::kABGR_4444: return kARGB_4444_SkColorType;
case GrColorType::kRGBA_8888: return kRGBA_8888_SkColorType;
case GrColorType::kRGB_888x: return kRGB_888x_SkColorType;
@ -1240,7 +1242,7 @@ static inline 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::kRGB_565;
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;
@ -1260,7 +1262,7 @@ static inline uint32_t GrColorTypeComponentFlags(GrColorType ct) {
switch (ct) {
case GrColorType::kUnknown: return 0;
case GrColorType::kAlpha_8: return kAlpha_SkColorTypeComponentFlag;
case GrColorType::kRGB_565: return kRGB_SkColorTypeComponentFlags;
case GrColorType::kBGR_565: return kRGB_SkColorTypeComponentFlags;
case GrColorType::kABGR_4444: return kRGBA_SkColorTypeComponentFlags;
case GrColorType::kRGBA_8888: return kRGBA_SkColorTypeComponentFlags;
case GrColorType::kRGB_888x: return kRGB_SkColorTypeComponentFlags;
@ -1301,7 +1303,7 @@ static inline int GrColorTypeBytesPerPixel(GrColorType ct) {
case GrColorType::kUnknown: return 0;
case GrColorType::kRGB_ETC1: return 0;
case GrColorType::kAlpha_8: return 1;
case GrColorType::kRGB_565: return 2;
case GrColorType::kBGR_565: return 2;
case GrColorType::kABGR_4444: return 2;
case GrColorType::kRGBA_8888: return 4;
case GrColorType::kRGB_888x: return 4;
@ -1338,7 +1340,7 @@ static inline GrColorType GrPixelConfigToColorTypeAndEncoding(GrPixelConfig conf
return GrColorType::kGray_8;
case kRGB_565_GrPixelConfig:
*srgbEncoded = GrSRGBEncoded::kNo;
return GrColorType::kRGB_565;
return GrColorType::kBGR_565;
case kRGBA_4444_GrPixelConfig:
*srgbEncoded = GrSRGBEncoded::kNo;
return GrColorType::kABGR_4444;
@ -1436,7 +1438,7 @@ static inline GrPixelConfig GrColorTypeToPixelConfig(GrColorType config,
return (GrSRGBEncoded::kYes == srgbEncoded) ? kUnknown_GrPixelConfig
: kGray_8_GrPixelConfig;
case GrColorType::kRGB_565:
case GrColorType::kBGR_565:
return (GrSRGBEncoded::kYes == srgbEncoded) ? kUnknown_GrPixelConfig
: kRGB_565_GrPixelConfig;

View File

@ -58,7 +58,7 @@ static bool valid_premul_color_type(GrColorType ct) {
switch (ct) {
case GrColorType::kUnknown: return false;
case GrColorType::kAlpha_8: return false;
case GrColorType::kRGB_565: return false;
case GrColorType::kBGR_565: return false;
case GrColorType::kABGR_4444: return true;
case GrColorType::kRGBA_8888: return true;
case GrColorType::kRGB_888x: return false;

View File

@ -3330,7 +3330,7 @@ static bool format_color_type_valid_pair(GrGLenum format, GrColorType colorType)
return false;
case GrColorType::kAlpha_8:
return GR_GL_ALPHA8 == format || GR_GL_R8 == format;
case GrColorType::kRGB_565:
case GrColorType::kBGR_565:
return GR_GL_RGB565 == format;
case GrColorType::kABGR_4444:
return GR_GL_RGBA4 == format;

View File

@ -622,7 +622,7 @@ static bool format_color_type_valid_pair(MTLPixelFormat format, GrColorType colo
return false;
case GrColorType::kAlpha_8:
return MTLPixelFormatA8Unorm == format || MTLPixelFormatR8Unorm == format;
case GrColorType::kRGB_565:
case GrColorType::kBGR_565:
#ifdef SK_BUILD_FOR_MAC
return false;
#else

View File

@ -26,7 +26,7 @@ static GrColorType mask_format_to_gr_color_type(GrMaskFormat format) {
case kA8_GrMaskFormat:
return GrColorType::kAlpha_8;
case kA565_GrMaskFormat:
return GrColorType::kRGB_565;
return GrColorType::kBGR_565;
case kARGB_GrMaskFormat:
return GrColorType::kRGBA_8888;
default:

View File

@ -1092,7 +1092,7 @@ static bool format_color_type_valid_pair(VkFormat vkFormat, GrColorType colorTyp
return false;
case GrColorType::kAlpha_8:
return VK_FORMAT_R8_UNORM == vkFormat;
case GrColorType::kRGB_565:
case GrColorType::kBGR_565:
return VK_FORMAT_R5G6B5_UNORM_PACK16 == vkFormat;
case GrColorType::kABGR_4444:
return VK_FORMAT_B4G4R4A4_UNORM_PACK16 == vkFormat ||