OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrAtlasTextBatch_DEFINED | 8 #ifndef GrAtlasTextBatch_DEFINED |
9 #define GrAtlasTextBatch_DEFINED | 9 #define GrAtlasTextBatch_DEFINED |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 protected: | 92 protected: |
93 void computePipelineOptimizations(GrInitInvariantOutput* color, | 93 void computePipelineOptimizations(GrInitInvariantOutput* color, |
94 GrInitInvariantOutput* coverage, | 94 GrInitInvariantOutput* coverage, |
95 GrBatchToXPOverrides* overrides) const ove
rride; | 95 GrBatchToXPOverrides* overrides) const ove
rride; |
96 | 96 |
97 | 97 |
98 private: | 98 private: |
99 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; | 99 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; |
100 | 100 |
101 struct FlushInfo { | 101 struct FlushInfo { |
102 SkAutoTUnref<const GrBuffer> fVertexBuffer; | 102 SkAutoTUnref<const GrBuffer> fVertexBuffer; |
103 SkAutoTUnref<const GrBuffer> fIndexBuffer; | 103 SkAutoTUnref<const GrBuffer> fIndexBuffer; |
104 int fGlyphsToFlush; | 104 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; |
105 int fVertexOffset; | 105 int fGlyphsToFlush; |
| 106 int fVertexOffset; |
106 }; | 107 }; |
107 | 108 |
108 void onPrepareDraws(Target* target) const override; | 109 void onPrepareDraws(Target* target) const override; |
109 | 110 |
110 GrAtlasTextBatch() : INHERITED(ClassID()) {} // initialized in factory funct
ions. | 111 GrAtlasTextBatch() : INHERITED(ClassID()) {} // initialized in factory funct
ions. |
111 | 112 |
112 ~GrAtlasTextBatch() { | 113 ~GrAtlasTextBatch() { |
113 for (int i = 0; i < fGeoCount; i++) { | 114 for (int i = 0; i < fGeoCount; i++) { |
114 fGeoData[i].fBlob->unref(); | 115 fGeoData[i].fBlob->unref(); |
115 } | 116 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 }; | 189 }; |
189 | 190 |
190 /* | 191 /* |
191 * A simple helper class to abstract the interface GrAtlasTextBlob needs to rege
nerate itself. | 192 * A simple helper class to abstract the interface GrAtlasTextBlob needs to rege
nerate itself. |
192 * It'd be nicer if this was nested, but we need to forward declare it in GrAtla
sTextBlob.h | 193 * It'd be nicer if this was nested, but we need to forward declare it in GrAtla
sTextBlob.h |
193 */ | 194 */ |
194 class GrBlobRegenHelper { | 195 class GrBlobRegenHelper { |
195 public: | 196 public: |
196 GrBlobRegenHelper(const GrAtlasTextBatch* batch, | 197 GrBlobRegenHelper(const GrAtlasTextBatch* batch, |
197 GrVertexBatch::Target* target, | 198 GrVertexBatch::Target* target, |
198 GrAtlasTextBatch::FlushInfo* flushInfo, | 199 GrAtlasTextBatch::FlushInfo* flushInfo) |
199 const GrGeometryProcessor* gp) | |
200 : fBatch(batch) | 200 : fBatch(batch) |
201 , fTarget(target) | 201 , fTarget(target) |
202 , fFlushInfo(flushInfo) | 202 , fFlushInfo(flushInfo) {} |
203 , fGP(gp) {} | |
204 | 203 |
205 void flush(); | 204 void flush(); |
206 | 205 |
207 void incGlyphCount(int glyphCount = 1) { | 206 void incGlyphCount(int glyphCount = 1) { |
208 fFlushInfo->fGlyphsToFlush += glyphCount; | 207 fFlushInfo->fGlyphsToFlush += glyphCount; |
209 } | 208 } |
210 | 209 |
211 private: | 210 private: |
212 const GrAtlasTextBatch* fBatch; | 211 const GrAtlasTextBatch* fBatch; |
213 GrVertexBatch::Target* fTarget; | 212 GrVertexBatch::Target* fTarget; |
214 GrAtlasTextBatch::FlushInfo* fFlushInfo; | 213 GrAtlasTextBatch::FlushInfo* fFlushInfo; |
215 const GrGeometryProcessor* fGP; | |
216 }; | 214 }; |
217 | 215 |
218 #endif | 216 #endif |
OLD | NEW |