| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" |
| 8 #include "SkDeferredCanvas.h" | 8 #include "SkDeferredCanvas.h" |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 #include "SkString.h" | 10 #include "SkString.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 }; | 22 }; |
| 23 protected: | 23 protected: |
| 24 virtual const char* onGetName() { | 24 virtual const char* onGetName() { |
| 25 return fName.c_str(); | 25 return fName.c_str(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual void onDraw(SkCanvas* canvas) { | 28 virtual void onDraw(SkCanvas* canvas) { |
| 29 SkDevice *device = canvas->getDevice()->createCompatibleDevice( | 29 SkDevice *device = canvas->getDevice()->createCompatibleDevice( |
| 30 SkBitmap::kARGB_8888_Config, CANVAS_WIDTH, CANVAS_HEIGHT, false); | 30 SkBitmap::kARGB_8888_Config, CANVAS_WIDTH, CANVAS_HEIGHT, false); |
| 31 | 31 |
| 32 SkAutoTUnref<SkDeferredCanvas> deferredCanvas( | 32 SkAutoTUnref<SkDeferredCanvas> deferredCanvas(SkDeferredCanvas::Create(d
evice)); |
| 33 #if SK_DEFERRED_CANVAS_USES_FACTORIES | |
| 34 SkDeferredCanvas::Create(device)); | |
| 35 #else | |
| 36 SkNEW_ARGS(SkDeferredCanvas, (device))); | |
| 37 #endif | |
| 38 device->unref(); | 33 device->unref(); |
| 39 | 34 |
| 40 initDeferredCanvas(deferredCanvas); | 35 initDeferredCanvas(deferredCanvas); |
| 41 | 36 |
| 42 for (int i = 0; i < N; i++) { | 37 for (int i = 0; i < N; i++) { |
| 43 drawInDeferredCanvas(deferredCanvas); | 38 drawInDeferredCanvas(deferredCanvas); |
| 44 } | 39 } |
| 45 | 40 |
| 46 finalizeDeferredCanvas(deferredCanvas); | 41 finalizeDeferredCanvas(deferredCanvas); |
| 47 deferredCanvas->flush(); | 42 deferredCanvas->flush(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 typedef DeferredCanvasBench INHERITED; | 105 typedef DeferredCanvasBench INHERITED; |
| 111 SimpleNotificationClient fNotificationClient; | 106 SimpleNotificationClient fNotificationClient; |
| 112 }; | 107 }; |
| 113 | 108 |
| 114 | 109 |
| 115 /////////////////////////////////////////////////////////////////////////////// | 110 /////////////////////////////////////////////////////////////////////////////// |
| 116 | 111 |
| 117 static SkBenchmark* Fact0(void* p) { return new DeferredRecordBench(p); } | 112 static SkBenchmark* Fact0(void* p) { return new DeferredRecordBench(p); } |
| 118 | 113 |
| 119 static BenchRegistry gReg0(Fact0); | 114 static BenchRegistry gReg0(Fact0); |
| OLD | NEW |