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