Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: src/gpu/text/GrBatchFontCache.h

Issue 1835283002: Simplify GrDrawBatch uploads and token uage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp ('k') | tests/PrimitiveProcessorTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp ('k') | tests/PrimitiveProcessorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698