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

Unified Diff: src/image/SkImage_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/SkImage_Raster.cpp
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index cd9b70f018bc6637192dbcca4a581af1b47ffc93..b3ff7a6f616a665e9f01993ce80d7037372929a1 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -88,9 +88,9 @@ SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes)
bool isOpaque;
SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque);
- fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes);
+ fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes, isOpaque ?
+ kOpaque_SkAlphaType : kPremul_SkAlphaType);
fBitmap.setPixelRef(SkNEW_ARGS(SkDataPixelRef, (data)))->unref();
- fBitmap.setIsOpaque(isOpaque);
fBitmap.setImmutable();
}
@@ -99,9 +99,9 @@ SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes
bool isOpaque;
SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque);
- fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes);
+ fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes, isOpaque ?
+ kOpaque_SkAlphaType : kPremul_SkAlphaType);
fBitmap.setPixelRef(pr);
- fBitmap.setIsOpaque(isOpaque);
}
SkImage_Raster::~SkImage_Raster() {}

Powered by Google App Engine
This is Rietveld 408576698