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

Unified Diff: bench/DeferredCanvasBench.cpp

Issue 16040002: Changing SkDeferredCanvas to use factories for creation (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | bench/DeferredSurfaceCopyBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/DeferredCanvasBench.cpp
===================================================================
--- bench/DeferredCanvasBench.cpp (revision 9282)
+++ bench/DeferredCanvasBench.cpp (working copy)
@@ -29,8 +29,12 @@
SkDevice *device = canvas->getDevice()->createCompatibleDevice(
SkBitmap::kARGB_8888_Config, CANVAS_WIDTH, CANVAS_HEIGHT, false);
- SkDeferredCanvas deferredCanvas(device);
-
+ SkAutoTUnref<SkDeferredCanvas> deferredCanvas(
+#if SK_DEFERRED_CANVAS_USES_FACTORIES
+ SkDeferredCanvas::Create(device));
+#else
+ SkNEW_ARGS(SkDeferredCanvas, (device)));
+#endif
device->unref();
initDeferredCanvas(deferredCanvas);
@@ -40,12 +44,12 @@
}
finalizeDeferredCanvas(deferredCanvas);
- deferredCanvas.flush();
+ deferredCanvas->flush();
}
- virtual void initDeferredCanvas(SkDeferredCanvas& canvas) = 0;
- virtual void drawInDeferredCanvas(SkDeferredCanvas& canvas) = 0;
- virtual void finalizeDeferredCanvas(SkDeferredCanvas& canvas) = 0;
+ virtual void initDeferredCanvas(SkDeferredCanvas* canvas) = 0;
+ virtual void drawInDeferredCanvas(SkDeferredCanvas* canvas) = 0;
+ virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) = 0;
SkString fName;
@@ -81,25 +85,25 @@
};
protected:
- virtual void initDeferredCanvas(SkDeferredCanvas& canvas) SK_OVERRIDE {
- canvas.setNotificationClient(&fNotificationClient);
+ virtual void initDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE {
+ canvas->setNotificationClient(&fNotificationClient);
}
- virtual void drawInDeferredCanvas(SkDeferredCanvas& canvas) SK_OVERRIDE {
+ virtual void drawInDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE {
SkRect rect;
rect.setXYWH(0, 0, 10, 10);
SkPaint paint;
for (int i = 0; i < M; i++) {
- canvas.save(SkCanvas::kMatrixClip_SaveFlag);
- canvas.translate(SkIntToScalar(i * 27 % CANVAS_WIDTH), SkIntToScalar(i * 13 % CANVAS_HEIGHT));
- canvas.drawRect(rect, paint);
- canvas.restore();
+ canvas->save(SkCanvas::kMatrixClip_SaveFlag);
+ canvas->translate(SkIntToScalar(i * 27 % CANVAS_WIDTH), SkIntToScalar(i * 13 % CANVAS_HEIGHT));
+ canvas->drawRect(rect, paint);
+ canvas->restore();
}
}
- virtual void finalizeDeferredCanvas(SkDeferredCanvas& canvas) SK_OVERRIDE {
- canvas.clear(0x0);
- canvas.setNotificationClient(NULL);
+ virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE {
+ canvas->clear(0x0);
+ canvas->setNotificationClient(NULL);
}
private:
« no previous file with comments | « no previous file | bench/DeferredSurfaceCopyBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698