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

Side by Side Diff: src/gpu/GrDefaultPathRenderer.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/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrPathUtils.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 "GrDefaultPathRenderer.h" 9 #include "GrDefaultPathRenderer.h"
10 10
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 GrPoint* vert = base; 246 GrPoint* vert = base;
247 247
248 GrPoint pts[4]; 248 GrPoint pts[4];
249 249
250 bool first = true; 250 bool first = true;
251 int subpath = 0; 251 int subpath = 0;
252 252
253 SkPath::Iter iter(path, false); 253 SkPath::Iter iter(path, false);
254 254
255 for (;;) { 255 for (;;) {
256 GrPathCmd cmd = (GrPathCmd)iter.next(pts); 256 SkPath::Verb verb = iter.next(pts);
257 switch (cmd) { 257 switch (verb) {
258 case kMove_PathCmd: 258 case SkPath::kMove_Verb:
259 if (!first) { 259 if (!first) {
260 uint16_t currIdx = (uint16_t) (vert - base); 260 uint16_t currIdx = (uint16_t) (vert - base);
261 subpathIdxStart = currIdx; 261 subpathIdxStart = currIdx;
262 ++subpath; 262 ++subpath;
263 } 263 }
264 *vert = pts[0]; 264 *vert = pts[0];
265 vert++; 265 vert++;
266 break; 266 break;
267 case kLine_PathCmd: 267 case SkPath::kLine_Verb:
268 if (indexed) { 268 if (indexed) {
269 uint16_t prevIdx = (uint16_t)(vert - base) - 1; 269 uint16_t prevIdx = (uint16_t)(vert - base) - 1;
270 append_countour_edge_indices(isHairline, subpathIdxStart, 270 append_countour_edge_indices(isHairline, subpathIdxStart,
271 prevIdx, &idx); 271 prevIdx, &idx);
272 } 272 }
273 *(vert++) = pts[1]; 273 *(vert++) = pts[1];
274 break; 274 break;
275 case kQuadratic_PathCmd: { 275 case SkPath::kQuad_Verb: {
276 // first pt of quad is the pt we ended on in previous step 276 // first pt of quad is the pt we ended on in previous step
277 uint16_t firstQPtIdx = (uint16_t)(vert - base) - 1; 277 uint16_t firstQPtIdx = (uint16_t)(vert - base) - 1;
278 uint16_t numPts = (uint16_t) 278 uint16_t numPts = (uint16_t)
279 GrPathUtils::generateQuadraticPoints( 279 GrPathUtils::generateQuadraticPoints(
280 pts[0], pts[1], pts[2], 280 pts[0], pts[1], pts[2],
281 srcSpaceTolSqd, &vert, 281 srcSpaceTolSqd, &vert,
282 GrPathUtils::quadraticPointCount(pts, srcSpaceTol)); 282 GrPathUtils::quadraticPointCount(pts, srcSpaceTol));
283 if (indexed) { 283 if (indexed) {
284 for (uint16_t i = 0; i < numPts; ++i) { 284 for (uint16_t i = 0; i < numPts; ++i) {
285 append_countour_edge_indices(isHairline, subpathIdxStart , 285 append_countour_edge_indices(isHairline, subpathIdxStart ,
286 firstQPtIdx + i, &idx); 286 firstQPtIdx + i, &idx);
287 } 287 }
288 } 288 }
289 break; 289 break;
290 } 290 }
291 case kCubic_PathCmd: { 291 case SkPath::kCubic_Verb: {
292 // first pt of cubic is the pt we ended on in previous step 292 // first pt of cubic is the pt we ended on in previous step
293 uint16_t firstCPtIdx = (uint16_t)(vert - base) - 1; 293 uint16_t firstCPtIdx = (uint16_t)(vert - base) - 1;
294 uint16_t numPts = (uint16_t) GrPathUtils::generateCubicPoints( 294 uint16_t numPts = (uint16_t) GrPathUtils::generateCubicPoints(
295 pts[0], pts[1], pts[2], pts[3], 295 pts[0], pts[1], pts[2], pts[3],
296 srcSpaceTolSqd, &vert, 296 srcSpaceTolSqd, &vert,
297 GrPathUtils::cubicPointCount(pts, srcSpaceTol)); 297 GrPathUtils::cubicPointCount(pts, srcSpaceTol));
298 if (indexed) { 298 if (indexed) {
299 for (uint16_t i = 0; i < numPts; ++i) { 299 for (uint16_t i = 0; i < numPts; ++i) {
300 append_countour_edge_indices(isHairline, subpathIdxStart , 300 append_countour_edge_indices(isHairline, subpathIdxStart ,
301 firstCPtIdx + i, &idx); 301 firstCPtIdx + i, &idx);
302 } 302 }
303 } 303 }
304 break; 304 break;
305 } 305 }
306 case kClose_PathCmd: 306 case SkPath::kClose_Verb:
307 break; 307 break;
308 case kEnd_PathCmd: 308 case SkPath::kDone_Verb:
309 // uint16_t currIdx = (uint16_t) (vert - base); 309 // uint16_t currIdx = (uint16_t) (vert - base);
310 goto FINISHED; 310 goto FINISHED;
311 } 311 }
312 first = false; 312 first = false;
313 } 313 }
314 FINISHED: 314 FINISHED:
315 GrAssert((vert - base) <= maxPts); 315 GrAssert((vert - base) <= maxPts);
316 GrAssert((idx - idxBase) <= maxIdxs); 316 GrAssert((idx - idxBase) <= maxIdxs);
317 317
318 *vertexCnt = vert - base; 318 *vertexCnt = vert - base;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 false); 511 false);
512 } 512 }
513 513
514 void GrDefaultPathRenderer::onStencilPath(const SkPath& path, 514 void GrDefaultPathRenderer::onStencilPath(const SkPath& path,
515 const SkStrokeRec& stroke, 515 const SkStrokeRec& stroke,
516 GrDrawTarget* target) { 516 GrDrawTarget* target) {
517 GrAssert(SkPath::kInverseEvenOdd_FillType != path.getFillType()); 517 GrAssert(SkPath::kInverseEvenOdd_FillType != path.getFillType());
518 GrAssert(SkPath::kInverseWinding_FillType != path.getFillType()); 518 GrAssert(SkPath::kInverseWinding_FillType != path.getFillType());
519 this->internalDrawPath(path, stroke, target, true); 519 this->internalDrawPath(path, stroke, target, true);
520 } 520 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrPathUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698