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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 109013002: gpudevice should never allocate pixels for its backend (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 07a946ef94ab1820ad71a2d48e69d97a98b23a4d..9580d22b06f50bba8db4a25d0ed569d417079f34 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -155,6 +155,20 @@ static SkBitmap make_bitmap(GrContext* context, GrRenderTarget* renderTarget) {
return bitmap;
}
+/*
+ * Calling SkBitmapDevice with individual params asks it to allocate pixel memory.
+ * We never want that, so we always need to call it with a bitmap argument
+ * (which says take my allocate (or lack thereof)).
+ *
+ * This is a REALLY good reason to finish the clean-up of SkBaseDevice, and have
+ * SkGpuDevice inherit from that instead of SkBitmapDevice.
+ */
+static SkBitmap make_bitmap(SkBitmap::Config config, int width, int height, bool isOpaque) {
+ SkBitmap bm;
+ bm.setConfig(config, width, height, isOpaque);
+ return bm;
+}
+
SkGpuDevice* SkGpuDevice::Create(GrSurface* surface) {
SkASSERT(NULL != surface);
if (NULL == surface->asRenderTarget() || NULL == surface->getContext()) {
@@ -210,7 +224,7 @@ SkGpuDevice::SkGpuDevice(GrContext* context,
int width,
int height,
int sampleCount)
- : SkBitmapDevice(config, width, height, false /*isOpaque*/) {
+ : SkBitmapDevice(make_bitmap(config, width, height, false /*isOpaque*/)) {
fDrawProcs = NULL;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698