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

Side by Side Diff: gm/convexpaths.cpp

Issue 15120004: Make GrAAConvexPathRender support paths with > 64K verts. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 7 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 | « no previous file | src/gpu/GrAAConvexPathRenderer.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 "gm.h" 8 #include "gm.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkTArray.h" 10 #include "SkTArray.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 SK_Scalar1 * 100), 113 SK_Scalar1 * 100),
114 40 * SK_Scalar1, 20 * SK_Scalar1, 114 40 * SK_Scalar1, 20 * SK_Scalar1,
115 SkPath::kCW_Direction); 115 SkPath::kCW_Direction);
116 116
117 fPaths.push_back().addRoundRect(SkRect::MakeXYWH(0, 0, 117 fPaths.push_back().addRoundRect(SkRect::MakeXYWH(0, 0,
118 SK_Scalar1 * 100, 118 SK_Scalar1 * 100,
119 SK_Scalar1 * 100), 119 SK_Scalar1 * 100),
120 20 * SK_Scalar1, 40 * SK_Scalar1, 120 20 * SK_Scalar1, 40 * SK_Scalar1,
121 SkPath::kCCW_Direction); 121 SkPath::kCCW_Direction);
122 122
123 // large number of points
124 enum {
125 kLength = 100,
126 kPtsPerSide = (1 << 12),
127 };
128 fPaths.push_back().moveTo(0, 0);
129 for (int i = 1; i < kPtsPerSide; ++i) { // skip the first point due to m oveTo.
130 fPaths.back().lineTo(kLength * SkIntToScalar(i) / kPtsPerSide, 0);
131 }
132 for (int i = 0; i < kPtsPerSide; ++i) {
133 fPaths.back().lineTo(kLength, kLength * SkIntToScalar(i) / kPtsPerSi de);
134 }
135 for (int i = kPtsPerSide; i > 0; --i) {
136 fPaths.back().lineTo(kLength * SkIntToScalar(i) / kPtsPerSide, kLeng th);
137 }
138 for (int i = kPtsPerSide; i > 0; --i) {
139 fPaths.back().lineTo(0, kLength * SkIntToScalar(i) / kPtsPerSide);
140 }
141
123 // shallow diagonals 142 // shallow diagonals
124 fPaths.push_back().lineTo(100 * SK_Scalar1, SK_Scalar1); 143 fPaths.push_back().lineTo(100 * SK_Scalar1, SK_Scalar1);
125 fPaths.back().lineTo(98 * SK_Scalar1, 100 * SK_Scalar1); 144 fPaths.back().lineTo(98 * SK_Scalar1, 100 * SK_Scalar1);
126 fPaths.back().lineTo(3 * SK_Scalar1, 96 * SK_Scalar1); 145 fPaths.back().lineTo(3 * SK_Scalar1, 96 * SK_Scalar1);
127 146
128
129 //It turns out arcTos are not automatically marked as convex and they 147 //It turns out arcTos are not automatically marked as convex and they
130 //may in fact be ever so slightly concave. 148 //may in fact be ever so slightly concave.
131 //fPaths.push_back().arcTo(SkRect::MakeXYWH(0, 0, 149 //fPaths.push_back().arcTo(SkRect::MakeXYWH(0, 0,
132 // 50 * SK_Scalar1, 150 // 50 * SK_Scalar1,
133 // 100 * SK_Scalar1), 151 // 100 * SK_Scalar1),
134 // 25 * SK_Scalar1, 130 * SK_Scalar1, false); 152 // 25 * SK_Scalar1, 130 * SK_Scalar1, false);
135 153
136 // cubics 154 // cubics
137 fPaths.push_back().cubicTo( 1 * SK_Scalar1, 1 * SK_Scalar1, 155 fPaths.push_back().cubicTo( 1 * SK_Scalar1, 1 * SK_Scalar1,
138 10 * SK_Scalar1, 90 * SK_Scalar1, 156 10 * SK_Scalar1, 90 * SK_Scalar1,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 typedef GM INHERITED; 274 typedef GM INHERITED;
257 SkTArray<SkPath> fPaths; 275 SkTArray<SkPath> fPaths;
258 }; 276 };
259 277
260 ////////////////////////////////////////////////////////////////////////////// 278 //////////////////////////////////////////////////////////////////////////////
261 279
262 static GM* MyFactory(void*) { return new ConvexPathsGM; } 280 static GM* MyFactory(void*) { return new ConvexPathsGM; }
263 static GMRegistry reg(MyFactory); 281 static GMRegistry reg(MyFactory);
264 282
265 } 283 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698