More attempts at clipping perf.

With the 1.5x allocation strategy, it can take more reallocations
to reach a similar size as before. Increasing this initial size
reduces the number of reallocations. 

Also reduce size of Geometry struct slightly.

Bug: skia:7230
Change-Id: Ied3f275b01b07aa300e0b7e1f24abc5fc3853ea7
Reviewed-on: https://skia-review.googlesource.com/64500
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index f083c85..17f81a2 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -257,7 +257,7 @@
 }
 
 inline std::unique_ptr<GrAtlasTextOp> GrAtlasTextBlob::makeOp(
-        const Run::SubRunInfo& info, int glyphCount, int run, int subRun,
+        const Run::SubRunInfo& info, int glyphCount, uint16_t run, uint16_t subRun,
         const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const SkIRect& clipRect,
         const GrTextUtils::Paint& paint, const SkSurfaceProps& props,
         const GrDistanceFieldAdjustTable* distanceAdjustTable, GrAtlasGlyphCache* cache,
@@ -295,7 +295,12 @@
                                       const GrTextUtils::Paint& paint, const SkSurfaceProps& props,
                                       const GrDistanceFieldAdjustTable* distanceAdjustTable,
                                       GrAtlasGlyphCache* cache) {
-    int lastRun = fRuns[run].fSubRunInfo.count() - 1;
+    // GrAtlasTextBlob::makeOp only takes uint16_t values for run and subRun indices.
+    // Encountering something larger than this is highly unlikely, so we'll just not draw it.
+    if (run >= (1 << 16)) {
+        return;
+    }
+    int lastRun = SkTMin(fRuns[run].fSubRunInfo.count(), 1 << 16) - 1;
     for (int subRun = 0; subRun <= lastRun; subRun++) {
         const Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun];
         int glyphCount = info.glyphCount();
@@ -451,8 +456,8 @@
 }
 
 std::unique_ptr<GrDrawOp> GrAtlasTextBlob::test_makeOp(
-        int glyphCount, int run, int subRun, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
-        const GrTextUtils::Paint& paint, const SkSurfaceProps& props,
+        int glyphCount, uint16_t run, uint16_t subRun, const SkMatrix& viewMatrix,
+        SkScalar x, SkScalar y, const GrTextUtils::Paint& paint, const SkSurfaceProps& props,
         const GrDistanceFieldAdjustTable* distanceAdjustTable, GrAtlasGlyphCache* cache,
         GrTextUtils::Target* target) {
     const GrAtlasTextBlob::Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun];