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 #include "GrBatchFontCache.h" | 8 #include "GrBatchFontCache.h" |
9 #include "GrFontAtlasSizes.h" | 9 #include "GrFontAtlasSizes.h" |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 int atlasIndex = MaskFormatToAtlasIndex(format); | 121 int atlasIndex = MaskFormatToAtlasIndex(format); |
122 SkASSERT(fAtlases[atlasIndex]); | 122 SkASSERT(fAtlases[atlasIndex]); |
123 return fAtlases[atlasIndex]; | 123 return fAtlases[atlasIndex]; |
124 } | 124 } |
125 | 125 |
126 bool GrBatchFontCache::hasGlyph(GrGlyph* glyph) { | 126 bool GrBatchFontCache::hasGlyph(GrGlyph* glyph) { |
127 SkASSERT(glyph); | 127 SkASSERT(glyph); |
128 return this->getAtlas(glyph->fMaskFormat)->hasID(glyph->fID); | 128 return this->getAtlas(glyph->fMaskFormat)->hasID(glyph->fID); |
129 } | 129 } |
130 | 130 |
131 void GrBatchFontCache::setGlyphRefToken(GrGlyph* glyph, GrBatchAtlas::BatchToken
batchToken) { | 131 void GrBatchFontCache::addGlyphToBulkAndSetUseToken(GrBatchAtlas::BulkUseTokenUp
dater* updater, |
| 132 GrGlyph* glyph, |
| 133 GrBatchAtlas::BatchToken tok
en) { |
132 SkASSERT(glyph); | 134 SkASSERT(glyph); |
133 SkASSERT(this->getAtlas(glyph->fMaskFormat)->hasID(glyph->fID)); | 135 updater->add(glyph->fID); |
134 this->getAtlas(glyph->fMaskFormat)->setLastRefToken(glyph->fID, batchToken); | 136 this->getAtlas(glyph->fMaskFormat)->setLastUseToken(glyph->fID, token); |
| 137 } |
| 138 |
| 139 void GrBatchFontCache::setUseTokenBulk(const GrBatchAtlas::BulkUseTokenUpdater&
updater, |
| 140 GrBatchAtlas::BatchToken token, |
| 141 GrMaskFormat format) { |
| 142 this->getAtlas(format)->setLastUseTokenBulk(updater, token); |
135 } | 143 } |
136 | 144 |
137 bool GrBatchFontCache::addToAtlas(GrBatchTextStrike* strike, GrBatchAtlas::Atlas
ID* id, | 145 bool GrBatchFontCache::addToAtlas(GrBatchTextStrike* strike, GrBatchAtlas::Atlas
ID* id, |
138 GrBatchTarget* batchTarget, | 146 GrBatchTarget* batchTarget, |
139 GrMaskFormat format, int width, int height, co
nst void* image, | 147 GrMaskFormat format, int width, int height, co
nst void* image, |
140 SkIPoint16* loc) { | 148 SkIPoint16* loc) { |
141 fPreserveStrike = strike; | 149 fPreserveStrike = strike; |
142 return this->getAtlas(format)->addToAtlas(id, batchTarget, width, height, im
age, loc); | 150 return this->getAtlas(format)->addToAtlas(id, batchTarget, width, height, im
age, loc); |
143 } | 151 } |
144 | 152 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } | 313 } |
306 | 314 |
307 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, batchTarget, g
lyph->fMaskFormat, | 315 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, batchTarget, g
lyph->fMaskFormat, |
308 glyph->width(), glyph->height(), | 316 glyph->width(), glyph->height(), |
309 storage.get(), &glyph->fAtlasLoca
tion); | 317 storage.get(), &glyph->fAtlasLoca
tion); |
310 if (success) { | 318 if (success) { |
311 fAtlasedGlyphs++; | 319 fAtlasedGlyphs++; |
312 } | 320 } |
313 return success; | 321 return success; |
314 } | 322 } |
OLD | NEW |