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 "GrAtlas.h" | 12 #include "GrAtlas.h" |
13 #include "GrPathRenderer.h" | 13 #include "GrPathRenderer.h" |
14 #include "GrRect.h" | 14 #include "GrRect.h" |
15 | 15 |
16 #include "SkChecksum.h" | 16 #include "SkChecksum.h" |
17 #include "SkTDynamicHash.h" | 17 #include "SkTDynamicHash.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 virtual ~GrAADistanceFieldPathRenderer(); | 25 virtual ~GrAADistanceFieldPathRenderer(); |
26 | 26 |
27 virtual bool canDrawPath(const GrDrawTarget*, | 27 virtual bool canDrawPath(const GrDrawTarget*, |
28 const GrDrawState*, | 28 const GrDrawState*, |
| 29 const SkMatrix& viewMatrix, |
29 const SkPath&, | 30 const SkPath&, |
30 const SkStrokeRec&, | 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 GrDrawTarget*, | 35 virtual StencilSupport onGetStencilSupport(const GrDrawTarget*, |
35 const GrDrawState*, | 36 const GrDrawState*, |
36 const SkPath&, | 37 const SkPath&, |
37 const SkStrokeRec&) const SK_OVER
RIDE; | 38 const SkStrokeRec&) const SK_OVER
RIDE; |
38 | 39 |
39 virtual bool onDrawPath(GrDrawTarget*, | 40 virtual bool onDrawPath(GrDrawTarget*, |
40 GrDrawState*, | 41 GrDrawState*, |
41 GrColor, | 42 GrColor, |
| 43 const SkMatrix& viewMatrix, |
42 const SkPath&, | 44 const SkPath&, |
43 const SkStrokeRec&, | 45 const SkStrokeRec&, |
44 bool antiAlias) SK_OVERRIDE; | 46 bool antiAlias) SK_OVERRIDE; |
45 | 47 |
46 private: | 48 private: |
47 struct PathData { | 49 struct PathData { |
48 struct Key { | 50 struct Key { |
49 uint32_t fGenID; | 51 uint32_t fGenID; |
50 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) | 52 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) |
51 uint32_t fDimension; | 53 uint32_t fDimension; |
(...skipping 20 matching lines...) Expand all Loading... |
72 | 74 |
73 GrContext* fContext; | 75 GrContext* fContext; |
74 GrAtlas* fAtlas; | 76 GrAtlas* fAtlas; |
75 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; | 77 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor; |
76 // current set of flags used to create the cached geometry processor | 78 // current set of flags used to create the cached geometry processor |
77 uint32_t fEffectFlags; | 79 uint32_t fEffectFlags; |
78 GrAtlas::ClientPlotUsage fPlotUsage; | 80 GrAtlas::ClientPlotUsage fPlotUsage; |
79 SkTDynamicHash<PathData, PathData::Key> fPathCache; | 81 SkTDynamicHash<PathData, PathData::Key> fPathCache; |
80 PathDataList fPathList; | 82 PathDataList fPathList; |
81 | 83 |
82 bool internalDrawPath(GrDrawTarget*, GrDrawState*, GrColor, const SkPath& pa
th, | 84 bool internalDrawPath(GrDrawTarget*, GrDrawState*, GrColor, const SkMatrix&
viewMatrix, |
83 const PathData* pathData); | 85 const SkPath& path, const PathData* pathData); |
84 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool
antiAlias, | 86 PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool
antiAlias, |
85 uint32_t dimension, SkScalar scale); | 87 uint32_t dimension, SkScalar scale); |
86 bool freeUnusedPlot(); | 88 bool freeUnusedPlot(); |
87 | 89 |
88 typedef GrPathRenderer INHERITED; | 90 typedef GrPathRenderer INHERITED; |
89 }; | 91 }; |
90 | 92 |
91 #endif | 93 #endif |
OLD | NEW |