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

Side by Side Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 15068008: Remove GrPathCmd (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrDefaultPathRenderer.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 8
9 #include "GrAAHairLinePathRenderer.h" 9 #include "GrAAHairLinePathRenderer.h"
10 10
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 int totalQuadCount = 0; 213 int totalQuadCount = 0;
214 GrRect bounds; 214 GrRect bounds;
215 GrIRect ibounds; 215 GrIRect ibounds;
216 216
217 bool persp = m.hasPerspective(); 217 bool persp = m.hasPerspective();
218 218
219 for (;;) { 219 for (;;) {
220 GrPoint pts[4]; 220 GrPoint pts[4];
221 GrPoint devPts[4]; 221 GrPoint devPts[4];
222 GrPathCmd cmd = (GrPathCmd)iter.next(pts); 222 SkPath::Verb verb = iter.next(pts);
223 switch (cmd) { 223 switch (verb) {
224 case kMove_PathCmd: 224 case SkPath::kMove_Verb:
225 break; 225 break;
226 case kLine_PathCmd: 226 case SkPath::kLine_Verb:
227 m.mapPoints(devPts, pts, 2); 227 m.mapPoints(devPts, pts, 2);
228 bounds.setBounds(devPts, 2); 228 bounds.setBounds(devPts, 2);
229 bounds.outset(SK_Scalar1, SK_Scalar1); 229 bounds.outset(SK_Scalar1, SK_Scalar1);
230 bounds.roundOut(&ibounds); 230 bounds.roundOut(&ibounds);
231 if (SkIRect::Intersects(devClipBounds, ibounds)) { 231 if (SkIRect::Intersects(devClipBounds, ibounds)) {
232 SkPoint* pts = lines->push_back_n(2); 232 SkPoint* pts = lines->push_back_n(2);
233 pts[0] = devPts[0]; 233 pts[0] = devPts[0];
234 pts[1] = devPts[1]; 234 pts[1] = devPts[1];
235 } 235 }
236 break; 236 break;
237 case kQuadratic_PathCmd: 237 case SkPath::kQuad_Verb:
238 m.mapPoints(devPts, pts, 3); 238 m.mapPoints(devPts, pts, 3);
239 bounds.setBounds(devPts, 3); 239 bounds.setBounds(devPts, 3);
240 bounds.outset(SK_Scalar1, SK_Scalar1); 240 bounds.outset(SK_Scalar1, SK_Scalar1);
241 bounds.roundOut(&ibounds); 241 bounds.roundOut(&ibounds);
242 if (SkIRect::Intersects(devClipBounds, ibounds)) { 242 if (SkIRect::Intersects(devClipBounds, ibounds)) {
243 int subdiv = num_quad_subdivs(devPts); 243 int subdiv = num_quad_subdivs(devPts);
244 GrAssert(subdiv >= -1); 244 GrAssert(subdiv >= -1);
245 if (-1 == subdiv) { 245 if (-1 == subdiv) {
246 SkPoint* pts = lines->push_back_n(4); 246 SkPoint* pts = lines->push_back_n(4);
247 pts[0] = devPts[0]; 247 pts[0] = devPts[0];
248 pts[1] = devPts[1]; 248 pts[1] = devPts[1];
249 pts[2] = devPts[1]; 249 pts[2] = devPts[1];
250 pts[3] = devPts[2]; 250 pts[3] = devPts[2];
251 } else { 251 } else {
252 // when in perspective keep quads in src space 252 // when in perspective keep quads in src space
253 SkPoint* qPts = persp ? pts : devPts; 253 SkPoint* qPts = persp ? pts : devPts;
254 SkPoint* pts = quads->push_back_n(3); 254 SkPoint* pts = quads->push_back_n(3);
255 pts[0] = qPts[0]; 255 pts[0] = qPts[0];
256 pts[1] = qPts[1]; 256 pts[1] = qPts[1];
257 pts[2] = qPts[2]; 257 pts[2] = qPts[2];
258 quadSubdivCnts->push_back() = subdiv; 258 quadSubdivCnts->push_back() = subdiv;
259 totalQuadCount += 1 << subdiv; 259 totalQuadCount += 1 << subdiv;
260 } 260 }
261 } 261 }
262 break; 262 break;
263 case kCubic_PathCmd: 263 case SkPath::kCubic_Verb:
264 m.mapPoints(devPts, pts, 4); 264 m.mapPoints(devPts, pts, 4);
265 bounds.setBounds(devPts, 4); 265 bounds.setBounds(devPts, 4);
266 bounds.outset(SK_Scalar1, SK_Scalar1); 266 bounds.outset(SK_Scalar1, SK_Scalar1);
267 bounds.roundOut(&ibounds); 267 bounds.roundOut(&ibounds);
268 if (SkIRect::Intersects(devClipBounds, ibounds)) { 268 if (SkIRect::Intersects(devClipBounds, ibounds)) {
269 PREALLOC_PTARRAY(32) q; 269 PREALLOC_PTARRAY(32) q;
270 // we don't need a direction if we aren't constraining the s ubdivision 270 // we don't need a direction if we aren't constraining the s ubdivision
271 static const SkPath::Direction kDummyDir = SkPath::kCCW_Dire ction; 271 static const SkPath::Direction kDummyDir = SkPath::kCCW_Dire ction;
272 // We convert cubics to quadratics (for now). 272 // We convert cubics to quadratics (for now).
273 // In perspective have to do conversion in src space. 273 // In perspective have to do conversion in src space.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 pts[0] = q[0 + i]; 310 pts[0] = q[0 + i];
311 pts[1] = q[1 + i]; 311 pts[1] = q[1 + i];
312 pts[2] = q[2 + i]; 312 pts[2] = q[2 + i];
313 quadSubdivCnts->push_back() = subdiv; 313 quadSubdivCnts->push_back() = subdiv;
314 totalQuadCount += 1 << subdiv; 314 totalQuadCount += 1 << subdiv;
315 } 315 }
316 } 316 }
317 } 317 }
318 } 318 }
319 break; 319 break;
320 case kClose_PathCmd: 320 case SkPath::kClose_Verb:
321 break; 321 break;
322 case kEnd_PathCmd: 322 case SkPath::kDone_Verb:
323 return totalQuadCount; 323 return totalQuadCount;
324 } 324 }
325 } 325 }
326 } 326 }
327 327
328 struct Vertex { 328 struct Vertex {
329 GrPoint fPos; 329 GrPoint fPos;
330 union { 330 union {
331 struct { 331 struct {
332 SkScalar fA; 332 SkScalar fA;
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 4 * lineCnt + kVertsPerQuad*quads, // startV 839 4 * lineCnt + kVertsPerQuad*quads, // startV
840 0, // startI 840 0, // startI
841 kVertsPerQuad*n, // vCount 841 kVertsPerQuad*n, // vCount
842 kIdxsPerQuad*n); // iCount 842 kIdxsPerQuad*n); // iCount
843 quads += n; 843 quads += n;
844 } 844 }
845 target->resetIndexSource(); 845 target->resetIndexSource();
846 846
847 return true; 847 return true;
848 } 848 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698