Make fBrokenRun local to doRegen.

If doRegen is called and fCurrGlyph > 0, this implies that the previous call
to doRegen exited early on a code == GrDrawOpAtlas::ErrorCode::kTryAgain.
We can calculate brokenRun directly from the fact doRegen is called with
fCurrGlyph > 0.

Change-Id: I1ee7b88e59708ae329c2204c1d7779a295cd9d33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262378
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 3c293fb..ea6dfc4 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -913,6 +913,12 @@
         glyphLimit = fCurrGlyph + maxGlyphs;
         result->fFinished = false;
     }
+
+    // If we reach here with fCurrGlyph > 0, some earlier call to regenerate() exhausted the atlas
+    // before it could place all its glyphs and returned kTryAgain.  We'll use brokenRun below to
+    // invalidate texture coordinates, forcing them to be regenerated, minding the atlas
+    // flush between.
+    const bool brokenRun = fCurrGlyph > 0;
     auto code = GrDrawOpAtlas::ErrorCode::kSucceeded;
     for (; fCurrGlyph < glyphLimit; fCurrGlyph++) {
         if (fActions.regenTextureCoordinates) {
@@ -946,18 +952,17 @@
             return false;
         }
         case GrDrawOpAtlas::ErrorCode::kTryAgain: {
-            // 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;
         }
         case GrDrawOpAtlas::ErrorCode::kSucceeded: {
             if (fActions.regenTextureCoordinates) {
+                // if brokenRun, then the previous call to doRegen exited with kTryAgain. This
+                // means that only a portion of the glyphs made it into the atlas, and more must
+                // be processed.
                 fSubRun->fAtlasGeneration =
-                        fBrokenRun ? GrDrawOpAtlas::kInvalidAtlasGeneration
-                                   : fFullAtlasManager->atlasGeneration(fSubRun->maskFormat());
+                        brokenRun ? GrDrawOpAtlas::kInvalidAtlasGeneration
+                                  : fFullAtlasManager->atlasGeneration(fSubRun->maskFormat());
             } else {
                 // For the non-texCoords case we need to ensure that we update the associated
                 // use tokens