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

Unified Diff: src/image/SkSurface_Raster.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, 3 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/image/SkSurface_Raster.cpp
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index ccfdd27b1cb82cab885098ca458c2f5ffd07cfa9..3835c3b36cace407f968fbb7ce1b95e4ad5df0f8 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -86,9 +86,9 @@ SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, void* pixels, size
bool isOpaque;
SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque);
- fBitmap.setConfig(config, info.fWidth, info.fHeight, rb);
+ fBitmap.setConfig(config, info.fWidth, info.fHeight, rb, isOpaque ?
+ kOpaque_SkAlphaType : kPremul_SkAlphaType);
fBitmap.setPixels(pixels);
- fBitmap.setIsOpaque(isOpaque);
fWeOwnThePixels = false; // We are "Direct"
}
@@ -97,9 +97,9 @@ SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, SkPixelRef* pr, si
bool isOpaque;
SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque);
- fBitmap.setConfig(config, info.fWidth, info.fHeight, rb);
+ fBitmap.setConfig(config, info.fWidth, info.fHeight, rb, isOpaque ?
+ kOpaque_SkAlphaType : kPremul_SkAlphaType);
fBitmap.setPixelRef(pr);
- fBitmap.setIsOpaque(isOpaque);
fWeOwnThePixels = true;
if (!isOpaque) {

Powered by Google App Engine
This is Rietveld 408576698