Fix gms placing text in bounds.

In the operation of taking the bounds of (horizontal text) and then
drawing the text within those bounds it is necessary to draw the text at
the origin of the bounds and not at the left edge of the bounds.

Change-Id: I712e1713ca5e0be929b11f526f224141a5310cc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319776
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/gm/variedtext.cpp b/gm/variedtext.cpp
index d96ee49..002c2a8 100644
--- a/gm/variedtext.cpp
+++ b/gm/variedtext.cpp
@@ -95,19 +95,17 @@
             fFont.setSize(fPtSizes[i]);
 
             fFont.measureText(fStrings[i].c_str(), fStrings[i].size(), SkTextEncoding::kUTF8, &r);
-            // safeRect is set of x,y positions where we can draw the string without hitting
-            // the GM's border.
+            // The set of x,y offsets which place the bounding box inside the GM's border.
             SkRect safeRect = SkRect::MakeLTRB(-r.fLeft, -r.fTop, w - r.fRight, h - r.fBottom);
             if (safeRect.isEmpty()) {
-                // If we don't fit then just don't worry about how we get cliped to the device
-                // border.
+                // If the bounds don't fit then allow any offset in the GM's border.
                 safeRect = SkRect::MakeWH(w, h);
             }
-            fPositions[i].fX = random.nextRangeScalar(safeRect.fLeft, safeRect.fRight);
-            fPositions[i].fY = random.nextRangeScalar(safeRect.fTop, safeRect.fBottom);
+            fOffsets[i].fX = random.nextRangeScalar(safeRect.fLeft, safeRect.fRight);
+            fOffsets[i].fY = random.nextRangeScalar(safeRect.fTop, safeRect.fBottom);
 
             fClipRects[i] = r;
-            fClipRects[i].offset(fPositions[i].fX, fPositions[i].fY);
+            fClipRects[i].offset(fOffsets[i].fX, fOffsets[i].fY);
             fClipRects[i].outset(2.f, 2.f);
 
             if (fEffectiveClip) {
@@ -124,7 +122,7 @@
 
             canvas->save();
                 canvas->clipRect(fClipRects[i]);
-                canvas->translate(fPositions[i].fX, fPositions[i].fY);
+                canvas->translate(fOffsets[i].fX, fOffsets[i].fY);
                 canvas->drawSimpleText(fStrings[i].c_str(), fStrings[i].size(), SkTextEncoding::kUTF8,
                                        0, 0, fFont, fPaint);
             canvas->restore();
@@ -160,7 +158,7 @@
     SkColor         fColors[kCnt];
     SkScalar        fPtSizes[kCnt];
     int             fTypefaceIndices[kCnt];
-    SkPoint         fPositions[kCnt];
+    SkPoint         fOffsets[kCnt];
     SkRect          fClipRects[kCnt];
 
     using INHERITED = skiagm::GM;