OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2012 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 #ifndef SkOpEdgeBuilder_DEFINED |
| 8 #define SkOpEdgeBuilder_DEFINED |
| 9 |
| 10 #include "SkOpContour.h" |
| 11 #include "SkPathWriter.h" |
| 12 #include "SkTDArray.h" |
| 13 #include "SkTArray.h" |
| 14 |
| 15 class SkOpEdgeBuilder { |
| 16 public: |
| 17 SkOpEdgeBuilder(const SkPathWriter& path, SkTArray<SkOpContour>& contours) |
| 18 : fPath(path.nativePath()) |
| 19 , fContours(contours) |
| 20 { |
| 21 init(); |
| 22 } |
| 23 |
| 24 SkOpEdgeBuilder(const SkPath& path, SkTArray<SkOpContour>& contours) |
| 25 : fPath(&path) |
| 26 , fContours(contours) |
| 27 { |
| 28 init(); |
| 29 } |
| 30 |
| 31 void complete() { |
| 32 if (fCurrentContour && fCurrentContour->segments().count()) { |
| 33 fCurrentContour->complete(); |
| 34 fCurrentContour = NULL; |
| 35 } |
| 36 } |
| 37 |
| 38 SkPathOpsMask xorMask() const { |
| 39 return fXorMask[fOperand]; |
| 40 } |
| 41 |
| 42 void addOperand(const SkPath& path); |
| 43 void finish(); |
| 44 void init(); |
| 45 |
| 46 private: |
| 47 int preFetch(); |
| 48 void walk(); |
| 49 |
| 50 const SkPath* fPath; |
| 51 SkTDArray<SkPoint> fPathPts; // FIXME: point directly to path pts instead |
| 52 SkTDArray<uint8_t> fPathVerbs; // FIXME: remove |
| 53 SkOpContour* fCurrentContour; |
| 54 SkTArray<SkOpContour>& fContours; |
| 55 SkTDArray<SkPoint> fReducePts; // segments created on the fly |
| 56 SkTDArray<int> fExtra; // -1 marks new contour, > 0 offsets into contour |
| 57 SkPathOpsMask fXorMask[2]; |
| 58 int fSecondHalf; |
| 59 bool fOperand; |
| 60 }; |
| 61 |
| 62 #endif |
OLD | NEW |