Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: bench/GeometryBench.cpp

Issue 1036753002: SkChopCubicAt2 using Sk2s-- 2x faster (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkGeometry.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "SkGeometry.h" 9 #include "SkGeometry.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 DEF_BENCH( return new GeoRectBench_intersect; ) 127 DEF_BENCH( return new GeoRectBench_intersect; )
128 DEF_BENCH( return new GeoRectBench_intersect_rect; ) 128 DEF_BENCH( return new GeoRectBench_intersect_rect; )
129 DEF_BENCH( return new GeoRectBench_Intersects; ) 129 DEF_BENCH( return new GeoRectBench_Intersects; )
130 130
131 DEF_BENCH( return new GeoRectBench_sort; ) 131 DEF_BENCH( return new GeoRectBench_sort; )
132 132
133 //////////////////////////////////////////////////////////////////////////////// /////////////////// 133 //////////////////////////////////////////////////////////////////////////////// ///////////////////
134 134
135 class QuadBenchBase : public GeometryBench { 135 class QuadBenchBase : public GeometryBench {
136 protected: 136 protected:
137 SkPoint fPts[3]; 137 SkPoint fPts[4];
138 public: 138 public:
139 QuadBenchBase(const char name[]) : GeometryBench(name) { 139 QuadBenchBase(const char name[]) : GeometryBench(name) {
140 SkRandom rand; 140 SkRandom rand;
141 for (int i = 0; i < 3; ++i) { 141 for (int i = 0; i < 4; ++i) {
142 fPts[i].set(rand.nextUScalar1(), rand.nextUScalar1()); 142 fPts[i].set(rand.nextUScalar1(), rand.nextUScalar1());
143 } 143 }
144 } 144 }
145 }; 145 };
146 146
147 class EvalQuadAt0 : public QuadBenchBase { 147 class EvalQuadAt0 : public QuadBenchBase {
148 public: 148 public:
149 EvalQuadAt0() : QuadBenchBase("evalquadat0") {} 149 EvalQuadAt0() : QuadBenchBase("evalquadat0") {}
150 protected: 150 protected:
151 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 151 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 for (int outer = 0; outer < loops; ++outer) { 237 for (int outer = 0; outer < loops; ++outer) {
238 SkChopQuadAt2(fPts, dst, 0.5f); 238 SkChopQuadAt2(fPts, dst, 0.5f);
239 SkChopQuadAt2(fPts, dst, 0.5f); 239 SkChopQuadAt2(fPts, dst, 0.5f);
240 SkChopQuadAt2(fPts, dst, 0.5f); 240 SkChopQuadAt2(fPts, dst, 0.5f);
241 SkChopQuadAt2(fPts, dst, 0.5f); 241 SkChopQuadAt2(fPts, dst, 0.5f);
242 } 242 }
243 } 243 }
244 }; 244 };
245 DEF_BENCH( return new ChopQuadAt1; ) 245 DEF_BENCH( return new ChopQuadAt1; )
246 246
247 class ChopCubicAt0 : public QuadBenchBase {
248 public:
249 ChopCubicAt0() : QuadBenchBase("chopcubicat0") {}
250 protected:
251 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
252 SkPoint dst[7];
253 for (int outer = 0; outer < loops; ++outer) {
254 SkChopCubicAt(fPts, dst, 0.5f);
255 SkChopCubicAt(fPts, dst, 0.5f);
256 SkChopCubicAt(fPts, dst, 0.5f);
257 SkChopCubicAt(fPts, dst, 0.5f);
258 }
259 }
260 };
261 DEF_BENCH( return new ChopCubicAt0; )
262
263 class ChopCubicAt1 : public QuadBenchBase {
264 public:
265 ChopCubicAt1() : QuadBenchBase("chopcubicat1") {}
266 protected:
267 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
268 SkPoint dst[7];
269 for (int outer = 0; outer < loops; ++outer) {
270 SkChopCubicAt2(fPts, dst, 0.5f);
271 SkChopCubicAt2(fPts, dst, 0.5f);
272 SkChopCubicAt2(fPts, dst, 0.5f);
273 SkChopCubicAt2(fPts, dst, 0.5f);
274 }
275 }
276 };
277 DEF_BENCH( return new ChopCubicAt1; )
278
OLDNEW
« no previous file with comments | « no previous file | src/core/SkGeometry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698