aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-01-09 15:32:57 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-10 16:20:03 +0000
commitf2956459f707de596dcb2c79a7ee1fa62d599c0d (patch)
tree4c558c871bd88d8d599162b63864ce7083f58f0e /include
parente98234f231d66848e149db683c11b6388e10b233 (diff)
Add Gray8 pixel config
This is still just linear (non-sRGB), but adding sRGB will be the next step. I've verified that this is really making R8 textures when uploading Gray8 bitmaps. Tests pass, and the all_bitmap_configs GM still renders correctly (unlike when we just mapped Gray8 to Alpha8). This adds another pixel config, which could grow our cache footprint, but the benefits of not using 4bpp for 1bpp data should outweigh that? BUG=skia:6110 Change-Id: I4fc4c2479fc25f1d278e174a9bb5b542a0cb184c Reviewed-on: https://skia-review.googlesource.com/6817 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrColor.h32
-rw-r--r--include/gpu/GrTypes.h3
-rw-r--r--include/private/GrSwizzle.h1
3 files changed, 21 insertions, 15 deletions
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h
index 7277f0b21c..2bd43487e6 100644
--- a/include/gpu/GrColor.h
+++ b/include/gpu/GrColor.h
@@ -288,6 +288,7 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
static const uint32_t kFlags[] = {
0, // kUnknown_GrPixelConfig
kA_GrColorComponentFlag, // kAlpha_8_GrPixelConfig
+ kRGB_GrColorComponentFlags, // kGray_8_GrPixelConfig
kRGBA_GrColorComponentFlags, // kIndex_8_GrPixelConfig
kRGB_GrColorComponentFlags, // kRGB_565_GrPixelConfig
kRGBA_GrColorComponentFlags, // kRGBA_4444_GrPixelConfig
@@ -308,21 +309,22 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig);
GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig);
- GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig);
- GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig);
- GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig);
- GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig);
- GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig);
- GR_STATIC_ASSERT(7 == kSRGBA_8888_GrPixelConfig);
- GR_STATIC_ASSERT(8 == kSBGRA_8888_GrPixelConfig);
- GR_STATIC_ASSERT(9 == kRGBA_8888_sint_GrPixelConfig);
- GR_STATIC_ASSERT(10 == kETC1_GrPixelConfig);
- GR_STATIC_ASSERT(11 == kLATC_GrPixelConfig);
- GR_STATIC_ASSERT(12 == kR11_EAC_GrPixelConfig);
- GR_STATIC_ASSERT(13 == kASTC_12x12_GrPixelConfig);
- GR_STATIC_ASSERT(14 == kRGBA_float_GrPixelConfig);
- GR_STATIC_ASSERT(15 == kAlpha_half_GrPixelConfig);
- GR_STATIC_ASSERT(16 == kRGBA_half_GrPixelConfig);
+ GR_STATIC_ASSERT(2 == kGray_8_GrPixelConfig);
+ GR_STATIC_ASSERT(3 == kIndex_8_GrPixelConfig);
+ GR_STATIC_ASSERT(4 == kRGB_565_GrPixelConfig);
+ GR_STATIC_ASSERT(5 == kRGBA_4444_GrPixelConfig);
+ GR_STATIC_ASSERT(6 == kRGBA_8888_GrPixelConfig);
+ GR_STATIC_ASSERT(7 == kBGRA_8888_GrPixelConfig);
+ GR_STATIC_ASSERT(8 == kSRGBA_8888_GrPixelConfig);
+ GR_STATIC_ASSERT(9 == kSBGRA_8888_GrPixelConfig);
+ GR_STATIC_ASSERT(10 == kRGBA_8888_sint_GrPixelConfig);
+ GR_STATIC_ASSERT(11 == kETC1_GrPixelConfig);
+ GR_STATIC_ASSERT(12 == kLATC_GrPixelConfig);
+ GR_STATIC_ASSERT(13 == kR11_EAC_GrPixelConfig);
+ GR_STATIC_ASSERT(14 == kASTC_12x12_GrPixelConfig);
+ GR_STATIC_ASSERT(15 == kRGBA_float_GrPixelConfig);
+ GR_STATIC_ASSERT(16 == kAlpha_half_GrPixelConfig);
+ GR_STATIC_ASSERT(17 == kRGBA_half_GrPixelConfig);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
}
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 86e83f93e8..d780c32600 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -219,6 +219,7 @@ static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) {
enum GrPixelConfig {
kUnknown_GrPixelConfig,
kAlpha_8_GrPixelConfig,
+ kGray_8_GrPixelConfig,
kIndex_8_GrPixelConfig,
kRGB_565_GrPixelConfig,
/**
@@ -379,6 +380,7 @@ static inline size_t GrBytesPerPixel(GrPixelConfig config) {
SkASSERT(!GrPixelConfigIsCompressed(config));
switch (config) {
case kAlpha_8_GrPixelConfig:
+ case kGray_8_GrPixelConfig:
return 1;
case kRGB_565_GrPixelConfig:
case kRGBA_4444_GrPixelConfig:
@@ -403,6 +405,7 @@ static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
switch (config) {
case kETC1_GrPixelConfig:
case kRGB_565_GrPixelConfig:
+ case kGray_8_GrPixelConfig:
return true;
default:
return false;
diff --git a/include/private/GrSwizzle.h b/include/private/GrSwizzle.h
index 5fa39dd987..4acf7e44c7 100644
--- a/include/private/GrSwizzle.h
+++ b/include/private/GrSwizzle.h
@@ -93,6 +93,7 @@ public:
static GrSwizzle RGBA() { return GrSwizzle("rgba"); }
static GrSwizzle AAAA() { return GrSwizzle("aaaa"); }
static GrSwizzle RRRR() { return GrSwizzle("rrrr"); }
+ static GrSwizzle RRRA() { return GrSwizzle("rrra"); }
static GrSwizzle BGRA() { return GrSwizzle("bgra"); }
static GrSwizzle CreateRandom(SkRandom* random) {