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

Unified Diff: src/gpu/SkGpuDevice.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/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 3c91101b346376b50e190079e5a19c1ac1057f51..1498fc4c4299c1667a5d876add14152239cb9a0c 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -137,14 +137,17 @@ static SkBitmap::Config grConfig2skConfig(GrPixelConfig config, bool* isOpaque)
}
}
+/*
+ * GrRenderTarget does not know its opaqueness, only its config, so we have
+ * to make conservative guesses when we return an "equivalent" bitmap.
+ */
static SkBitmap make_bitmap(GrContext* context, GrRenderTarget* renderTarget) {
- GrPixelConfig config = renderTarget->config();
-
bool isOpaque;
+ SkBitmap::Config config = grConfig2skConfig(renderTarget->config(), &isOpaque);
+
SkBitmap bitmap;
- bitmap.setConfig(grConfig2skConfig(config, &isOpaque),
- renderTarget->width(), renderTarget->height());
- bitmap.setIsOpaque(isOpaque);
+ bitmap.setConfig(config, renderTarget->width(), renderTarget->height(), 0,
+ isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
return bitmap;
}

Powered by Google App Engine
This is Rietveld 408576698