diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-03 19:45:22 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-03 19:45:22 +0000 |
commit | f8cb184095946ebf8f183d253e27bd544a19f23c (patch) | |
tree | c43a3f22ca2e2f79840116d66ede7079b5cc047b /include | |
parent | cb08f986938eeeeb57f950c94fee120aca965787 (diff) |
Add GPU support for color bitmap fonts
BUG=skia:1869
R=bungeman@google.com, robertphillips@google.com, bsalomon@google.com
Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/99993002
git-svn-id: http://skia.googlecode.com/svn/trunk@12471 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrTypes.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index ff8f442f7d..67dcf518e7 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -238,8 +238,9 @@ enum GrMaskFormat { kA8_GrMaskFormat, //!< 1-byte per pixel kA565_GrMaskFormat, //!< 2-bytes per pixel kA888_GrMaskFormat, //!< 4-bytes per pixel + kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format - kLast_GrMaskFormat = kA888_GrMaskFormat + kLast_GrMaskFormat = kARGB_GrMaskFormat }; static const int kMaskFormatCount = kLast_GrMaskFormat + 1; @@ -247,11 +248,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 <= 2); + SkASSERT((unsigned)format <= 3); // kA8 (0) -> 1 // kA565 (1) -> 2 // kA888 (2) -> 4 - return 1 << (int)format; + // kARGB (3) -> 4 + static const int sBytesPerPixel[] = { 1, 2, 4, 4 }; + SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, array_size_mismatch); + + return sBytesPerPixel[(int) format]; } /** |