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

Unified Diff: src/ports/SkImageDecoder_CG.cpp

Issue 25275004: store SkAlphaType inside SkBitmap, on road to support unpremul (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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
Index: src/ports/SkImageDecoder_CG.cpp
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index 8956acaebc8bd0fe3dd5300d77af02b662ec90e6..3f850b544dabf288ff64eddcb9951bb5d416aa48 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -104,11 +104,13 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
case kCGImageAlphaNoneSkipLast:
case kCGImageAlphaNoneSkipFirst:
SkASSERT(SkBitmap::ComputeIsOpaque(*bm));
- bm->setIsOpaque(true);
+ bm->setAlphaType(kOpaque_SkAlphaType);
break;
default:
// we don't know if we're opaque or not, so compute it.
- bm->computeAndSetOpaquePredicate();
+ if (SkBitmap::ComputeIsOpaque(*bm)) {
+ bm->setAlphaType(kOpaque_SkAlphaType);
+ }
}
if (!bm->isOpaque() && this->getRequireUnpremultipliedColors()) {
// CGBitmapContext does not support unpremultiplied, so the image has been premultiplied.
@@ -119,6 +121,7 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
*addr = unpremultiply_pmcolor(*addr);
}
}
+ bm->setAlphaType(kUnpremul_SkAlphaType);
}
bm->unlockPixels();
return true;

Powered by Google App Engine
This is Rietveld 408576698