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

Side by Side Diff: bench/GeometryBench.cpp

Issue 1011493003: alt SkEvalQuadAt that returns its answer, using Sk2f (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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 } 123 }
124 } 124 }
125 }; 125 };
126 126
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
133 //////////////////////////////////////////////////////////////////////////////// ///////////////////
134
135 class EvalQuadAt0 : public GeometryBench {
136 SkPoint fPts[3];
137 public:
138 EvalQuadAt0() : GeometryBench("evalquadat0") {
139 SkRandom rand;
140 for (int i = 0; i < 3; ++i) {
141 fPts[i].set(rand.nextUScalar1(), rand.nextUScalar1());
142 }
143 }
144
145 protected:
146 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
147 SkPoint result;
148 for (int outer = 0; outer < loops; ++outer) {
149 for (int i = 0; i < 10000; ++i) {
mtklein 2015/03/19 17:06:25 Might want to drop these inner loops?
150 SkEvalQuadAt(fPts, 0.5f, &result);
151 }
152 }
153 }
154 };
155 DEF_BENCH( return new EvalQuadAt0; )
156
157 class EvalQuadAt1 : public GeometryBench {
158 SkPoint fPts[3];
159 public:
160 EvalQuadAt1() : GeometryBench("evalquadat1") {
161 SkRandom rand;
162 for (int i = 0; i < 3; ++i) {
163 fPts[i].set(rand.nextUScalar1(), rand.nextUScalar1());
164 }
165 }
166
167 protected:
168 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
169 for (int outer = 0; outer < loops; ++outer) {
170 for (int i = 0; i < 10000; ++i) {
171 SkEvalQuadAt(fPts, 0.5f);
172 }
173 }
174 }
175 };
176 DEF_BENCH( return new EvalQuadAt1; )
177
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