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

Unified Diff: src/core/SkSpriteBlitter_RGB16.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 | « src/core/SkBitmapProcState.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkSpriteBlitter_RGB16.cpp
diff --git a/src/core/SkSpriteBlitter_RGB16.cpp b/src/core/SkSpriteBlitter_RGB16.cpp
index 1ba3ee22fcbaae8a4271963f6c3844c7317e6721..3d1d28d0a570dff72b5f26998104f1b024d751c2 100644
--- a/src/core/SkSpriteBlitter_RGB16.cpp
+++ b/src/core/SkSpriteBlitter_RGB16.cpp
@@ -321,15 +321,23 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source, const SkPain
return NULL;
}
+ const SkAlphaType at = source.alphaType();
+
SkSpriteBlitter* blitter = NULL;
unsigned alpha = paint.getAlpha();
switch (source.colorType()) {
case kN32_SkColorType: {
+ if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
+ break;
+ }
blitter = allocator->createT<Sprite_D16_S32_BlitRowProc>(source);
break;
}
case kARGB_4444_SkColorType:
+ if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
+ break;
+ }
if (255 == alpha) {
blitter = allocator->createT<Sprite_D16_S4444_Opaque>(source);
} else {
@@ -344,6 +352,9 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source, const SkPain
}
break;
case kIndex_8_SkColorType:
+ if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
+ break;
+ }
if (paint.isDither()) {
// we don't support dither yet in these special cases
break;
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698