Use fCurrGlyph as the looping variable.

This clarifies the code instead of keeping fCurrGlyph and
glyphIdx in sync.

Change-Id: I2746eac3c681d14a1cb0eb73b91de920b5e6fbbc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262151
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2020-01-03 17:15:08 -05:00 committed by Skia Commit-Bot
parent bdeff3d7d9
commit f1b42a219f

View File

@ -908,10 +908,9 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
char* currVertex = fSubRun->fVertexData.data() + fCurrGlyph * kVerticesPerGlyph * vertexStride;
result->fFirstVertex = currVertex;
for (int glyphIdx = fCurrGlyph; glyphIdx < (int)fSubRun->fGlyphs.size(); glyphIdx++) {
GrGlyph* glyph = nullptr;
for (; fCurrGlyph < (int)fSubRun->fGlyphs.size(); fCurrGlyph++) {
if (fActions.regenTextureCoordinates) {
glyph = fSubRun->fGlyphs[glyphIdx];
GrGlyph* glyph = fSubRun->fGlyphs[fCurrGlyph];
SkASSERT(glyph && glyph->fMaskFormat == fSubRun->maskFormat());
if (!fFullAtlasManager->hasGlyph(glyph)) {
@ -923,7 +922,10 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
return false;
}
else if (GrDrawOpAtlas::ErrorCode::kTryAgain == code) {
fBrokenRun = glyphIdx > 0;
// If fCurrGlyph == 0, then no glyphs from this SubRun were put into the atlas,
// otherwise at least one glyph made it into the atlas, and this run needs
// special handling because of the atlas flush in the middle of it.
fBrokenRun = fCurrGlyph > 0;
result->fFinished = false;
return true;
}
@ -934,12 +936,11 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
}
if (fActions.regenTextureCoordinates) {
fSubRun->updateTexCoord(glyphIdx);
fSubRun->updateTexCoord(fCurrGlyph);
}
currVertex += vertexStride * GrAtlasTextOp::kVerticesPerGlyph;
++result->fGlyphsRegenerated;
++fCurrGlyph;
}
if (fActions.regenTextureCoordinates) {