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 #include "SkTDynamicHash.h" | 18 #include "SkTDynamicHash.h" |
19 | 19 |
20 class GrContext; | 20 class GrContext; |
21 class GrPlot; | 21 class GrPlot; |
22 | 22 |
23 class GrAADistanceFieldPathRenderer : public GrPathRenderer { | 23 class GrAADistanceFieldPathRenderer : public GrPathRenderer { |
24 public: | 24 public: |
25 GrAADistanceFieldPathRenderer(GrContext* context); | 25 GrAADistanceFieldPathRenderer(GrContext* context); |
26 virtual ~GrAADistanceFieldPathRenderer(); | 26 virtual ~GrAADistanceFieldPathRenderer(); |
27 | 27 |
28 virtual bool canDrawPath(const SkPath& path, | 28 virtual bool canDrawPath(const GrDrawTarget*, |
29 const SkStrokeRec& stroke, | 29 const GrDrawState*, |
30 const GrDrawTarget* target, | 30 const SkPath&, |
| 31 const SkStrokeRec&, |
31 bool antiAlias) const SK_OVERRIDE; | 32 bool antiAlias) const SK_OVERRIDE; |
32 | 33 |
33 protected: | 34 protected: |
34 virtual StencilSupport onGetStencilSupport(const SkPath&, | 35 virtual StencilSupport onGetStencilSupport(const GrDrawTarget*, |
35 const SkStrokeRec&, | 36 const GrDrawState*, |
36 const GrDrawTarget*) const SK_OVE
RRIDE; | 37 const SkPath&, |
| 38 const SkStrokeRec&) const SK_OVER
RIDE; |
37 | 39 |
38 virtual bool onDrawPath(const SkPath& path, | 40 virtual bool onDrawPath(GrDrawTarget*, |
39 const SkStrokeRec& stroke, | 41 GrDrawState*, |
40 GrDrawTarget* target, | 42 const SkPath&, |
| 43 const SkStrokeRec&, |
41 bool antiAlias) SK_OVERRIDE; | 44 bool antiAlias) SK_OVERRIDE; |
42 | 45 |
43 private: | 46 private: |
44 struct PathData { | 47 struct PathData { |
45 struct Key { | 48 struct Key { |
46 uint32_t fGenID; | 49 uint32_t fGenID; |
47 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) | 50 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) |
48 uint32_t fDimension; | 51 uint32_t fDimension; |
49 bool operator==(const Key& other) const { | 52 bool operator==(const Key& other) const { |
50 return other.fGenID == fGenID && other.fDimension == fDimension; | 53 return other.fGenID == fGenID && other.fDimension == fDimension; |
(...skipping 18 matching lines...) Expand all Loading... |
69 | 72 |
70 GrContext* fContext; | 73 GrContext* fContext; |
71 GrAtlas* fAtlas; | 74 GrAtlas* fAtlas; |
72 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; | 75 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; |
73 // current set of flags used to create the cached geometry processor | 76 // current set of flags used to create the cached geometry processor |
74 uint32_t fEffectFlags; | 77 uint32_t fEffectFlags; |
75 GrAtlas::ClientPlotUsage fPlotUsage; | 78 GrAtlas::ClientPlotUsage fPlotUsage; |
76 SkTDynamicHash<PathData, PathData::Key> fPathCache; | 79 SkTDynamicHash<PathData, PathData::Key> fPathCache; |
77 PathDataList fPathList; | 80 PathDataList fPathList; |
78 | 81 |
79 bool internalDrawPath(const SkPath& path, const PathData* pathData, GrDrawTa
rget* target); | 82 bool internalDrawPath(GrDrawTarget*, GrDrawState*, const SkPath& path, |
| 83 const PathData* pathData); |
80 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool
antiAlias, | 84 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool
antiAlias, |
81 uint32_t dimension, SkScalar scale); | 85 uint32_t dimension, SkScalar scale); |
82 bool freeUnusedPlot(); | 86 bool freeUnusedPlot(); |
83 | 87 |
84 typedef GrPathRenderer INHERITED; | 88 typedef GrPathRenderer INHERITED; |
85 }; | 89 }; |
86 | 90 |
87 #endif | 91 #endif |
OLD | NEW |