OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef GrAADistanceFieldPathRenderer_DEFINED | 9 #ifndef GrAADistanceFieldPathRenderer_DEFINED |
10 #define GrAADistanceFieldPathRenderer_DEFINED | 10 #define GrAADistanceFieldPathRenderer_DEFINED |
(...skipping 15 matching lines...) Expand all Loading... |
26 private: | 26 private: |
27 StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const
override { | 27 StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const
override { |
28 return GrPathRenderer::kNoSupport_StencilSupport; | 28 return GrPathRenderer::kNoSupport_StencilSupport; |
29 } | 29 } |
30 | 30 |
31 bool onCanDrawPath(const CanDrawPathArgs&) const override; | 31 bool onCanDrawPath(const CanDrawPathArgs&) const override; |
32 | 32 |
33 bool onDrawPath(const DrawPathArgs&) override; | 33 bool onDrawPath(const DrawPathArgs&) override; |
34 | 34 |
35 struct PathData { | 35 struct PathData { |
36 struct Key { | 36 class Key { |
| 37 public: |
| 38 // default ctor needed for new of uninitialized PathData |
| 39 // since fStroke has no default ctor |
| 40 Key() |
| 41 : fGenID(0) |
| 42 , fDimension(0) |
| 43 , fStroke(SkStrokeRec::kFill_InitStyle) {} |
| 44 Key(uint32_t genID, uint32_t dim, const SkStrokeRec& stroke) |
| 45 : fGenID(genID) |
| 46 , fDimension(dim) |
| 47 , fStroke(stroke) {} |
| 48 |
| 49 bool operator==(const Key& other) const { |
| 50 return other.fGenID == fGenID && other.fDimension == fDimension
&& |
| 51 fStroke.hasEqualEffect(other.fStroke); |
| 52 } |
| 53 |
| 54 private: |
37 uint32_t fGenID; | 55 uint32_t fGenID; |
38 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) | 56 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) |
39 uint32_t fDimension; | 57 uint32_t fDimension; |
40 bool operator==(const Key& other) const { | 58 // stroking information |
41 return other.fGenID == fGenID && other.fDimension == fDimension; | 59 SkStrokeRec fStroke; |
42 } | |
43 }; | 60 }; |
44 Key fKey; | 61 Key fKey; |
45 SkScalar fScale; | 62 SkScalar fScale; |
46 GrBatchAtlas::AtlasID fID; | 63 GrBatchAtlas::AtlasID fID; |
47 SkRect fBounds; | 64 SkRect fBounds; |
48 SkIPoint16 fAtlasLocation; | 65 SkIPoint16 fAtlasLocation; |
49 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PathData); | 66 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PathData); |
50 | 67 |
51 static inline const Key& GetKey(const PathData& data) { | 68 static inline const Key& GetKey(const PathData& data) { |
52 return data.fKey; | 69 return data.fKey; |
(...skipping 13 matching lines...) Expand all Loading... |
66 PathCache fPathCache; | 83 PathCache fPathCache; |
67 PathDataList fPathList; | 84 PathDataList fPathList; |
68 | 85 |
69 typedef GrPathRenderer INHERITED; | 86 typedef GrPathRenderer INHERITED; |
70 | 87 |
71 friend class AADistanceFieldPathBatch; | 88 friend class AADistanceFieldPathBatch; |
72 friend struct PathTestStruct; | 89 friend struct PathTestStruct; |
73 }; | 90 }; |
74 | 91 |
75 #endif | 92 #endif |
OLD | NEW |