OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 name->append("rect"); | 105 name->append("rect"); |
106 } | 106 } |
107 void makePath(SkPath* path) override { | 107 void makePath(SkPath* path) override { |
108 SkRect r = { 10, 10, 20, 20 }; | 108 SkRect r = { 10, 10, 20, 20 }; |
109 path->addRect(r); | 109 path->addRect(r); |
110 } | 110 } |
111 private: | 111 private: |
112 typedef PathBench INHERITED; | 112 typedef PathBench INHERITED; |
113 }; | 113 }; |
114 | 114 |
| 115 class RotatedRectBench : public PathBench { |
| 116 public: |
| 117 RotatedRectBench(Flags flags, bool aa, int degrees) : INHERITED(flags) { |
| 118 fAA = aa; |
| 119 fDegrees = degrees; |
| 120 } |
| 121 |
| 122 void appendName(SkString* name) override { |
| 123 SkString suffix; |
| 124 suffix.printf("rotated_rect_%s_%d", fAA ? "aa" : "noaa", fDegrees); |
| 125 name->append(suffix); |
| 126 } |
| 127 |
| 128 void makePath(SkPath* path) override { |
| 129 SkRect r = { 10, 10, 20, 20 }; |
| 130 path->addRect(r); |
| 131 SkMatrix rotateMatrix; |
| 132 rotateMatrix.setRotate((SkScalar)fDegrees); |
| 133 path->transform(rotateMatrix); |
| 134 } |
| 135 |
| 136 virtual void setupPaint(SkPaint* paint) override { |
| 137 PathBench::setupPaint(paint); |
| 138 paint->setAntiAlias(fAA); |
| 139 } |
| 140 private: |
| 141 typedef PathBench INHERITED; |
| 142 int fDegrees; |
| 143 bool fAA; |
| 144 }; |
| 145 |
115 class OvalPathBench : public PathBench { | 146 class OvalPathBench : public PathBench { |
116 public: | 147 public: |
117 OvalPathBench(Flags flags) : INHERITED(flags) {} | 148 OvalPathBench(Flags flags) : INHERITED(flags) {} |
118 | 149 |
119 void appendName(SkString* name) override { | 150 void appendName(SkString* name) override { |
120 name->append("oval"); | 151 name->append("oval"); |
121 } | 152 } |
122 void makePath(SkPath* path) override { | 153 void makePath(SkPath* path) override { |
123 SkRect r = { 10, 10, 23, 20 }; | 154 SkRect r = { 10, 10, 23, 20 }; |
124 path->addOval(r); | 155 path->addOval(r); |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 DEF_BENCH( return new TrianglePathBench(FLAGS00); ) | 1027 DEF_BENCH( return new TrianglePathBench(FLAGS00); ) |
997 DEF_BENCH( return new TrianglePathBench(FLAGS01); ) | 1028 DEF_BENCH( return new TrianglePathBench(FLAGS01); ) |
998 DEF_BENCH( return new TrianglePathBench(FLAGS10); ) | 1029 DEF_BENCH( return new TrianglePathBench(FLAGS10); ) |
999 DEF_BENCH( return new TrianglePathBench(FLAGS11); ) | 1030 DEF_BENCH( return new TrianglePathBench(FLAGS11); ) |
1000 | 1031 |
1001 DEF_BENCH( return new RectPathBench(FLAGS00); ) | 1032 DEF_BENCH( return new RectPathBench(FLAGS00); ) |
1002 DEF_BENCH( return new RectPathBench(FLAGS01); ) | 1033 DEF_BENCH( return new RectPathBench(FLAGS01); ) |
1003 DEF_BENCH( return new RectPathBench(FLAGS10); ) | 1034 DEF_BENCH( return new RectPathBench(FLAGS10); ) |
1004 DEF_BENCH( return new RectPathBench(FLAGS11); ) | 1035 DEF_BENCH( return new RectPathBench(FLAGS11); ) |
1005 | 1036 |
| 1037 DEF_BENCH( return new RotatedRectBench(FLAGS00, false, 45)); |
| 1038 DEF_BENCH( return new RotatedRectBench(FLAGS10, false, 45)); |
| 1039 DEF_BENCH( return new RotatedRectBench(FLAGS00, true, 45)); |
| 1040 DEF_BENCH( return new RotatedRectBench(FLAGS10, true, 45)); |
| 1041 |
1006 DEF_BENCH( return new OvalPathBench(FLAGS00); ) | 1042 DEF_BENCH( return new OvalPathBench(FLAGS00); ) |
1007 DEF_BENCH( return new OvalPathBench(FLAGS01); ) | 1043 DEF_BENCH( return new OvalPathBench(FLAGS01); ) |
1008 DEF_BENCH( return new OvalPathBench(FLAGS10); ) | 1044 DEF_BENCH( return new OvalPathBench(FLAGS10); ) |
1009 DEF_BENCH( return new OvalPathBench(FLAGS11); ) | 1045 DEF_BENCH( return new OvalPathBench(FLAGS11); ) |
1010 | 1046 |
1011 DEF_BENCH( return new CirclePathBench(FLAGS00); ) | 1047 DEF_BENCH( return new CirclePathBench(FLAGS00); ) |
1012 DEF_BENCH( return new CirclePathBench(FLAGS01); ) | 1048 DEF_BENCH( return new CirclePathBench(FLAGS01); ) |
1013 DEF_BENCH( return new CirclePathBench(FLAGS10); ) | 1049 DEF_BENCH( return new CirclePathBench(FLAGS10); ) |
1014 DEF_BENCH( return new CirclePathBench(FLAGS11); ) | 1050 DEF_BENCH( return new CirclePathBench(FLAGS11); ) |
1015 | 1051 |
(...skipping 26 matching lines...) Expand all Loading... |
1042 DEF_BENCH( return new ConservativelyContainsBench(ConservativelyContainsBench::k
Oval_Type); ) | 1078 DEF_BENCH( return new ConservativelyContainsBench(ConservativelyContainsBench::k
Oval_Type); ) |
1043 | 1079 |
1044 | 1080 |
1045 // These seem to be optimized away, which is troublesome for timing. | 1081 // These seem to be optimized away, which is troublesome for timing. |
1046 /* | 1082 /* |
1047 DEF_BENCH( return new ConicBench_Chop5() ) | 1083 DEF_BENCH( return new ConicBench_Chop5() ) |
1048 DEF_BENCH( return new ConicBench_ComputeError() ) | 1084 DEF_BENCH( return new ConicBench_ComputeError() ) |
1049 DEF_BENCH( return new ConicBench_asQuadTol() ) | 1085 DEF_BENCH( return new ConicBench_asQuadTol() ) |
1050 DEF_BENCH( return new ConicBench_quadPow2() ) | 1086 DEF_BENCH( return new ConicBench_quadPow2() ) |
1051 */ | 1087 */ |
OLD | NEW |