| 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 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual void onDraw(SkCanvas* canvas) { | 27 virtual void onDraw(SkCanvas* canvas) { |
| 28 SkBaseDevice *device = canvas->getDevice()->createCompatibleDevice( | 28 SkBaseDevice *device = canvas->getDevice()->createCompatibleDevice( |
| 29 SkBitmap::kARGB_8888_Config, CANVAS_WIDTH, CANVAS_HEIGHT, false); | 29 SkBitmap::kARGB_8888_Config, CANVAS_WIDTH, CANVAS_HEIGHT, false); |
| 30 | 30 |
| 31 SkAutoTUnref<SkDeferredCanvas> deferredCanvas(SkDeferredCanvas::Create(d
evice)); | 31 SkAutoTUnref<SkDeferredCanvas> deferredCanvas(SkDeferredCanvas::Create(d
evice)); |
| 32 device->unref(); | 32 device->unref(); |
| 33 | 33 |
| 34 initDeferredCanvas(deferredCanvas); | 34 initDeferredCanvas(deferredCanvas); |
| 35 | 35 drawInDeferredCanvas(deferredCanvas); |
| 36 for (int i = 0; i < this->getLoops(); i++) { | |
| 37 drawInDeferredCanvas(deferredCanvas); | |
| 38 } | |
| 39 | |
| 40 finalizeDeferredCanvas(deferredCanvas); | 36 finalizeDeferredCanvas(deferredCanvas); |
| 41 deferredCanvas->flush(); | 37 deferredCanvas->flush(); |
| 42 } | 38 } |
| 43 | 39 |
| 44 virtual void initDeferredCanvas(SkDeferredCanvas* canvas) = 0; | 40 virtual void initDeferredCanvas(SkDeferredCanvas* canvas) = 0; |
| 45 virtual void drawInDeferredCanvas(SkDeferredCanvas* canvas) = 0; | 41 virtual void drawInDeferredCanvas(SkDeferredCanvas* canvas) = 0; |
| 46 virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) = 0; | 42 virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) = 0; |
| 47 | 43 |
| 48 SkString fName; | 44 SkString fName; |
| 49 | 45 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 typedef DeferredCanvasBench INHERITED; | 97 typedef DeferredCanvasBench INHERITED; |
| 102 SimpleNotificationClient fNotificationClient; | 98 SimpleNotificationClient fNotificationClient; |
| 103 }; | 99 }; |
| 104 | 100 |
| 105 | 101 |
| 106 /////////////////////////////////////////////////////////////////////////////// | 102 /////////////////////////////////////////////////////////////////////////////// |
| 107 | 103 |
| 108 static SkBenchmark* Fact0(void* p) { return new DeferredRecordBench(p); } | 104 static SkBenchmark* Fact0(void* p) { return new DeferredRecordBench(p); } |
| 109 | 105 |
| 110 static BenchRegistry gReg0(Fact0); | 106 static BenchRegistry gReg0(Fact0); |
| OLD | NEW |