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

Side by Side Diff: src/pathops/SkOpContour.cpp

Issue 2321973005: Rewriting path writer (Closed)
Patch Set: revert unneeded test changes Created 4 years, 3 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 | « src/pathops/SkOpContour.h ('k') | src/pathops/SkOpEdgeBuilder.h » ('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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SkOpContour.h" 7 #include "SkOpContour.h"
8 #include "SkOpTAllocator.h" 8 #include "SkOpTAllocator.h"
9 #include "SkPathWriter.h" 9 #include "SkPathWriter.h"
10 #include "SkReduceOrder.h" 10 #include "SkReduceOrder.h"
(...skipping 20 matching lines...) Expand all
31 memcpy(ptStorage, pts, sizeof(SkPoint) * 4); 31 memcpy(ptStorage, pts, sizeof(SkPoint) * 4);
32 return appendSegment().addCubic(ptStorage, this); 32 return appendSegment().addCubic(ptStorage, this);
33 } break; 33 } break;
34 default: 34 default:
35 SkASSERT(0); 35 SkASSERT(0);
36 } 36 }
37 return nullptr; 37 return nullptr;
38 } 38 }
39 39
40 void SkOpContour::toPath(SkPathWriter* path) const { 40 void SkOpContour::toPath(SkPathWriter* path) const {
41 const SkPoint& pt = fHead.pts()[0];
42 path->deferredMove(pt);
43 const SkOpSegment* segment = &fHead; 41 const SkOpSegment* segment = &fHead;
44 do { 42 do {
45 SkAssertResult(segment->addCurveTo(segment->head(), segment->tail(), pat h)); 43 SkAssertResult(segment->addCurveTo(segment->head(), segment->tail(), pat h));
46 } while ((segment = segment->next())); 44 } while ((segment = segment->next()));
47 path->close(); 45 path->finishContour();
46 path->assemble();
48 } 47 }
49 48
50 void SkOpContour::toReversePath(SkPathWriter* path) const { 49 void SkOpContour::toReversePath(SkPathWriter* path) const {
51 const SkPoint& pt = fTail->pts()[0];
52 path->deferredMove(pt);
53 const SkOpSegment* segment = fTail; 50 const SkOpSegment* segment = fTail;
54 do { 51 do {
55 SkAssertResult(segment->addCurveTo(segment->tail(), segment->head(), pat h)); 52 SkAssertResult(segment->addCurveTo(segment->tail(), segment->head(), pat h));
56 } while ((segment = segment->prev())); 53 } while ((segment = segment->prev()));
57 path->close(); 54 path->finishContour();
55 path->assemble();
58 } 56 }
59 57
60 SkOpSegment* SkOpContour::undoneSegment(SkOpSpanBase** startPtr, SkOpSpanBase** endPtr) { 58 SkOpSegment* SkOpContour::undoneSegment(SkOpSpanBase** startPtr, SkOpSpanBase** endPtr) {
61 SkOpSegment* segment = &fHead; 59 SkOpSegment* segment = &fHead;
62 do { 60 do {
63 if (segment->done()) { 61 if (segment->done()) {
64 continue; 62 continue;
65 } 63 }
66 segment->undoneSpan(startPtr, endPtr); 64 segment->undoneSpan(startPtr, endPtr);
67 return segment; 65 return segment;
68 } while ((segment = segment->next())); 66 } while ((segment = segment->next()));
69 return nullptr; 67 return nullptr;
70 } 68 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpContour.h ('k') | src/pathops/SkOpEdgeBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698