aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2014-11-26 12:07:33 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-26 12:07:33 -0800
commit5eefe42e727aad1884d048f07785576e7015db08 (patch)
tree684e2a7072e19196a5febe20f8bba2a8527c922a
parent8ee4e601f9aa4199e62b57260780207fd26e446a (diff)
Fix assert in GrMaskFormatBytesPerPixel.
-rw-r--r--include/gpu/GrTypes.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index ccc04bce8a..0ef964dcc4 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -228,7 +228,7 @@ static const int kPublicGrBlendCoeffCount = kLastPublicGrBlendCoeff + 1;
*/
enum GrMaskFormat {
kA8_GrMaskFormat, //!< 1-byte per pixel
- kA565_GrMaskFormat, //!< 2-bytes per pixel
+ kA565_GrMaskFormat, //!< 2-bytes per pixel, RGB represent 3-channel LCD coverage
kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format
kLast_GrMaskFormat = kARGB_GrMaskFormat
@@ -239,12 +239,15 @@ static const int kMaskFormatCount = kLast_GrMaskFormat + 1;
* Return the number of bytes-per-pixel for the specified mask format.
*/
static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) {
- SkASSERT((unsigned)format <= 3);
+ SkASSERT((unsigned)format < kMaskFormatCount);
// kA8 (0) -> 1
// kA565 (1) -> 2
- // kARGB (3) -> 4
+ // kARGB (2) -> 4
static const int sBytesPerPixel[] = { 1, 2, 4 };
SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, array_size_mismatch);
+ SK_COMPILE_ASSERT(kA8_GrMaskFormat == 0, enum_order_dependency);
+ SK_COMPILE_ASSERT(kA565_GrMaskFormat == 1, enum_order_dependency);
+ SK_COMPILE_ASSERT(kARGB_GrMaskFormat == 2, enum_order_dependency);
return sBytesPerPixel[(int) format];
}