diff options
author | 2014-12-05 13:06:35 -0800 | |
---|---|---|
committer | 2014-12-05 13:06:35 -0800 | |
commit | 28f9c606e4c8e61015e864219c4bc83a3fdb4a86 (patch) | |
tree | df7daea5295de1dcbeeb72d34bd58cbc0a4ca3a9 /include | |
parent | 915187b71d4068f21a15a1b8f4d919e1179d8b74 (diff) |
Add support for half float alpha textures.
This allows us to create distance field textures with better precision,
which may help text quality.
BUG=skia:3103
Review URL: https://codereview.chromium.org/762923003
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrColor.h | 2 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h index f862ecc1d0..98bdb22840 100644 --- a/include/gpu/GrColor.h +++ b/include/gpu/GrColor.h @@ -168,6 +168,7 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) { kA_GrColorComponentFlag, // kR11_EAC_GrPixelConfig kRGBA_GrColorComponentFlags, // kASTC_12x12_GrPixelConfig kRGBA_GrColorComponentFlags, // kRGBA_float_GrPixelConfig + kA_GrColorComponentFlag, // kAlpha_16_GrPixelConfig }; return kFlags[config]; @@ -183,6 +184,7 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) { GR_STATIC_ASSERT(9 == kR11_EAC_GrPixelConfig); GR_STATIC_ASSERT(10 == kASTC_12x12_GrPixelConfig); GR_STATIC_ASSERT(11 == kRGBA_float_GrPixelConfig); + GR_STATIC_ASSERT(12 == kAlpha_half_GrPixelConfig); GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); } diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index 0ef964dcc4..1ed7070d44 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -302,7 +302,13 @@ enum GrPixelConfig { * Byte order is r, g, b, a. This color format is 32 bits per channel */ kRGBA_float_GrPixelConfig, - kLast_GrPixelConfig = kRGBA_float_GrPixelConfig + + /** + * This color format is a single 16 bit float channel + */ + kAlpha_half_GrPixelConfig, + + kLast_GrPixelConfig = kAlpha_half_GrPixelConfig }; static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; @@ -364,6 +370,7 @@ static inline size_t GrBytesPerPixel(GrPixelConfig config) { return 1; case kRGB_565_GrPixelConfig: case kRGBA_4444_GrPixelConfig: + case kAlpha_half_GrPixelConfig: return 2; case kRGBA_8888_GrPixelConfig: case kBGRA_8888_GrPixelConfig: @@ -382,6 +389,7 @@ static inline size_t GrUnpackAlignment(GrPixelConfig config) { return 1; case kRGB_565_GrPixelConfig: case kRGBA_4444_GrPixelConfig: + case kAlpha_half_GrPixelConfig: return 2; case kRGBA_8888_GrPixelConfig: case kBGRA_8888_GrPixelConfig: @@ -408,6 +416,7 @@ static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) { case kLATC_GrPixelConfig: case kASTC_12x12_GrPixelConfig: case kAlpha_8_GrPixelConfig: + case kAlpha_half_GrPixelConfig: return true; default: return false; |