| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 SkEdgeBuilder_DEFINED | 7 #ifndef SkEdgeBuilder_DEFINED |
| 8 #define SkEdgeBuilder_DEFINED | 8 #define SkEdgeBuilder_DEFINED |
| 9 | 9 |
| 10 #include "SkChunkAlloc.h" | 10 #include "SkChunkAlloc.h" |
| 11 #include "SkRect.h" | 11 #include "SkRect.h" |
| 12 #include "SkTDArray.h" | 12 #include "SkTDArray.h" |
| 13 | 13 |
| 14 struct SkEdge; | 14 struct SkEdge; |
| 15 struct SkAnalyticEdge; |
| 15 class SkEdgeClipper; | 16 class SkEdgeClipper; |
| 16 class SkPath; | 17 class SkPath; |
| 17 | 18 |
| 18 class SkEdgeBuilder { | 19 class SkEdgeBuilder { |
| 19 public: | 20 public: |
| 20 SkEdgeBuilder(); | 21 SkEdgeBuilder(); |
| 21 | 22 |
| 22 // returns the number of built edges. The array of those edge pointers | 23 // returns the number of built edges. The array of those edge pointers |
| 23 // is returned from edgeList(). | 24 // is returned from edgeList(). |
| 24 int build(const SkPath& path, const SkIRect* clip, int shiftUp, bool clipToT
heRight); | 25 int build(const SkPath& path, const SkIRect* clip, int shiftUp, bool clipToT
heRight, |
| 26 bool analyticAA = false); |
| 25 | 27 |
| 26 SkEdge** edgeList() { return fEdgeList; } | 28 SkEdge** edgeList() { return (SkEdge**)fEdgeList; } |
| 29 SkAnalyticEdge** analyticEdgeList() { return (SkAnalyticEdge**)fEdgeList; } |
| 27 | 30 |
| 28 private: | 31 private: |
| 29 enum Combine { | 32 enum Combine { |
| 30 kNo_Combine, | 33 kNo_Combine, |
| 31 kPartial_Combine, | 34 kPartial_Combine, |
| 32 kTotal_Combine | 35 kTotal_Combine |
| 33 }; | 36 }; |
| 34 | 37 |
| 35 static Combine CombineVertical(const SkEdge* edge, SkEdge* last); | 38 Combine CombineVertical(const SkEdge* edge, SkEdge* last); |
| 39 Combine CombineVertical(const SkAnalyticEdge* edge, SkAnalyticEdge* last); |
| 36 Combine checkVertical(const SkEdge* edge, SkEdge** edgePtr); | 40 Combine checkVertical(const SkEdge* edge, SkEdge** edgePtr); |
| 41 Combine checkVertical(const SkAnalyticEdge* edge, SkAnalyticEdge** edgePtr); |
| 42 bool vertical_line(const SkEdge* edge); |
| 43 bool vertical_line(const SkAnalyticEdge* edge); |
| 37 | 44 |
| 38 SkChunkAlloc fAlloc; | 45 SkChunkAlloc fAlloc; |
| 39 SkTDArray<SkEdge*> fList; | 46 SkTDArray<void*> fList; |
| 40 | 47 |
| 41 /* | 48 /* |
| 42 * If we're in general mode, we allcoate the pointers in fList, and this | 49 * If we're in general mode, we allcoate the pointers in fList, and this |
| 43 * will point at fList.begin(). If we're in polygon mode, fList will be | 50 * will point at fList.begin(). If we're in polygon mode, fList will be |
| 44 * empty, as we will have preallocated room for the pointers in fAlloc's | 51 * empty, as we will have preallocated room for the pointers in fAlloc's |
| 45 * block, and fEdgeList will point into that. | 52 * block, and fEdgeList will point into that. |
| 46 */ | 53 */ |
| 47 SkEdge** fEdgeList; | 54 void** fEdgeList; |
| 48 | 55 |
| 49 int fShiftUp; | 56 int fShiftUp; |
| 57 bool fAnalyticAA; |
| 50 | 58 |
| 51 public: | 59 public: |
| 52 void addLine(const SkPoint pts[]); | 60 void addLine(const SkPoint pts[]); |
| 53 void addQuad(const SkPoint pts[]); | 61 void addQuad(const SkPoint pts[]); |
| 54 void addCubic(const SkPoint pts[]); | 62 void addCubic(const SkPoint pts[]); |
| 55 void addClipper(SkEdgeClipper*); | 63 void addClipper(SkEdgeClipper*); |
| 56 | 64 |
| 57 int buildPoly(const SkPath& path, const SkIRect* clip, int shiftUp, bool cli
pToTheRight); | 65 int buildPoly(const SkPath& path, const SkIRect* clip, int shiftUp, bool cli
pToTheRight); |
| 58 }; | 66 }; |
| 59 | 67 |
| 60 #endif | 68 #endif |
| OLD | NEW |