make SkDevice constructors explicit between offscreen and on/direct
http://codereview.appspot.com/4632044/
git-svn-id: http://skia.googlecode.com/svn/trunk@1620 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index f015c00..a90e0a8 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -216,15 +216,16 @@
if (NULL == context) {
return false;
}
- SkGpuCanvas gc(context,
- SkGpuDevice::Current3DApiRenderTarget());
- gc.setDevice(gc.createDevice(bitmap.config(),
- bitmap.width(),
- bitmap.height(),
- bitmap.isOpaque(),
- false))->unref();
+
+ // not a real object, so don't unref it
+ GrRenderTarget* rt = SkGpuDevice::Current3DApiRenderTarget();
+ SkGpuCanvas gc(context, rt);
+ gc.setDevice(new SkGpuDevice(context, rt))->unref();
+
gm->draw(&gc);
- gc.readPixels(&bitmap); // overwrite our previous allocation
+ // the device is as large as the current rendertarget, so we explicitly
+ // only readback the amount we expect (in size)
+ gc.readPixels(SkIRect::MakeSize(size), &bitmap); // overwrite our previous allocation
}
return true;
}