Move RandomColor and RandomCoverage into GrTest.

These were declared as inline functions outside of the GrTest namespace
for some reason, but they are only used in test code and there doesn't
seem to be any reason for putting them in the header. (It doesn't seem
like they would benefit from being inlined.)

Change-Id: I4ba831168a0220d2eb550e08600159ba68220848
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440519
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 27c0965..2bb0051 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -264,11 +264,11 @@
         flags |= kLocalCoordAttribute_GPFlag;
     }
 
-    GrColor color = GrRandomColor(d->fRandom);
+    GrColor color = GrTest::RandomColor(d->fRandom);
     SkMatrix viewMtx = GrTest::TestMatrix(d->fRandom);
     SkMatrix localMtx = GrTest::TestMatrix(d->fRandom);
     bool readsLocalCoords = d->fRandom->nextBool();
-    uint8_t coverage = GrRandomCoverage(d->fRandom);
+    uint8_t coverage = GrTest::RandomCoverage(d->fRandom);
     return DefaultGeoProc::Make(d->allocator(),
                                 flags,
                                 SkPMColor4f::FromBytes_RGBA(color),
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index 328f664..f882252 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -351,6 +351,67 @@
 
 TestAsFPArgs::~TestAsFPArgs() {}
 
+GrColor RandomColor(SkRandom* random) {
+    // There are only a few cases of random colors which interest us
+    enum ColorMode {
+        kAllOnes_ColorMode,
+        kAllZeros_ColorMode,
+        kAlphaOne_ColorMode,
+        kRandom_ColorMode,
+        kLast_ColorMode = kRandom_ColorMode
+    };
+
+    ColorMode colorMode = ColorMode(random->nextULessThan(kLast_ColorMode + 1));
+    GrColor color SK_INIT_TO_AVOID_WARNING;
+    switch (colorMode) {
+        case kAllOnes_ColorMode:
+            color = GrColorPackRGBA(0xFF, 0xFF, 0xFF, 0xFF);
+            break;
+        case kAllZeros_ColorMode:
+            color = GrColorPackRGBA(0, 0, 0, 0);
+            break;
+        case kAlphaOne_ColorMode:
+            color = GrColorPackRGBA(random->nextULessThan(256),
+                                    random->nextULessThan(256),
+                                    random->nextULessThan(256),
+                                    0xFF);
+            break;
+        case kRandom_ColorMode: {
+                uint8_t alpha = random->nextULessThan(256);
+                color = GrColorPackRGBA(random->nextRangeU(0, alpha),
+                                        random->nextRangeU(0, alpha),
+                                        random->nextRangeU(0, alpha),
+                                        alpha);
+            break;
+        }
+    }
+    return color;
+}
+
+uint8_t RandomCoverage(SkRandom* random) {
+    enum CoverageMode {
+        kZero_CoverageMode,
+        kAllOnes_CoverageMode,
+        kRandom_CoverageMode,
+        kLast_CoverageMode = kRandom_CoverageMode
+    };
+
+    CoverageMode colorMode = CoverageMode(random->nextULessThan(kLast_CoverageMode + 1));
+    uint8_t coverage SK_INIT_TO_AVOID_WARNING;
+    switch (colorMode) {
+        case kZero_CoverageMode:
+            coverage = 0;
+            break;
+        case kAllOnes_CoverageMode:
+            coverage = 0xff;
+            break;
+        case kRandom_CoverageMode:
+            coverage = random->nextULessThan(256);
+            break;
+    }
+    return coverage;
+}
+
 }  // namespace GrTest
 
 #endif
diff --git a/src/gpu/GrTestUtils.h b/src/gpu/GrTestUtils.h
index 59575e4..75b7dc2 100644
--- a/src/gpu/GrTestUtils.h
+++ b/src/gpu/GrTestUtils.h
@@ -53,6 +53,9 @@
 sk_sp<SkColorSpace> TestColorSpace(SkRandom*);
 sk_sp<GrColorSpaceXform> TestColorXform(SkRandom*);
 
+GrColor RandomColor(SkRandom* random);
+uint8_t RandomCoverage(SkRandom* random);
+
 class TestAsFPArgs {
 public:
     TestAsFPArgs(GrProcessorTestData*);
@@ -96,66 +99,5 @@
 
 }  // namespace GrTest
 
-static inline GrColor GrRandomColor(SkRandom* random) {
-    // There are only a few cases of random colors which interest us
-    enum ColorMode {
-        kAllOnes_ColorMode,
-        kAllZeros_ColorMode,
-        kAlphaOne_ColorMode,
-        kRandom_ColorMode,
-        kLast_ColorMode = kRandom_ColorMode
-    };
-
-    ColorMode colorMode = ColorMode(random->nextULessThan(kLast_ColorMode + 1));
-    GrColor color SK_INIT_TO_AVOID_WARNING;
-    switch (colorMode) {
-        case kAllOnes_ColorMode:
-            color = GrColorPackRGBA(0xFF, 0xFF, 0xFF, 0xFF);
-            break;
-        case kAllZeros_ColorMode:
-            color = GrColorPackRGBA(0, 0, 0, 0);
-            break;
-        case kAlphaOne_ColorMode:
-            color = GrColorPackRGBA(random->nextULessThan(256),
-                                    random->nextULessThan(256),
-                                    random->nextULessThan(256),
-                                    0xFF);
-            break;
-        case kRandom_ColorMode: {
-                uint8_t alpha = random->nextULessThan(256);
-                color = GrColorPackRGBA(random->nextRangeU(0, alpha),
-                                        random->nextRangeU(0, alpha),
-                                        random->nextRangeU(0, alpha),
-                                        alpha);
-            break;
-        }
-    }
-    return color;
-}
-
-static inline uint8_t GrRandomCoverage(SkRandom* random) {
-    enum CoverageMode {
-        kZero_CoverageMode,
-        kAllOnes_CoverageMode,
-        kRandom_CoverageMode,
-        kLast_CoverageMode = kRandom_CoverageMode
-    };
-
-    CoverageMode colorMode = CoverageMode(random->nextULessThan(kLast_CoverageMode + 1));
-    uint8_t coverage SK_INIT_TO_AVOID_WARNING;
-    switch (colorMode) {
-        case kZero_CoverageMode:
-            coverage = 0;
-            break;
-        case kAllOnes_CoverageMode:
-            coverage = 0xff;
-            break;
-        case kRandom_CoverageMode:
-            coverage = random->nextULessThan(256);
-            break;
-    }
-    return coverage;
-}
-
 #endif
 #endif
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 150992b..7648aff 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -186,7 +186,7 @@
 
 #if GR_TEST_UTILS
 GrGeometryProcessor* GrConicEffect::TestCreate(GrProcessorTestData* d) {
-    GrColor color = GrRandomColor(d->fRandom);
+    GrColor color = GrTest::RandomColor(d->fRandom);
     SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom);
     SkMatrix localMatrix = GrTest::TestMatrix(d->fRandom);
     bool usesLocalCoords = d->fRandom->nextBool();
@@ -341,7 +341,7 @@
 
 #if GR_TEST_UTILS
 GrGeometryProcessor* GrQuadEffect::TestCreate(GrProcessorTestData* d) {
-    GrColor color = GrRandomColor(d->fRandom);
+    GrColor color = GrTest::RandomColor(d->fRandom);
     SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom);
     SkMatrix localMatrix = GrTest::TestMatrix(d->fRandom);
     bool usesLocalCoords = d->fRandom->nextBool();
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 1603e8d..e0f2a2a 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -221,7 +221,7 @@
             break;
     }
 
-    GrColor color = GrRandomColor(d->fRandom);
+    GrColor color = GrTest::RandomColor(d->fRandom);
     bool wideColor = d->fRandom->nextBool();
     SkMatrix localMatrix = GrTest::TestMatrix(d->fRandom);
     bool usesW = d->fRandom->nextBool();
diff --git a/src/gpu/ops/DefaultPathRenderer.cpp b/src/gpu/ops/DefaultPathRenderer.cpp
index 6b07cac..2f69421 100644
--- a/src/gpu/ops/DefaultPathRenderer.cpp
+++ b/src/gpu/ops/DefaultPathRenderer.cpp
@@ -598,7 +598,7 @@
     SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bounds);
 
     viewMatrix.mapRect(&bounds);
-    uint8_t coverage = GrRandomCoverage(random);
+    uint8_t coverage = GrTest::RandomCoverage(random);
     GrAAType aaType = GrAAType::kNone;
     if (numSamples > 1 && random->nextBool()) {
         aaType = GrAAType::kMSAA;
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 92f7ac8..5f4ac28 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -979,7 +979,7 @@
 #if GR_TEST_UTILS
 GrGeometryProcessor* DashingCircleEffect::TestCreate(GrProcessorTestData* d) {
     AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashOp::kAAModeCnt));
-    GrColor color = GrRandomColor(d->fRandom);
+    GrColor color = GrTest::RandomColor(d->fRandom);
     SkMatrix matrix = GrTest::TestMatrix(d->fRandom);
     return DashingCircleEffect::Make(d->allocator(),
                                      SkPMColor4f::FromBytes_RGBA(color),
@@ -1195,7 +1195,7 @@
 #if GR_TEST_UTILS
 GrGeometryProcessor* DashingLineEffect::TestCreate(GrProcessorTestData* d) {
     AAMode aaMode = static_cast<AAMode>(d->fRandom->nextULessThan(GrDashOp::kAAModeCnt));
-    GrColor color = GrRandomColor(d->fRandom);
+    GrColor color = GrTest::RandomColor(d->fRandom);
     SkMatrix matrix = GrTest::TestMatrix(d->fRandom);
     return DashingLineEffect::Make(d->allocator(),
                                    SkPMColor4f::FromBytes_RGBA(color),
diff --git a/src/gpu/ops/GrDrawAtlasOp.cpp b/src/gpu/ops/GrDrawAtlasOp.cpp
index 642fc84..4d2d909 100644
--- a/src/gpu/ops/GrDrawAtlasOp.cpp
+++ b/src/gpu/ops/GrDrawAtlasOp.cpp
@@ -357,7 +357,7 @@
         xforms->push_back(random_xform(random));
         texRects->push_back(random_texRect(random));
         if (hasColors) {
-            colors->push_back(GrRandomColor(random));
+            colors->push_back(GrTest::RandomColor(random));
         }
     }
 }
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index 894fc40..64fc03a 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -655,7 +655,7 @@
             texCoords->push_back(random_point(random, min, max));
         }
         if (hasColors) {
-            colors->push_back(GrRandomColor(random));
+            colors->push_back(GrTest::RandomColor(random));
         }
         if (hasIndices) {
             SkASSERT(maxVertex <= UINT16_MAX);