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 "GrAtlasTextBatch.h" | 8 #include "GrAtlasTextBatch.h" |
9 | 9 |
10 #include "GrBatchFontCache.h" | 10 #include "GrBatchFontCache.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVertices); | 197 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVertices); |
198 vertex += info->vertexStartIndex(); | 198 vertex += info->vertexStartIndex(); |
199 vertex += vertexStride * glyphIdx * GrAtlasTextBatch::kVerticesPerGlyph; | 199 vertex += vertexStride * glyphIdx * GrAtlasTextBatch::kVerticesPerGlyph; |
200 regen_vertices<regenPos, regenCol, regenTexCoords>(vertex, glyph, vertex
Stride, | 200 regen_vertices<regenPos, regenCol, regenTexCoords>(vertex, glyph, vertex
Stride, |
201 this->usesDistanceFie
lds(), transX, | 201 this->usesDistanceFie
lds(), transX, |
202 transY, color); | 202 transY, color); |
203 flushInfo->fGlyphsToFlush++; | 203 flushInfo->fGlyphsToFlush++; |
204 } | 204 } |
205 | 205 |
206 // We my have changed the color so update it here | 206 // We may have changed the color so update it here |
207 run->fColor = color; | 207 info->setColor(color); |
208 if (regenTexCoords) { | 208 if (regenTexCoords) { |
209 if (regenGlyphs) { | 209 if (regenGlyphs) { |
210 info->setStrike(strike); | 210 info->setStrike(strike); |
211 } | 211 } |
212 info->setAtlasGeneration(brokenRun ? GrBatchAtlas::kInvalidAtlasGenerati
on : | 212 info->setAtlasGeneration(brokenRun ? GrBatchAtlas::kInvalidAtlasGenerati
on : |
213 fFontCache->atlasGeneration(this->m
askFormat())); | 213 fFontCache->atlasGeneration(this->m
askFormat())); |
214 } | 214 } |
215 } | 215 } |
216 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 216 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
217 | 217 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 // been abandoned. If it hasn't been abandoned, then we can use the GrG
lyph*s as is | 371 // been abandoned. If it hasn't been abandoned, then we can use the GrG
lyph*s as is |
372 // otherwise we have to get the new strike, and use that to get the corr
ect glyphs. | 372 // otherwise we have to get the new strike, and use that to get the corr
ect glyphs. |
373 // Because we do not have the packed ids, and thus can't look up our gly
phs in the | 373 // Because we do not have the packed ids, and thus can't look up our gly
phs in the |
374 // new strike, we instead keep our ref to the old strike and use the pac
ked ids from | 374 // new strike, we instead keep our ref to the old strike and use the pac
ked ids from |
375 // it. These ids will still be valid as long as we hold the ref. When
we are done | 375 // it. These ids will still be valid as long as we hold the ref. When
we are done |
376 // updating our cache of the GrGlyph*s, we drop our ref on the old strik
e | 376 // updating our cache of the GrGlyph*s, we drop our ref on the old strik
e |
377 bool regenerateGlyphs = info.strike()->isAbandoned(); | 377 bool regenerateGlyphs = info.strike()->isAbandoned(); |
378 bool regenerateTextureCoords = info.atlasGeneration() != currentAtlasGen
|| | 378 bool regenerateTextureCoords = info.atlasGeneration() != currentAtlasGen
|| |
379 regenerateGlyphs; | 379 regenerateGlyphs; |
380 bool regenerateColors = kARGB_GrMaskFormat != maskFormat && | 380 bool regenerateColors = kARGB_GrMaskFormat != maskFormat && |
381 run.fColor != args.fColor; | 381 info.color() != args.fColor; |
382 bool regeneratePositions = args.fTransX != 0.f || args.fTransY != 0.f; | 382 bool regeneratePositions = args.fTransX != 0.f || args.fTransY != 0.f; |
383 int glyphCount = info.glyphCount(); | 383 int glyphCount = info.glyphCount(); |
384 | 384 |
385 uint32_t regenMaskBits = kNoRegen; | 385 uint32_t regenMaskBits = kNoRegen; |
386 regenMaskBits |= regeneratePositions ? kRegenPos : 0; | 386 regenMaskBits |= regeneratePositions ? kRegenPos : 0; |
387 regenMaskBits |= regenerateColors ? kRegenCol : 0; | 387 regenMaskBits |= regenerateColors ? kRegenCol : 0; |
388 regenMaskBits |= regenerateTextureCoords ? kRegenTex : 0; | 388 regenMaskBits |= regenerateTextureCoords ? kRegenTex : 0; |
389 regenMaskBits |= regenerateGlyphs ? kRegenGlyph : 0; | 389 regenMaskBits |= regenerateGlyphs ? kRegenGlyph : 0; |
390 RegenMask regenMask = (RegenMask)regenMaskBits; | 390 RegenMask regenMask = (RegenMask)regenMaskBits; |
391 | 391 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 return GrDistanceFieldA8TextGeoProc::Create(color, | 553 return GrDistanceFieldA8TextGeoProc::Create(color, |
554 viewMatrix, | 554 viewMatrix, |
555 texture, | 555 texture, |
556 params, | 556 params, |
557 flags, | 557 flags, |
558 this->usesLocalCoords()); | 558 this->usesLocalCoords()); |
559 #endif | 559 #endif |
560 } | 560 } |
561 | 561 |
562 } | 562 } |
OLD | NEW |