store SkAlphaType inside SkBitmap, on road to support unpremul
BUG=
R=bsalomon@google.com, scroggo@google.com
Review URL: https://codereview.chromium.org/25275004
git-svn-id: http://skia.googlecode.com/svn/trunk@11877 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 3c91101..1498fc4 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -137,14 +137,17 @@
}
}
+/*
+ * 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;
}