Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: src/core/SkBitmapProcState.cpp

Issue 386203002: don't draw unpremul alpha (yet) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcState.cpp
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 48962cffa46c173b98f3c48fe0ffbf26720c9aab..f8ab8ab3513e264554802fb33d7508eef92a35e0 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:
« no previous file with comments | « no previous file | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698