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

Side by Side Diff: samplecode/SampleHairCurves.cpp

Issue 19238003: Add bench for hairline paths (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « gyp/bench.gypi ('k') | 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 13 matching lines...) Expand all
24 return true; 24 return true;
25 } 25 }
26 return this->INHERITED::onQuery(evt); 26 return this->INHERITED::onQuery(evt);
27 } 27 }
28 28
29 29
30 virtual void onDrawContent(SkCanvas* canvas) { 30 virtual void onDrawContent(SkCanvas* canvas) {
31 SkPaint paint; 31 SkPaint paint;
32 paint.setAntiAlias(true); 32 paint.setAntiAlias(true);
33 paint.setStyle(SkPaint::kStroke_Style); 33 paint.setStyle(SkPaint::kStroke_Style);
34 paint.setStrokeWidth(-1); 34 paint.setStrokeWidth(0);
35 canvas->save(); 35 canvas->save();
36 canvas->scale(1000 * SK_Scalar1, 1000 * SK_Scalar1); 36 canvas->scale(1000 * SK_Scalar1, 1000 * SK_Scalar1);
37 SkRandom rand; 37 SkRandom rand;
38 SkPath curves; 38 SkPath curves;
39 SkPath hulls; 39 SkPath hulls;
40 SkPath ctrlPts; 40 SkPath ctrlPts;
41 for (int i = 0; i < 100; ++i) { 41 for (int i = 0; i < 100; ++i) {
42 SkScalar pts[] = { 42 SkScalar pts[] = {
43 rand.nextUScalar1(), rand.nextUScalar1(), 43 rand.nextUScalar1(), rand.nextUScalar1(),
44 rand.nextUScalar1(), rand.nextUScalar1(), 44 rand.nextUScalar1(), rand.nextUScalar1(),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 private: 104 private:
105 typedef SampleView INHERITED; 105 typedef SampleView INHERITED;
106 }; 106 };
107 107
108 ////////////////////////////////////////////////////////////////////////////// 108 //////////////////////////////////////////////////////////////////////////////
109 109
110 static SkView* MyFactory() { return new HairCurvesView; } 110 static SkView* MyFactory() { return new HairCurvesView; }
111 static SkViewRegister reg(MyFactory); 111 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « gyp/bench.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698