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

Side by Side Diff: bench/RectBench.cpp

Issue 469373003: Remove aarects benchmark. Redundant with rotated_rects* bench and *much* slower. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | no next file » | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 paint.setStrokeWidth(gSizes[i]); 163 paint.setStrokeWidth(gSizes[i]);
164 this->setupPaint(&paint); 164 this->setupPaint(&paint);
165 canvas->drawPoints(fMode, N * 2, SkTCast<SkPoint*>(fRects), pain t); 165 canvas->drawPoints(fMode, N * 2, SkTCast<SkPoint*>(fRects), pain t);
166 paint.setColor(fColors[i % N]); 166 paint.setColor(fColors[i % N]);
167 } 167 }
168 } 168 }
169 } 169 }
170 virtual const char* onGetName() { return fName; } 170 virtual const char* onGetName() { return fName; }
171 }; 171 };
172 172
173 class AARectBench : public Benchmark {
174 public:
175 enum {
176 W = 640,
177 H = 480,
178 };
179
180 AARectBench(bool rotate) : fRotate(rotate) {}
181
182 protected:
183
184 virtual const char* onGetName() {
185 if (fRotate) {
186 return "aarects_rotated";
187 }
188 return "aarects";
189 }
190
191 virtual void onDraw(const int loops, SkCanvas* canvas) {
192 static const SkScalar kHalfRectSize = 0.75f;
193
194 SkPaint paint;
195 this->setupPaint(&paint);
196 paint.setAntiAlias(true);
197 paint.setColor(SK_ColorBLACK);
198 SkRect r = { -kHalfRectSize, -kHalfRectSize, kHalfRectSize, kHalfRectSiz e };
199 int rot = 0;
200
201 for (int i = 0; i < loops; i++) {
202 // Draw small aa rects in a grid across the screen
203 for (SkScalar y = kHalfRectSize+SK_Scalar1; y < H; y += 2*kHalfRectS ize+2) {
204 for (SkScalar x = kHalfRectSize+SK_Scalar1; x < W; x += 2*kHalfR ectSize+2) {
205 canvas->save();
206 canvas->translate(x, y);
207
208 if (fRotate) {
209 SkMatrix rotate;
210 rotate.setRotate(SkIntToScalar(rot));
211 canvas->concat(rotate);
212 rot += 10;
213 }
214
215 canvas->drawRect(r, paint);
216 canvas->restore();
217 }
218 }
219 }
220
221 }
222 private:
223 bool fRotate;
224 typedef Benchmark INHERITED;
225 };
226
227 /******************************************************************************* 173 /*******************************************************************************
228 * to bench BlitMask [Opaque, Black, color, shader] 174 * to bench BlitMask [Opaque, Black, color, shader]
229 ******************************************************************************* / 175 ******************************************************************************* /
230 176
231 class BlitMaskBench : public RectBench { 177 class BlitMaskBench : public RectBench {
232 public: 178 public:
233 enum kMaskType { 179 enum kMaskType {
234 kMaskOpaque = 0, 180 kMaskOpaque = 0,
235 kMaskBlack, 181 kMaskBlack,
236 kMaskColor, 182 kMaskColor,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 DEF_BENCH( return SkNEW_ARGS(RRectBench, (1)); ) 261 DEF_BENCH( return SkNEW_ARGS(RRectBench, (1)); )
316 DEF_BENCH( return SkNEW_ARGS(RRectBench, (1, 4)); ) 262 DEF_BENCH( return SkNEW_ARGS(RRectBench, (1, 4)); )
317 DEF_BENCH( return SkNEW_ARGS(RRectBench, (3)); ) 263 DEF_BENCH( return SkNEW_ARGS(RRectBench, (3)); )
318 DEF_BENCH( return SkNEW_ARGS(RRectBench, (3, 4)); ) 264 DEF_BENCH( return SkNEW_ARGS(RRectBench, (3, 4)); )
319 DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kPoints_PointMode, "points" )); ) 265 DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kPoints_PointMode, "points" )); )
320 DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kLines_PointMode, "lines")) ; ) 266 DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kLines_PointMode, "lines")) ; )
321 DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kPolygon_PointMode, "polygo n")); ) 267 DEF_BENCH( return SkNEW_ARGS(PointsBench, (SkCanvas::kPolygon_PointMode, "polygo n")); )
322 268
323 DEF_BENCH( return SkNEW_ARGS(SrcModeRectBench, ()); ) 269 DEF_BENCH( return SkNEW_ARGS(SrcModeRectBench, ()); )
324 270
325 DEF_BENCH( return SkNEW_ARGS(AARectBench, (false)); )
326 DEF_BENCH( return SkNEW_ARGS(AARectBench, (true)); )
327
328 /* init the blitmask bench 271 /* init the blitmask bench
329 */ 272 */
330 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, 273 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
331 (SkCanvas::kPoints_PointMode, 274 (SkCanvas::kPoints_PointMode,
332 BlitMaskBench::kMaskOpaque, "maskopaque") 275 BlitMaskBench::kMaskOpaque, "maskopaque")
333 ); ) 276 ); )
334 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, 277 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
335 (SkCanvas::kPoints_PointMode, 278 (SkCanvas::kPoints_PointMode,
336 BlitMaskBench::kMaskBlack, "maskblack") 279 BlitMaskBench::kMaskBlack, "maskblack")
337 ); ) 280 ); )
338 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, 281 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
339 (SkCanvas::kPoints_PointMode, 282 (SkCanvas::kPoints_PointMode,
340 BlitMaskBench::kMaskColor, "maskcolor") 283 BlitMaskBench::kMaskColor, "maskcolor")
341 ); ) 284 ); )
342 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, 285 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench,
343 (SkCanvas::kPoints_PointMode, 286 (SkCanvas::kPoints_PointMode,
344 BlitMaskBench::KMaskShader, "maskshader") 287 BlitMaskBench::KMaskShader, "maskshader")
345 ); ) 288 ); )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698