| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 virtual void initDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE { | 77 virtual void initDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE { |
| 78 canvas->setNotificationClient(&fNotificationClient); | 78 canvas->setNotificationClient(&fNotificationClient); |
| 79 } | 79 } |
| 80 | 80 |
| 81 virtual void drawInDeferredCanvas(const int loops, SkDeferredCanvas* canvas)
SK_OVERRIDE { | 81 virtual void drawInDeferredCanvas(const int loops, SkDeferredCanvas* canvas)
SK_OVERRIDE { |
| 82 SkRect rect; | 82 SkRect rect; |
| 83 rect.setXYWH(0, 0, 10, 10); | 83 rect.setXYWH(0, 0, 10, 10); |
| 84 SkPaint paint; | 84 SkPaint paint; |
| 85 for (int i = 0; i < loops; i++) { | 85 for (int i = 0; i < loops; i++) { |
| 86 canvas->save(SkCanvas::kMatrixClip_SaveFlag); | 86 canvas->save(); |
| 87 canvas->translate(SkIntToScalar(i * 27 % CANVAS_WIDTH), SkIntToScala
r(i * 13 % CANVAS_HEIGHT)); | 87 canvas->translate(SkIntToScalar(i * 27 % CANVAS_WIDTH), SkIntToScala
r(i * 13 % CANVAS_HEIGHT)); |
| 88 canvas->drawRect(rect, paint); | 88 canvas->drawRect(rect, paint); |
| 89 canvas->restore(); | 89 canvas->restore(); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE { | 93 virtual void finalizeDeferredCanvas(SkDeferredCanvas* canvas) SK_OVERRIDE { |
| 94 canvas->clear(0x0); | 94 canvas->clear(0x0); |
| 95 canvas->setNotificationClient(NULL); | 95 canvas->setNotificationClient(NULL); |
| 96 } | 96 } |
| 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 |