OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 | 7 |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkAutoPixmapStorage.h" | 9 #include "SkAutoPixmapStorage.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 fPath.quadTo(500, 0, 500, 500); | 33 fPath.quadTo(500, 0, 500, 500); |
34 fPath.quadTo(250, 0, 0, 500); | 34 fPath.quadTo(250, 0, 0, 500); |
35 | 35 |
36 fPixmap.alloc(SkImageInfo::MakeA8(500, 500)); | 36 fPixmap.alloc(SkImageInfo::MakeA8(500, 500)); |
37 | 37 |
38 fIdentity.setIdentity(); | 38 fIdentity.setIdentity(); |
39 fRC.setRect(fPath.getBounds().round()); | 39 fRC.setRect(fPath.getBounds().round()); |
40 | 40 |
41 fDraw.fDst = fPixmap; | 41 fDraw.fDst = fPixmap; |
42 fDraw.fMatrix = &fIdentity; | 42 fDraw.fMatrix = &fIdentity; |
43 fDraw.fClip = &fRC.bwRgn(); | |
44 fDraw.fRC = &fRC; | 43 fDraw.fRC = &fRC; |
45 } | 44 } |
46 | 45 |
47 protected: | 46 protected: |
48 const char* onGetName() override { | 47 const char* onGetName() override { |
49 return fName.c_str(); | 48 return fName.c_str(); |
50 } | 49 } |
51 | 50 |
52 void onDraw(int loops, SkCanvas* canvas) override { | 51 void onDraw(int loops, SkCanvas* canvas) override { |
53 if (fDrawCoverage) { | 52 if (fDrawCoverage) { |
54 for (int i = 0; i < loops; ++i) { | 53 for (int i = 0; i < loops; ++i) { |
55 fDraw.drawPathCoverage(fPath, fPaint); | 54 fDraw.drawPathCoverage(fPath, fPaint); |
56 } | 55 } |
57 } else { | 56 } else { |
58 for (int i = 0; i < loops; ++i) { | 57 for (int i = 0; i < loops; ++i) { |
59 fDraw.drawPath(fPath, fPaint); | 58 fDraw.drawPath(fPath, fPaint); |
60 } | 59 } |
61 } | 60 } |
62 } | 61 } |
63 | 62 |
64 private: | 63 private: |
65 typedef Benchmark INHERITED; | 64 typedef Benchmark INHERITED; |
66 }; | 65 }; |
67 | 66 |
68 /////////////////////////////////////////////////////////////////////////////// | 67 /////////////////////////////////////////////////////////////////////////////// |
69 | 68 |
70 DEF_BENCH( return new DrawPathBench(false) ) | 69 DEF_BENCH( return new DrawPathBench(false) ) |
71 DEF_BENCH( return new DrawPathBench(true) ) | 70 DEF_BENCH( return new DrawPathBench(true) ) |
OLD | NEW |