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 23 matching lines...) Expand all Loading... |
34 const SkStrokeRec&, | 34 const SkStrokeRec&, |
35 const GrDrawTarget*) const SK_OVE
RRIDE; | 35 const GrDrawTarget*) const SK_OVE
RRIDE; |
36 | 36 |
37 virtual bool onDrawPath(const SkPath& path, | 37 virtual bool onDrawPath(const SkPath& path, |
38 const SkStrokeRec& stroke, | 38 const SkStrokeRec& stroke, |
39 GrDrawTarget* target, | 39 GrDrawTarget* target, |
40 bool antiAlias) SK_OVERRIDE; | 40 bool antiAlias) SK_OVERRIDE; |
41 | 41 |
42 private: | 42 private: |
43 struct PathData { | 43 struct PathData { |
44 uint32_t fGenID; | 44 struct Key { |
| 45 uint32_t fGenID; |
| 46 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) |
| 47 uint32_t fDimension; |
| 48 bool operator==(const Key& other) const { |
| 49 return other.fGenID == fGenID && other.fDimension == fDimension; |
| 50 } |
| 51 }; |
| 52 Key fKey; |
| 53 SkScalar fScale; |
45 GrPlot* fPlot; | 54 GrPlot* fPlot; |
46 SkRect fBounds; | 55 SkRect fBounds; |
47 SkIPoint16 fAtlasLocation; | 56 SkIPoint16 fAtlasLocation; |
48 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PathData); | 57 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PathData); |
49 | 58 |
50 static inline const uint32_t& GetKey(const PathData& data) { | 59 static inline const Key& GetKey(const PathData& data) { |
51 return data.fGenID; | 60 return data.fKey; |
52 } | 61 } |
53 | 62 |
54 static inline uint32_t Hash(uint32_t key) { | 63 static inline uint32_t Hash(Key key) { |
55 return SkChecksum::Murmur3(&key, sizeof(key)); | 64 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&key),
sizeof(key)); |
56 } | 65 } |
57 }; | 66 }; |
58 typedef SkTInternalLList<PathData> PathDataList; | 67 typedef SkTInternalLList<PathData> PathDataList; |
59 | 68 |
60 GrContext* fContext; | 69 GrContext* fContext; |
61 GrAtlas* fAtlas; | 70 GrAtlas* fAtlas; |
62 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; | 71 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; |
63 // current set of flags used to create the cached geometry processor | 72 // current set of flags used to create the cached geometry processor |
64 uint32_t fEffectFlags; | 73 uint32_t fEffectFlags; |
65 GrAtlas::ClientPlotUsage fPlotUsage; | 74 GrAtlas::ClientPlotUsage fPlotUsage; |
66 SkTDynamicHash<PathData, uint32_t> fPathCache; | 75 SkTDynamicHash<PathData, PathData::Key> fPathCache; |
67 PathDataList fPathList; | 76 PathDataList fPathList; |
68 | 77 |
69 bool internalDrawPath(const SkPath& path, const PathData* pathData, GrDrawTa
rget* target); | 78 bool internalDrawPath(const SkPath& path, const PathData* pathData, GrDrawTa
rget* target); |
70 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool
antiAlias); | 79 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool
antiAlias, |
| 80 uint32_t dimension, SkScalar scale); |
71 bool freeUnusedPlot(); | 81 bool freeUnusedPlot(); |
72 | 82 |
73 typedef GrPathRenderer INHERITED; | 83 typedef GrPathRenderer INHERITED; |
74 }; | 84 }; |
75 | 85 |
76 #endif | 86 #endif |
OLD | NEW |