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

Side by Side Diff: src/pathops/SkOpEdgeBuilder.h

Issue 14407006: path ops -- handle non-finite numbers (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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
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 #ifndef SkOpEdgeBuilder_DEFINED 7 #ifndef SkOpEdgeBuilder_DEFINED
8 #define SkOpEdgeBuilder_DEFINED 8 #define SkOpEdgeBuilder_DEFINED
9 9
10 #include "SkOpContour.h" 10 #include "SkOpContour.h"
11 #include "SkPathWriter.h" 11 #include "SkPathWriter.h"
12 #include "SkTArray.h" 12 #include "SkTArray.h"
13 #include "SkTDArray.h" 13 #include "SkTDArray.h"
14 14
15 class SkOpEdgeBuilder { 15 class SkOpEdgeBuilder {
16 public: 16 public:
17 SkOpEdgeBuilder(const SkPathWriter& path, SkTArray<SkOpContour>& contours) 17 SkOpEdgeBuilder(const SkPathWriter& path, SkTArray<SkOpContour>& contours)
18 : fPath(path.nativePath()) 18 : fPath(path.nativePath())
19 , fContours(contours) { 19 , fContours(contours) {
20 init(); 20 init();
21 } 21 }
22 22
23 SkOpEdgeBuilder(const SkPath& path, SkTArray<SkOpContour>& contours) 23 SkOpEdgeBuilder(const SkPath& path, SkTArray<SkOpContour>& contours)
24 : fPath(&path) 24 : fPath(&path)
25 , fContours(contours) { 25 , fContours(contours)
26 , fAllowOpenContours(false) {
26 init(); 27 init();
27 } 28 }
28 29
29 void complete() { 30 void complete() {
30 if (fCurrentContour && fCurrentContour->segments().count()) { 31 if (fCurrentContour && fCurrentContour->segments().count()) {
31 fCurrentContour->complete(); 32 fCurrentContour->complete();
32 fCurrentContour = NULL; 33 fCurrentContour = NULL;
33 } 34 }
34 } 35 }
35 36
36 SkPathOpsMask xorMask() const { 37 SkPathOpsMask xorMask() const {
37 return fXorMask[fOperand]; 38 return fXorMask[fOperand];
38 } 39 }
39 40
40 void addOperand(const SkPath& path); 41 void addOperand(const SkPath& path);
41 void finish(); 42 bool finish();
42 void init(); 43 void init();
44 void setAllowOpenContours(bool allow) {
45 fAllowOpenContours = allow;
46 }
43 47
44 private: 48 private:
49 bool close();
45 int preFetch(); 50 int preFetch();
46 void walk(); 51 bool walk();
47 52
48 const SkPath* fPath; 53 const SkPath* fPath;
49 SkTDArray<SkPoint> fPathPts; // FIXME: point directly to path pts instead 54 SkTDArray<SkPoint> fPathPts;
50 SkTDArray<uint8_t> fPathVerbs; // FIXME: remove 55 SkTDArray<uint8_t> fPathVerbs;
51 SkOpContour* fCurrentContour; 56 SkOpContour* fCurrentContour;
52 SkTArray<SkOpContour>& fContours; 57 SkTArray<SkOpContour>& fContours;
53 SkTDArray<SkPoint> fReducePts; // segments created on the fly 58 SkTDArray<SkPoint> fReducePts; // segments created on the fly
54 SkTDArray<int> fExtra; // -1 marks new contour, > 0 offsets into contour 59 SkTDArray<int> fExtra; // -1 marks new contour, > 0 offsets into contour
55 SkPathOpsMask fXorMask[2]; 60 SkPathOpsMask fXorMask[2];
61 const SkPoint* fFinalCurveStart;
62 const SkPoint* fFinalCurveEnd;
56 int fSecondHalf; 63 int fSecondHalf;
57 bool fOperand; 64 bool fOperand;
65 bool fAllowOpenContours;
58 }; 66 };
59 67
60 #endif 68 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698