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

Side by Side Diff: bench/DashBench.cpp

Issue 1805963002: allow one zero length dash (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix dash nanobench Created 4 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 | gm/arcto.cpp » ('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 /* 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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 void onDraw(int loops, SkCanvas* canvas) override { 65 void onDraw(int loops, SkCanvas* canvas) override {
66 SkPaint paint; 66 SkPaint paint;
67 this->setupPaint(&paint); 67 this->setupPaint(&paint);
68 paint.setStyle(SkPaint::kStroke_Style); 68 paint.setStyle(SkPaint::kStroke_Style);
69 paint.setStrokeWidth(SkIntToScalar(fWidth)); 69 paint.setStrokeWidth(SkIntToScalar(fWidth));
70 paint.setAntiAlias(false); 70 paint.setAntiAlias(false);
71 71
72 SkPath path; 72 SkPath path;
73 this->makePath(&path); 73 this->makePath(&path);
74 74
75 paint.setPathEffect(SkDashPathEffect::Create(fIntervals.begin(), 75 SkAutoTUnref<SkPathEffect> effect(SkDashPathEffect::Create(fIntervals.be gin(),
76 fIntervals.count(), 0))->un ref(); 76 fIntervals.count(), 0));
77 paint.setPathEffect(effect);
77 78
78 if (fDoClip) { 79 if (fDoClip) {
79 SkRect r = path.getBounds(); 80 SkRect r = path.getBounds();
80 r.inset(-SkIntToScalar(20), -SkIntToScalar(20)); 81 r.inset(-SkIntToScalar(20), -SkIntToScalar(20));
81 // now move it so we don't intersect 82 // now move it so we don't intersect
82 r.offset(0, r.height() * 3 / 2); 83 r.offset(0, r.height() * 3 / 2);
83 canvas->clipRect(r); 84 canvas->clipRect(r);
84 } 85 }
85 86
86 this->handlePath(canvas, path, paint, loops); 87 this->handlePath(canvas, path, paint, loops);
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // hori_2 is just too slow to enable at the moment 481 // hori_2 is just too slow to enable at the moment
481 DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 2); ) 482 DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 2); )
482 DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 2); ) 483 DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 2); )
483 DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 2); ) 484 DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 2); )
484 485
485 DEF_BENCH( return new DashGridBench(1, 1, true); ) 486 DEF_BENCH( return new DashGridBench(1, 1, true); )
486 DEF_BENCH( return new DashGridBench(1, 1, false); ) 487 DEF_BENCH( return new DashGridBench(1, 1, false); )
487 DEF_BENCH( return new DashGridBench(3, 1, true); ) 488 DEF_BENCH( return new DashGridBench(3, 1, true); )
488 DEF_BENCH( return new DashGridBench(3, 1, false); ) 489 DEF_BENCH( return new DashGridBench(3, 1, false); )
489 #endif 490 #endif
OLDNEW
« no previous file with comments | « no previous file | gm/arcto.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698