| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "Benchmark.h" | 7 #include "Benchmark.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 protected: | 30 protected: |
| 31 const char* onGetName() override { | 31 const char* onGetName() override { |
| 32 return fName.c_str(); | 32 return fName.c_str(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void onDelayedSetup() override { | 35 void onDelayedSetup() override { |
| 36 fBitmap.allocN32Pixels(200, 200); | 36 fBitmap.allocN32Pixels(200, 200); |
| 37 fBitmap.eraseARGB(255, 0, 255, 0); | 37 fBitmap.eraseARGB(255, 0, 255, 0); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void onDraw(const int loops, SkCanvas* canvas) override { | 40 void onDraw(int loops, SkCanvas* canvas) override { |
| 41 canvas->concat(fMatrix); | 41 canvas->concat(fMatrix); |
| 42 for (int i = 0; i < loops; i++) { | 42 for (int i = 0; i < loops; i++) { |
| 43 canvas->drawBitmap(fBitmap, 0, 0, &fPaint); | 43 canvas->drawBitmap(fBitmap, 0, 0, &fPaint); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 SkPaint fPaint; | 48 SkPaint fPaint; |
| 49 SkMatrix fMatrix; | 49 SkMatrix fMatrix; |
| 50 SkString fName; | 50 SkString fName; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::MakeScale(1.17f), "scale
"); ) | 71 DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::MakeScale(1.17f), "scale
"); ) |
| 72 | 72 |
| 73 DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::MakeTrans(17.5f, 17.5f),
"translate"); ) | 73 DEF_BENCH( return new DrawBitmapAABench(true, SkMatrix::MakeTrans(17.5f, 17.5f),
"translate"); ) |
| 74 | 74 |
| 75 DEF_BENCH( | 75 DEF_BENCH( |
| 76 SkMatrix m; | 76 SkMatrix m; |
| 77 m.reset(); | 77 m.reset(); |
| 78 m.preRotate(15); | 78 m.preRotate(15); |
| 79 return new DrawBitmapAABench(true, m, "rotate"); | 79 return new DrawBitmapAABench(true, m, "rotate"); |
| 80 ) | 80 ) |
| OLD | NEW |