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; | |
robertphillips
2014/10/29 19:55:02
// fMipLevel is the scaling applied to this path w
jvanverth1
2014/10/30 12:48:28
Done.
| |
46 uint32_t fMipLevel; | |
47 bool operator==(const Key& other) const { | |
48 return other.fGenID == fGenID && other.fMipLevel == fMipLevel; | |
49 } | |
50 }; | |
51 Key fKey; | |
52 SkScalar fScale; | |
45 GrPlot* fPlot; | 53 GrPlot* fPlot; |
46 SkRect fBounds; | 54 SkRect fBounds; |
47 SkIPoint16 fAtlasLocation; | 55 SkIPoint16 fAtlasLocation; |
48 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PathData); | 56 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PathData); |
49 | 57 |
50 static inline const uint32_t& GetKey(const PathData& data) { | 58 static inline const Key& GetKey(const PathData& data) { |
51 return data.fGenID; | 59 return data.fKey; |
52 } | 60 } |
53 | 61 |
54 static inline uint32_t Hash(uint32_t key) { | 62 static inline uint32_t Hash(Key key) { |
55 return SkChecksum::Murmur3(&key, sizeof(key)); | 63 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&key), sizeof(key)); |
56 } | 64 } |
57 }; | 65 }; |
58 typedef SkTInternalLList<PathData> PathDataList; | 66 typedef SkTInternalLList<PathData> PathDataList; |
59 | 67 |
60 GrContext* fContext; | 68 GrContext* fContext; |
61 GrAtlas* fAtlas; | 69 GrAtlas* fAtlas; |
62 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; | 70 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; |
63 // current set of flags used to create the cached geometry processor | 71 // current set of flags used to create the cached geometry processor |
64 uint32_t fEffectFlags; | 72 uint32_t fEffectFlags; |
65 GrAtlas::ClientPlotUsage fPlotUsage; | 73 GrAtlas::ClientPlotUsage fPlotUsage; |
66 SkTDynamicHash<PathData, uint32_t> fPathCache; | 74 SkTDynamicHash<PathData, PathData::Key> fPathCache; |
67 PathDataList fPathList; | 75 PathDataList fPathList; |
68 | 76 |
69 bool internalDrawPath(const SkPath& path, const PathData* pathData, GrDrawTa rget* target); | 77 bool internalDrawPath(const SkPath& path, const PathData* pathData, GrDrawTa rget* target); |
70 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool antiAlias); | 78 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool antiAlias, |
79 uint32_t mipLevel, SkScalar scale); | |
71 bool freeUnusedPlot(); | 80 bool freeUnusedPlot(); |
72 | 81 |
73 typedef GrPathRenderer INHERITED; | 82 typedef GrPathRenderer INHERITED; |
74 }; | 83 }; |
75 | 84 |
76 #endif | 85 #endif |
OLD | NEW |