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