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 "Benchmark.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" |
11 | 11 |
12 class DeferredCanvasBench : public SkBenchmark { | 12 class DeferredCanvasBench : public Benchmark { |
13 public: | 13 public: |
14 DeferredCanvasBench(const char name[]) { | 14 DeferredCanvasBench(const char name[]) { |
15 fName.printf("deferred_canvas_%s", name); | 15 fName.printf("deferred_canvas_%s", name); |
16 } | 16 } |
17 | 17 |
18 enum { | 18 enum { |
19 CANVAS_WIDTH = 200, | 19 CANVAS_WIDTH = 200, |
20 CANVAS_HEIGHT = 200, | 20 CANVAS_HEIGHT = 200, |
21 }; | 21 }; |
22 protected: | 22 protected: |
(...skipping 16 matching lines...) Expand all Loading... |
39 #endif | 39 #endif |
40 } | 40 } |
41 | 41 |
42 virtual void initDeferredCanvas(SkDeferredCanvas* canvas) = 0; | 42 virtual void initDeferredCanvas(SkDeferredCanvas* canvas) = 0; |
43 virtual void drawInDeferredCanvas(const int loops, SkDeferredCanvas* canvas)
= 0; | 43 virtual void drawInDeferredCanvas(const int loops, SkDeferredCanvas* canvas)
= 0; |
44 virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) = 0; | 44 virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) = 0; |
45 | 45 |
46 SkString fName; | 46 SkString fName; |
47 | 47 |
48 private: | 48 private: |
49 typedef SkBenchmark INHERITED; | 49 typedef Benchmark INHERITED; |
50 }; | 50 }; |
51 | 51 |
52 class SimpleNotificationClient : public SkDeferredCanvas::NotificationClient { | 52 class SimpleNotificationClient : public SkDeferredCanvas::NotificationClient { |
53 public: | 53 public: |
54 SimpleNotificationClient() : fDummy(false) {} | 54 SimpleNotificationClient() : fDummy(false) {} |
55 | 55 |
56 //bogus virtual implementations that just do something small | 56 //bogus virtual implementations that just do something small |
57 virtual void prepareForDraw() SK_OVERRIDE {fDummy = true;} | 57 virtual void prepareForDraw() SK_OVERRIDE {fDummy = true;} |
58 virtual void storageAllocatedForRecordingChanged(size_t) SK_OVERRIDE {fDummy
= false;} | 58 virtual void storageAllocatedForRecordingChanged(size_t) SK_OVERRIDE {fDummy
= false;} |
59 virtual void flushedDrawCommands() SK_OVERRIDE {fDummy = !fDummy;} | 59 virtual void flushedDrawCommands() SK_OVERRIDE {fDummy = !fDummy;} |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 private: | 98 private: |
99 typedef DeferredCanvasBench INHERITED; | 99 typedef DeferredCanvasBench INHERITED; |
100 SimpleNotificationClient fNotificationClient; | 100 SimpleNotificationClient fNotificationClient; |
101 }; | 101 }; |
102 | 102 |
103 | 103 |
104 /////////////////////////////////////////////////////////////////////////////// | 104 /////////////////////////////////////////////////////////////////////////////// |
105 | 105 |
106 DEF_BENCH( return new DeferredRecordBench(); ) | 106 DEF_BENCH( return new DeferredRecordBench(); ) |
OLD | NEW |