| OLD | NEW |
| (Empty) |
| 1 | |
| 2 /* | |
| 3 * Copyright 2014 Google Inc. | |
| 4 * | |
| 5 * Use of this source code is governed by a BSD-style license that can be | |
| 6 * found in the LICENSE file. | |
| 7 */ | |
| 8 | |
| 9 #ifndef GrAADistanceFieldPathRenderer_DEFINED | |
| 10 #define GrAADistanceFieldPathRenderer_DEFINED | |
| 11 | |
| 12 #include "GrBatchAtlas.h" | |
| 13 #include "GrPathRenderer.h" | |
| 14 #include "GrRect.h" | |
| 15 | |
| 16 #include "SkChecksum.h" | |
| 17 #include "SkTDynamicHash.h" | |
| 18 | |
| 19 class GrContext; | |
| 20 | |
| 21 class GrAADistanceFieldPathRenderer : public GrPathRenderer { | |
| 22 public: | |
| 23 GrAADistanceFieldPathRenderer(); | |
| 24 virtual ~GrAADistanceFieldPathRenderer(); | |
| 25 | |
| 26 private: | |
| 27 StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const
override { | |
| 28 return GrPathRenderer::kNoSupport_StencilSupport; | |
| 29 } | |
| 30 | |
| 31 bool onCanDrawPath(const CanDrawPathArgs&) const override; | |
| 32 | |
| 33 bool onDrawPath(const DrawPathArgs&) override; | |
| 34 | |
| 35 struct PathData { | |
| 36 struct Key { | |
| 37 uint32_t fGenID; | |
| 38 // rendered size for stored path (32x32 max, 64x64 max, 128x128 max) | |
| 39 uint32_t fDimension; | |
| 40 bool operator==(const Key& other) const { | |
| 41 return other.fGenID == fGenID && other.fDimension == fDimension; | |
| 42 } | |
| 43 }; | |
| 44 Key fKey; | |
| 45 SkScalar fScale; | |
| 46 GrBatchAtlas::AtlasID fID; | |
| 47 SkRect fBounds; | |
| 48 SkIPoint16 fAtlasLocation; | |
| 49 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PathData); | |
| 50 | |
| 51 static inline const Key& GetKey(const PathData& data) { | |
| 52 return data.fKey; | |
| 53 } | |
| 54 | |
| 55 static inline uint32_t Hash(Key key) { | |
| 56 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&key),
sizeof(key)); | |
| 57 } | |
| 58 }; | |
| 59 | |
| 60 static void HandleEviction(GrBatchAtlas::AtlasID, void*); | |
| 61 | |
| 62 typedef SkTDynamicHash<PathData, PathData::Key> PathCache; | |
| 63 typedef SkTInternalLList<PathData> PathDataList; | |
| 64 | |
| 65 GrBatchAtlas* fAtlas; | |
| 66 PathCache fPathCache; | |
| 67 PathDataList fPathList; | |
| 68 | |
| 69 typedef GrPathRenderer INHERITED; | |
| 70 | |
| 71 friend class AADistanceFieldPathBatch; | |
| 72 friend struct PathTestStruct; | |
| 73 }; | |
| 74 | |
| 75 #endif | |
| OLD | NEW |