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 |
11 | 11 |
12 #include "GrAllocPool.h" | 12 #include "GrAllocPool.h" |
13 #include "GrAtlas.h" | 13 #include "GrAtlas.h" |
14 #include "GrPathRenderer.h" | 14 #include "GrPathRenderer.h" |
15 #include "GrRect.h" | 15 #include "GrRect.h" |
16 | 16 |
17 #include "SkChecksum.h" | 17 #include "SkChecksum.h" |
18 | 18 |
19 class GrContext; | 19 class GrContext; |
20 class GrPlot; | 20 class GrPlot; |
21 | 21 |
22 class GrAADistanceFieldPathRenderer : public GrPathRenderer { | 22 class GrAADistanceFieldPathRenderer : public GrPathRenderer { |
23 public: | 23 public: |
24 GrAADistanceFieldPathRenderer(GrContext* context) | 24 GrAADistanceFieldPathRenderer(GrContext* context); |
25 : fContext(context) | |
26 , fAtlas(NULL) { | |
27 } | |
28 | |
29 virtual ~GrAADistanceFieldPathRenderer(); | 25 virtual ~GrAADistanceFieldPathRenderer(); |
30 | 26 |
31 virtual bool canDrawPath(const SkPath& path, | 27 virtual bool canDrawPath(const SkPath& path, |
32 const SkStrokeRec& stroke, | 28 const SkStrokeRec& stroke, |
33 const GrDrawTarget* target, | 29 const GrDrawTarget* target, |
34 bool antiAlias) const SK_OVERRIDE; | 30 bool antiAlias) const SK_OVERRIDE; |
35 | 31 |
36 protected: | 32 protected: |
37 virtual StencilSupport onGetStencilSupport(const SkPath&, | 33 virtual StencilSupport onGetStencilSupport(const SkPath&, |
38 const SkStrokeRec&, | 34 const SkStrokeRec&, |
(...skipping 17 matching lines...) Expand all Loading... |
56 } | 52 } |
57 | 53 |
58 static inline uint32_t Hash(uint32_t key) { | 54 static inline uint32_t Hash(uint32_t key) { |
59 return SkChecksum::Murmur3(&key, sizeof(key)); | 55 return SkChecksum::Murmur3(&key, sizeof(key)); |
60 } | 56 } |
61 }; | 57 }; |
62 typedef SkTInternalLList<PathData> PathDataList; | 58 typedef SkTInternalLList<PathData> PathDataList; |
63 | 59 |
64 GrContext* fContext; | 60 GrContext* fContext; |
65 GrAtlas* fAtlas; | 61 GrAtlas* fAtlas; |
| 62 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; |
| 63 // current set of flags used to create the cached geometry processor |
| 64 uint32_t fEffectFlags; |
66 GrAtlas::ClientPlotUsage fPlotUsage; | 65 GrAtlas::ClientPlotUsage fPlotUsage; |
67 SkTDynamicHash<PathData, uint32_t> fPathCache; | 66 SkTDynamicHash<PathData, uint32_t> fPathCache; |
68 PathDataList fPathList; | 67 PathDataList fPathList; |
69 | 68 |
70 bool internalDrawPath(const SkPath& path, const PathData* pathData, GrDrawTa
rget* target); | 69 bool internalDrawPath(const SkPath& path, const PathData* pathData, GrDrawTa
rget* target); |
71 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool
antiAlias); | 70 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool
antiAlias); |
72 bool freeUnusedPlot(); | 71 bool freeUnusedPlot(); |
73 | 72 |
74 typedef GrPathRenderer INHERITED; | 73 typedef GrPathRenderer INHERITED; |
75 }; | 74 }; |
76 | 75 |
77 #endif | 76 #endif |
OLD | NEW |