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 class Key { | 36 struct Key { |
37 public: | |
38 // default ctor needed for new of uninitialized PathData | |
39 // since fStroke has no default ctor | |
40 Key() : fStroke(SkStrokeRec::kFill_InitStyle) {} | |
41 Key(uint32_t genID, uint32_t dim, const SkStrokeRec& stroke) | |
42 : fGenID(genID) | |
43 , fDimension(dim) | |
44 , fStroke(stroke) { | |
45 } | |
46 | |
47 bool operator==(const Key& other) const { | |
48 return other.fGenID == fGenID && other.fDimension == fDimension &
& | |
49 fStroke.hasEqualEffect(other.fStroke); | |
50 } | |
51 | |
52 private: | |
53 uint32_t fGenID; | 37 uint32_t fGenID; |
54 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) | 38 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) |
55 uint32_t fDimension; | 39 uint32_t fDimension; |
56 // stroking information | 40 bool operator==(const Key& other) const { |
57 SkStrokeRec fStroke; | 41 return other.fGenID == fGenID && other.fDimension == fDimension; |
| 42 } |
58 }; | 43 }; |
59 Key fKey; | 44 Key fKey; |
60 SkScalar fScale; | 45 SkScalar fScale; |
61 GrBatchAtlas::AtlasID fID; | 46 GrBatchAtlas::AtlasID fID; |
62 SkRect fBounds; | 47 SkRect fBounds; |
63 SkIPoint16 fAtlasLocation; | 48 SkIPoint16 fAtlasLocation; |
64 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PathData); | 49 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PathData); |
65 | 50 |
66 static inline const Key& GetKey(const PathData& data) { | 51 static inline const Key& GetKey(const PathData& data) { |
67 return data.fKey; | 52 return data.fKey; |
(...skipping 13 matching lines...) Expand all Loading... |
81 PathCache fPathCache; | 66 PathCache fPathCache; |
82 PathDataList fPathList; | 67 PathDataList fPathList; |
83 | 68 |
84 typedef GrPathRenderer INHERITED; | 69 typedef GrPathRenderer INHERITED; |
85 | 70 |
86 friend class AADistanceFieldPathBatch; | 71 friend class AADistanceFieldPathBatch; |
87 friend struct PathTestStruct; | 72 friend struct PathTestStruct; |
88 }; | 73 }; |
89 | 74 |
90 #endif | 75 #endif |
OLD | NEW |