| 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 "GrBatchAtlas.h" | 12 #include "GrBatchAtlas.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 | 20 |
| 21 class GrAADistanceFieldPathRenderer : public GrPathRenderer { | 21 class GrAADistanceFieldPathRenderer : public GrPathRenderer { |
| 22 public: | 22 public: |
| 23 GrAADistanceFieldPathRenderer(GrContext* context); | 23 GrAADistanceFieldPathRenderer(); |
| 24 virtual ~GrAADistanceFieldPathRenderer(); | 24 virtual ~GrAADistanceFieldPathRenderer(); |
| 25 | |
| 26 virtual bool canDrawPath(const GrDrawTarget*, | |
| 27 const GrPipelineBuilder*, | |
| 28 const SkMatrix& viewMatrix, | |
| 29 const SkPath&, | |
| 30 const GrStrokeInfo&, | |
| 31 bool antiAlias) const override; | |
| 32 | |
| 33 protected: | |
| 34 virtual StencilSupport onGetStencilSupport(const GrDrawTarget*, | |
| 35 const GrPipelineBuilder*, | |
| 36 const SkPath&, | |
| 37 const GrStrokeInfo&) const overri
de; | |
| 38 | |
| 39 virtual bool onDrawPath(GrDrawTarget*, | |
| 40 GrPipelineBuilder*, | |
| 41 GrColor, | |
| 42 const SkMatrix& viewMatrix, | |
| 43 const SkPath&, | |
| 44 const GrStrokeInfo&, | |
| 45 bool antiAlias) override; | |
| 46 | 25 |
| 47 private: | 26 private: |
| 27 StencilSupport onGetStencilSupport(const GrDrawTarget*, |
| 28 const GrPipelineBuilder*, |
| 29 const SkPath&, |
| 30 const GrStrokeInfo&) const override; |
| 31 |
| 32 bool onCanDrawPath(const CanDrawPathArgs&) const override; |
| 33 |
| 34 bool onDrawPath(const DrawPathArgs&) override; |
| 35 |
| 48 struct PathData { | 36 struct PathData { |
| 49 struct Key { | 37 struct Key { |
| 50 uint32_t fGenID; | 38 uint32_t fGenID; |
| 51 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) | 39 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) |
| 52 uint32_t fDimension; | 40 uint32_t fDimension; |
| 53 bool operator==(const Key& other) const { | 41 bool operator==(const Key& other) const { |
| 54 return other.fGenID == fGenID && other.fDimension == fDimension; | 42 return other.fGenID == fGenID && other.fDimension == fDimension; |
| 55 } | 43 } |
| 56 }; | 44 }; |
| 57 Key fKey; | 45 Key fKey; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 static inline uint32_t Hash(Key key) { | 56 static inline uint32_t Hash(Key key) { |
| 69 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&key),
sizeof(key)); | 57 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&key),
sizeof(key)); |
| 70 } | 58 } |
| 71 }; | 59 }; |
| 72 | 60 |
| 73 static void HandleEviction(GrBatchAtlas::AtlasID, void*); | 61 static void HandleEviction(GrBatchAtlas::AtlasID, void*); |
| 74 | 62 |
| 75 typedef SkTDynamicHash<PathData, PathData::Key> PathCache; | 63 typedef SkTDynamicHash<PathData, PathData::Key> PathCache; |
| 76 typedef SkTInternalLList<PathData> PathDataList; | 64 typedef SkTInternalLList<PathData> PathDataList; |
| 77 | 65 |
| 78 GrContext* fContext; | |
| 79 GrBatchAtlas* fAtlas; | 66 GrBatchAtlas* fAtlas; |
| 80 PathCache fPathCache; | 67 PathCache fPathCache; |
| 81 PathDataList fPathList; | 68 PathDataList fPathList; |
| 82 | 69 |
| 83 typedef GrPathRenderer INHERITED; | 70 typedef GrPathRenderer INHERITED; |
| 84 | 71 |
| 85 friend class AADistanceFieldPathBatch; | 72 friend class AADistanceFieldPathBatch; |
| 86 friend struct PathTestStruct; | 73 friend struct PathTestStruct; |
| 87 }; | 74 }; |
| 88 | 75 |
| 89 #endif | 76 #endif |
| OLD | NEW |