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

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, 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/image/SkSurface_Raster.cpp
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index ccfdd27b1cb82cab885098ca458c2f5ffd07cfa9..5beabf71ccb9b8c2f8e17e659ab03e525cdc1202 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -39,8 +39,7 @@ private:
bool SkSurface_Raster::Valid(const SkImage::Info& info, size_t rowBytes) {
static const size_t kMaxTotalSize = SK_MaxS32;
- bool isOpaque;
- SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque);
+ SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
int shift = 0;
switch (config) {
@@ -83,26 +82,20 @@ bool SkSurface_Raster::Valid(const SkImage::Info& info, size_t rowBytes) {
SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, void* pixels, size_t rb)
: INHERITED(info.fWidth, info.fHeight) {
- bool isOpaque;
- SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque);
-
- fBitmap.setConfig(config, info.fWidth, info.fHeight, rb);
+ SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
+ fBitmap.setConfig(config, info.fWidth, info.fHeight, rb, info.fAlphaType);
fBitmap.setPixels(pixels);
- fBitmap.setIsOpaque(isOpaque);
fWeOwnThePixels = false; // We are "Direct"
}
SkSurface_Raster::SkSurface_Raster(const SkImage::Info& info, SkPixelRef* pr, size_t rb)
: INHERITED(info.fWidth, info.fHeight) {
- bool isOpaque;
- SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque);
-
- fBitmap.setConfig(config, info.fWidth, info.fHeight, rb);
+ SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
+ fBitmap.setConfig(config, info.fWidth, info.fHeight, rb, info.fAlphaType);
fBitmap.setPixelRef(pr);
- fBitmap.setIsOpaque(isOpaque);
fWeOwnThePixels = true;
- if (!isOpaque) {
+ if (!SkAlphaTypeIsOpaque(info.fAlphaType)) {
fBitmap.eraseColor(SK_ColorTRANSPARENT);
}
}

Powered by Google App Engine
This is Rietveld 408576698