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