OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrPathRange_DEFINED | 8 #ifndef GrPathRange_DEFINED |
9 #define GrPathRange_DEFINED | 9 #define GrPathRange_DEFINED |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 * Initialize an eager-loaded path range. The subclass is responsible for en
suring all | 65 * Initialize an eager-loaded path range. The subclass is responsible for en
suring all |
66 * the paths are initialized up front. | 66 * the paths are initialized up front. |
67 */ | 67 */ |
68 GrPathRange(GrGpu*, int numPaths); | 68 GrPathRange(GrGpu*, int numPaths); |
69 | 69 |
70 int getNumPaths() const { return fNumPaths; } | 70 int getNumPaths() const { return fNumPaths; } |
71 const PathGenerator* getPathGenerator() const { return fPathGenerator.get();
} | 71 const PathGenerator* getPathGenerator() const { return fPathGenerator.get();
} |
72 | 72 |
73 #ifdef SK_DEBUG | 73 #ifdef SK_DEBUG |
74 virtual bool isEqualTo(const SkDescriptor& desc) const { | 74 virtual bool isEqualTo(const SkDescriptor& desc) const { |
75 return NULL != fPathGenerator.get() && fPathGenerator->isEqualTo(desc); | 75 return nullptr != fPathGenerator.get() && fPathGenerator->isEqualTo(desc
); |
76 } | 76 } |
77 #endif | 77 #endif |
78 protected: | 78 protected: |
79 // Initialize a path in the range before drawing. This is only called when | 79 // Initialize a path in the range before drawing. This is only called when |
80 // fPathGenerator is non-null. The child class need not call didChangeGpuMem
orySize(), | 80 // fPathGenerator is non-null. The child class need not call didChangeGpuMem
orySize(), |
81 // GrPathRange will take care of that after the call is complete. | 81 // GrPathRange will take care of that after the call is complete. |
82 virtual void onInitPath(int index, const SkPath&) const = 0; | 82 virtual void onInitPath(int index, const SkPath&) const = 0; |
83 | 83 |
84 private: | 84 private: |
85 // Notify when paths will be drawn in case this is a lazy-loaded path range. | 85 // Notify when paths will be drawn in case this is a lazy-loaded path range. |
86 friend class GrPathRendering; | 86 friend class GrPathRendering; |
87 void willDrawPaths(const void* indices, PathIndexType, int count) const; | 87 void willDrawPaths(const void* indices, PathIndexType, int count) const; |
88 template<typename IndexType> void willDrawPaths(const void* indices, int cou
nt) const; | 88 template<typename IndexType> void willDrawPaths(const void* indices, int cou
nt) const; |
89 | 89 |
90 mutable SkAutoTUnref<PathGenerator> fPathGenerator; | 90 mutable SkAutoTUnref<PathGenerator> fPathGenerator; |
91 mutable SkTArray<uint8_t, true /*MEM_COPY*/> fGeneratedPaths; | 91 mutable SkTArray<uint8_t, true /*MEM_COPY*/> fGeneratedPaths; |
92 const int fNumPaths; | 92 const int fNumPaths; |
93 | 93 |
94 typedef GrGpuResource INHERITED; | 94 typedef GrGpuResource INHERITED; |
95 }; | 95 }; |
96 | 96 |
97 #endif | 97 #endif |
OLD | NEW |