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 14 matching lines...) Expand all Loading... |
25 // Most clients use filtering, so let's focus on this for now. | 25 // Most clients use filtering, so let's focus on this for now. |
26 fPaint.setFilterQuality(kLow_SkFilterQuality); | 26 fPaint.setFilterQuality(kLow_SkFilterQuality); |
27 fName.appendf("%s_%s", doAA ? "aa" : "noaa", name); | 27 fName.appendf("%s_%s", doAA ? "aa" : "noaa", name); |
28 } | 28 } |
29 | 29 |
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 onPreDraw() 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(const 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 } |
(...skipping 25 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 |