diff options
author | 2014-07-12 21:10:52 -0700 | |
---|---|---|
committer | 2014-07-12 21:10:52 -0700 | |
commit | 00adc751e7dd5a37af454b7424889a95699b920d (patch) | |
tree | b3c5f031a5f3952d85dff360f287d335e9f5d0b4 /src/core/SkBitmapProcState.cpp | |
parent | 651eaeadeb0b1407f5fe192aeda90db1680fa2b8 (diff) |
don't draw unpremul alpha (yet)
without these early exits, we can treat unpremul colors as premul, generating asserts and wacky colors.
TBR=
Author: reed@chromium.org
Review URL: https://codereview.chromium.org/386203002
Diffstat (limited to 'src/core/SkBitmapProcState.cpp')
-rw-r--r-- | src/core/SkBitmapProcState.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index 48962cffa4..f8ab8ab351 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -481,6 +481,8 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { /////////////////////////////////////////////////////////////////////// + const SkAlphaType at = fBitmap->alphaType(); + // No need to do this if we're doing HQ sampling; if filter quality is // still set to HQ by the time we get here, then we must have installed // the shader procs above and can skip all this. @@ -500,15 +502,24 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { // bits 3,4,5 encoding the source bitmap format switch (fBitmap->colorType()) { case kN32_SkColorType: + if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) { + return false; + } index |= 0; break; case kRGB_565_SkColorType: index |= 8; break; case kIndex_8_SkColorType: + if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) { + return false; + } index |= 16; break; case kARGB_4444_SkColorType: + if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) { + return false; + } index |= 24; break; case kAlpha_8_SkColorType: |