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

Side by Side Diff: src/pathops/SkOpEdgeBuilder.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/SkOpEdgeBuilder.h ('k') | src/pathops/SkOpSegment.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 2012 Google Inc. 2 * Copyright 2012 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 "SkGeometry.h" 7 #include "SkGeometry.h"
8 #include "SkOpEdgeBuilder.h" 8 #include "SkOpEdgeBuilder.h"
9 #include "SkReduceOrder.h" 9 #include "SkReduceOrder.h"
10 10
11 void SkOpEdgeBuilder::init() { 11 void SkOpEdgeBuilder::init() {
12 fCurrentContour = fContoursHead; 12 fCurrentContour = fContoursHead;
13 fOperand = false; 13 fOperand = false;
14 fXorMask[0] = fXorMask[1] = (fPath->getFillType() & 1) ? kEvenOdd_PathOpsMas k 14 fXorMask[0] = fXorMask[1] = (fPath->getFillType() & 1) ? kEvenOdd_PathOpsMas k
15 : kWinding_PathOpsMask; 15 : kWinding_PathOpsMask;
16 fUnparseable = false; 16 fUnparseable = false;
17 fSecondHalf = preFetch(); 17 fSecondHalf = preFetch();
18 } 18 }
19 19
20 void SkOpEdgeBuilder::addOperand(const SkPath& path) { 20 void SkOpEdgeBuilder::addOperand(const SkPath& path) {
21 SkASSERT(fPathVerbs.count() > 0 && fPathVerbs.end()[-1] == SkPath::kDone_Ver b); 21 SkASSERT(fPathVerbs.count() > 0 && fPathVerbs.end()[-1] == SkPath::kDone_Ver b);
22 fPathVerbs.pop(); 22 fPathVerbs.pop();
23 fPath = &path; 23 fPath = &path;
24 fXorMask[1] = (fPath->getFillType() & 1) ? kEvenOdd_PathOpsMask 24 fXorMask[1] = (fPath->getFillType() & 1) ? kEvenOdd_PathOpsMask
25 : kWinding_PathOpsMask; 25 : kWinding_PathOpsMask;
26 preFetch(); 26 preFetch();
27 } 27 }
28 28
29 int SkOpEdgeBuilder::count() const {
30 SkOpContour* contour = fContoursHead;
31 int count = 0;
32 while (contour) {
33 count += contour->count() > 0;
34 contour = contour->next();
35 }
36 return count;
37 }
38
39 bool SkOpEdgeBuilder::finish() { 29 bool SkOpEdgeBuilder::finish() {
40 fOperand = false; 30 fOperand = false;
41 if (fUnparseable || !walk()) { 31 if (fUnparseable || !walk()) {
42 return false; 32 return false;
43 } 33 }
44 complete(); 34 complete();
45 if (fCurrentContour && !fCurrentContour->count()) { 35 if (fCurrentContour && !fCurrentContour->count()) {
46 fContoursHead->remove(fCurrentContour); 36 fContoursHead->remove(fCurrentContour);
47 } 37 }
48 return true; 38 return true;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 238 }
249 SkASSERT(fCurrentContour); 239 SkASSERT(fCurrentContour);
250 fCurrentContour->debugValidate(); 240 fCurrentContour->debugValidate();
251 pointsPtr += SkPathOpsVerbToPoints(verb); 241 pointsPtr += SkPathOpsVerbToPoints(verb);
252 } 242 }
253 if (fCurrentContour && fCurrentContour->count() &&!fAllowOpenContours && !clo se()) { 243 if (fCurrentContour && fCurrentContour->count() &&!fAllowOpenContours && !clo se()) {
254 return false; 244 return false;
255 } 245 }
256 return true; 246 return true;
257 } 247 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpEdgeBuilder.h ('k') | src/pathops/SkOpSegment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698