1. remove references to (deprecated) SkGpuCanvas
2. remove references to setDevice (soon to be deprecated)
Review URL: https://codereview.appspot.com/6597055
git-svn-id: http://skia.googlecode.com/svn/trunk@5751 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index c5a72dd..4f833fa 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -306,15 +306,15 @@
SkISize size (gm->getISize());
setup_bitmap(gRec, size, bitmap);
+ SkAutoTUnref<SkCanvas> canvas;
+
if (gRec.fBackend == kRaster_Backend) {
- SkCanvas* canvas;
+ SkAutoTUnref<SkDevice> device(new SkDevice(*bitmap));
if (deferred) {
- canvas = new SkDeferredCanvas;
- canvas->setDevice(new SkDevice(*bitmap))->unref();
+ canvas.reset(new SkDeferredCanvas(device));
} else {
- canvas = new SkCanvas(*bitmap);
+ canvas.reset(new SkCanvas(device));
}
- SkAutoUnref canvasUnref(canvas);
invokeGM(gm, canvas);
canvas->flush();
}
@@ -323,21 +323,19 @@
if (NULL == context) {
return ERROR_NO_GPU_CONTEXT;
}
- SkCanvas* gc;
+ SkAutoTUnref<SkDevice> device(new SkGpuDevice(context, rt));
if (deferred) {
- gc = new SkDeferredCanvas;
+ canvas.reset(new SkDeferredCanvas(device));
} else {
- gc = new SkGpuCanvas(context, rt);
+ canvas.reset(new SkCanvas(device));
}
- SkAutoUnref gcUnref(gc);
- gc->setDevice(new SkGpuDevice(context, rt))->unref();
- invokeGM(gm, gc);
+ invokeGM(gm, canvas);
// the device is as large as the current rendertarget, so we explicitly
// only readback the amount we expect (in size)
// overwrite our previous allocation
bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.fWidth,
size.fHeight);
- gc->readPixels(bitmap, 0, 0);
+ canvas->readPixels(bitmap, 0, 0);
}
#endif
return ERROR_NONE;