Index: include/gpu/GrTypes.h |
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h |
index 3def9aaa993df434948afe15cf8263d655f42776..9be500d3b2206e004a9fbed3bc176365bae51d0a 100644 |
--- a/include/gpu/GrTypes.h |
+++ b/include/gpu/GrTypes.h |
@@ -218,6 +218,10 @@ enum GrPixelConfig { |
*/ |
kSRGBA_8888_GrPixelConfig, |
/** |
+ * Premultiplied and sRGB. Byte order is b,g,r,a. |
+ */ |
+ kSBGRA_8888_GrPixelConfig, |
+ /** |
* ETC1 Compressed Data |
*/ |
kETC1_GrPixelConfig, |
@@ -268,8 +272,10 @@ static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1; |
#endif |
#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) |
static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig; |
+ static const GrPixelConfig kSkiaGamma8888_GrPixelConfig = kSBGRA_8888_GrPixelConfig; |
#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) |
static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfig; |
+ static const GrPixelConfig kSkiaGamma8888_GrPixelConfig = kSRGBA_8888_GrPixelConfig; |
#else |
#error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format." |
#endif |
@@ -311,6 +317,7 @@ static inline bool GrPixelConfigIs8888(GrPixelConfig config) { |
case kRGBA_8888_GrPixelConfig: |
case kBGRA_8888_GrPixelConfig: |
case kSRGBA_8888_GrPixelConfig: |
+ case kSBGRA_8888_GrPixelConfig: |
return true; |
default: |
return false; |
@@ -322,6 +329,7 @@ static inline bool GrPixelConfigIs8888(GrPixelConfig config) { |
static inline bool GrPixelConfigIsSRGB(GrPixelConfig config) { |
switch (config) { |
case kSRGBA_8888_GrPixelConfig: |
+ case kSBGRA_8888_GrPixelConfig: |
return true; |
default: |
return false; |
@@ -336,6 +344,10 @@ static inline GrPixelConfig GrPixelConfigSwapRAndB(GrPixelConfig config) { |
return kRGBA_8888_GrPixelConfig; |
case kRGBA_8888_GrPixelConfig: |
return kBGRA_8888_GrPixelConfig; |
+ case kSBGRA_8888_GrPixelConfig: |
+ return kSRGBA_8888_GrPixelConfig; |
+ case kSRGBA_8888_GrPixelConfig: |
+ return kSBGRA_8888_GrPixelConfig; |
default: |
return kUnknown_GrPixelConfig; |
} |
@@ -353,6 +365,7 @@ static inline size_t GrBytesPerPixel(GrPixelConfig config) { |
case kRGBA_8888_GrPixelConfig: |
case kBGRA_8888_GrPixelConfig: |
case kSRGBA_8888_GrPixelConfig: |
+ case kSBGRA_8888_GrPixelConfig: |
return 4; |
case kRGBA_half_GrPixelConfig: |
return 8; |
@@ -386,6 +399,16 @@ static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) { |
} |
} |
+static inline bool GrAllowSRGBForDestinationPixelConfig(GrPixelConfig config) { |
+ switch (config) { |
+ case kRGBA_8888_GrPixelConfig: |
+ case kBGRA_8888_GrPixelConfig: |
+ return false; |
+ default: |
+ return true; |
+ } |
+} |
+ |
/** |
* Optional bitfield flags that can be set on GrSurfaceDesc (below). |
*/ |