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