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 GrBatchFontCache_DEFINED | 8 #ifndef GrBatchFontCache_DEFINED |
9 #define GrBatchFontCache_DEFINED | 9 #define GrBatchFontCache_DEFINED |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 SkASSERT(glyph); | 136 SkASSERT(glyph); |
137 return this->getAtlas(glyph->fMaskFormat)->hasID(glyph->fID); | 137 return this->getAtlas(glyph->fMaskFormat)->hasID(glyph->fID); |
138 } | 138 } |
139 | 139 |
140 // To ensure the GrBatchAtlas does not evict the Glyph Mask from its texture
backing store, | 140 // To ensure the GrBatchAtlas does not evict the Glyph Mask from its texture
backing store, |
141 // the client must pass in the current batch token along with the GrGlyph. | 141 // the client must pass in the current batch token along with the GrGlyph. |
142 // A BulkUseTokenUpdater is used to manage bulk last use token updating in t
he Atlas. | 142 // A BulkUseTokenUpdater is used to manage bulk last use token updating in t
he Atlas. |
143 // For convenience, this function will also set the use token for the curren
t glyph if required | 143 // For convenience, this function will also set the use token for the curren
t glyph if required |
144 // NOTE: the bulk uploader is only valid if the subrun has a valid atlasGene
ration | 144 // NOTE: the bulk uploader is only valid if the subrun has a valid atlasGene
ration |
145 void addGlyphToBulkAndSetUseToken(GrBatchAtlas::BulkUseTokenUpdater* updater
, | 145 void addGlyphToBulkAndSetUseToken(GrBatchAtlas::BulkUseTokenUpdater* updater
, |
146 GrGlyph* glyph, GrBatchToken token) { | 146 GrGlyph* glyph, GrBatchDrawToken token) { |
147 SkASSERT(glyph); | 147 SkASSERT(glyph); |
148 updater->add(glyph->fID); | 148 updater->add(glyph->fID); |
149 this->getAtlas(glyph->fMaskFormat)->setLastUseToken(glyph->fID, token); | 149 this->getAtlas(glyph->fMaskFormat)->setLastUseToken(glyph->fID, token); |
150 } | 150 } |
151 | 151 |
152 void setUseTokenBulk(const GrBatchAtlas::BulkUseTokenUpdater& updater, | 152 void setUseTokenBulk(const GrBatchAtlas::BulkUseTokenUpdater& updater, |
153 GrBatchToken token, | 153 GrBatchDrawToken token, |
154 GrMaskFormat format) { | 154 GrMaskFormat format) { |
155 this->getAtlas(format)->setLastUseTokenBulk(updater, token); | 155 this->getAtlas(format)->setLastUseTokenBulk(updater, token); |
156 } | 156 } |
157 | 157 |
158 // add to texture atlas that matches this format | 158 // add to texture atlas that matches this format |
159 bool addToAtlas(GrBatchTextStrike* strike, GrBatchAtlas::AtlasID* id, | 159 bool addToAtlas(GrBatchTextStrike* strike, GrBatchAtlas::AtlasID* id, |
160 GrDrawBatch::Target* target, | 160 GrDrawBatch::Target* target, |
161 GrMaskFormat format, int width, int height, const void* imag
e, | 161 GrMaskFormat format, int width, int height, const void* imag
e, |
162 SkIPoint16* loc) { | 162 SkIPoint16* loc) { |
163 fPreserveStrike = strike; | 163 fPreserveStrike = strike; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 static void HandleEviction(GrBatchAtlas::AtlasID, void*); | 222 static void HandleEviction(GrBatchAtlas::AtlasID, void*); |
223 | 223 |
224 GrContext* fContext; | 224 GrContext* fContext; |
225 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; | 225 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; |
226 GrBatchAtlas* fAtlases[kMaskFormatCount]; | 226 GrBatchAtlas* fAtlases[kMaskFormatCount]; |
227 GrBatchTextStrike* fPreserveStrike; | 227 GrBatchTextStrike* fPreserveStrike; |
228 GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; | 228 GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; |
229 }; | 229 }; |
230 | 230 |
231 #endif | 231 #endif |
OLD | NEW |