| OLD | NEW |
| 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 | 12 |
| 13 class SkOpEdgeBuilder { | 13 class SkOpEdgeBuilder { |
| 14 public: | 14 public: |
| 15 SkOpEdgeBuilder(const SkPathWriter& path, SkOpContour* contours2, SkOpGlobal
State* globalState) | 15 SkOpEdgeBuilder(const SkPathWriter& path, SkOpContourHead* contours2, |
| 16 SkOpGlobalState* globalState) |
| 16 : fGlobalState(globalState) | 17 : fGlobalState(globalState) |
| 17 , fPath(path.nativePath()) | 18 , fPath(path.nativePath()) |
| 18 , fContoursHead(contours2) | 19 , fContoursHead(contours2) |
| 19 , fAllowOpenContours(true) { | 20 , fAllowOpenContours(true) { |
| 20 init(); | 21 init(); |
| 21 } | 22 } |
| 22 | 23 |
| 23 SkOpEdgeBuilder(const SkPath& path, SkOpContour* contours2, SkOpGlobalState*
globalState) | 24 SkOpEdgeBuilder(const SkPath& path, SkOpContourHead* contours2, SkOpGlobalSt
ate* globalState) |
| 24 : fGlobalState(globalState) | 25 : fGlobalState(globalState) |
| 25 , fPath(&path) | 26 , fPath(&path) |
| 26 , fContoursHead(contours2) | 27 , fContoursHead(contours2) |
| 27 , fAllowOpenContours(false) { | 28 , fAllowOpenContours(false) { |
| 28 init(); | 29 init(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void addOperand(const SkPath& path); | 32 void addOperand(const SkPath& path); |
| 32 | 33 |
| 33 void complete() { | 34 void complete() { |
| 34 if (fCurrentContour && fCurrentContour->count()) { | 35 if (fCurrentContour && fCurrentContour->count()) { |
| 35 fCurrentContour->complete(); | 36 fCurrentContour->complete(); |
| 36 fCurrentContour = nullptr; | 37 fCurrentContour = nullptr; |
| 37 } | 38 } |
| 38 } | 39 } |
| 39 | 40 |
| 40 int count() const; | |
| 41 bool finish(); | 41 bool finish(); |
| 42 | 42 |
| 43 const SkOpContour* head() const { | 43 const SkOpContour* head() const { |
| 44 return fContoursHead; | 44 return fContoursHead; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void init(); | 47 void init(); |
| 48 bool unparseable() const { return fUnparseable; } | 48 bool unparseable() const { return fUnparseable; } |
| 49 SkPathOpsMask xorMask() const { return fXorMask[fOperand]; } | 49 SkPathOpsMask xorMask() const { return fXorMask[fOperand]; } |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 void closeContour(const SkPoint& curveEnd, const SkPoint& curveStart); | 52 void closeContour(const SkPoint& curveEnd, const SkPoint& curveStart); |
| 53 bool close(); | 53 bool close(); |
| 54 int preFetch(); | 54 int preFetch(); |
| 55 bool walk(); | 55 bool walk(); |
| 56 | 56 |
| 57 SkOpGlobalState* fGlobalState; | 57 SkOpGlobalState* fGlobalState; |
| 58 const SkPath* fPath; | 58 const SkPath* fPath; |
| 59 SkTDArray<SkPoint> fPathPts; | 59 SkTDArray<SkPoint> fPathPts; |
| 60 SkTDArray<SkScalar> fWeights; | 60 SkTDArray<SkScalar> fWeights; |
| 61 SkTDArray<uint8_t> fPathVerbs; | 61 SkTDArray<uint8_t> fPathVerbs; |
| 62 SkOpContour* fCurrentContour; | 62 SkOpContour* fCurrentContour; |
| 63 SkOpContour* fContoursHead; | 63 SkOpContourHead* fContoursHead; |
| 64 SkPathOpsMask fXorMask[2]; | 64 SkPathOpsMask fXorMask[2]; |
| 65 int fSecondHalf; | 65 int fSecondHalf; |
| 66 bool fOperand; | 66 bool fOperand; |
| 67 bool fAllowOpenContours; | 67 bool fAllowOpenContours; |
| 68 bool fUnparseable; | 68 bool fUnparseable; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 #endif | 71 #endif |
| OLD | NEW |