Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f1b42a2

Browse files
herbderbySkia Commit-Bot
authored andcommitted
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>
1 parent bdeff3d commit f1b42a2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/gpu/text/GrTextBlob.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -908,10 +908,9 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
908908
char* currVertex = fSubRun->fVertexData.data() + fCurrGlyph * kVerticesPerGlyph * vertexStride;
909909
result->fFirstVertex = currVertex;
910910

911-
for (int glyphIdx = fCurrGlyph; glyphIdx < (int)fSubRun->fGlyphs.size(); glyphIdx++) {
912-
GrGlyph* glyph = nullptr;
911+
for (; fCurrGlyph < (int)fSubRun->fGlyphs.size(); fCurrGlyph++) {
913912
if (fActions.regenTextureCoordinates) {
914-
glyph = fSubRun->fGlyphs[glyphIdx];
913+
GrGlyph* glyph = fSubRun->fGlyphs[fCurrGlyph];
915914
SkASSERT(glyph && glyph->fMaskFormat == fSubRun->maskFormat());
916915

917916
if (!fFullAtlasManager->hasGlyph(glyph)) {
@@ -923,7 +922,10 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
923922
return false;
924923
}
925924
else if (GrDrawOpAtlas::ErrorCode::kTryAgain == code) {
926-
fBrokenRun = glyphIdx > 0;
925+
// If fCurrGlyph == 0, then no glyphs from this SubRun were put into the atlas,
926+
// otherwise at least one glyph made it into the atlas, and this run needs
927+
// special handling because of the atlas flush in the middle of it.
928+
fBrokenRun = fCurrGlyph > 0;
927929
result->fFinished = false;
928930
return true;
929931
}
@@ -934,12 +936,11 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
934936
}
935937

936938
if (fActions.regenTextureCoordinates) {
937-
fSubRun->updateTexCoord(glyphIdx);
939+
fSubRun->updateTexCoord(fCurrGlyph);
938940
}
939941

940942
currVertex += vertexStride * GrAtlasTextOp::kVerticesPerGlyph;
941943
++result->fGlyphsRegenerated;
942-
++fCurrGlyph;
943944
}
944945

945946
if (fActions.regenTextureCoordinates) {

0 commit comments

Comments
 (0)