Index: src/gpu/GrTestUtils.cpp |
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp |
index c132663d2020d1b45c2f27be6065b0faac4a32ae..afd9fd80b6787a5f010d965e932e6205907afda8 100644 |
--- a/src/gpu/GrTestUtils.cpp |
+++ b/src/gpu/GrTestUtils.cpp |
@@ -8,6 +8,8 @@ |
#include "GrTestUtils.h" |
#include "SkMatrix.h" |
+#ifdef GR_TEST_UTILS |
+ |
namespace GrTest { |
const SkMatrix& TestMatrix(SkRandom* random) { |
static SkMatrix gMatrices[5]; |
@@ -26,4 +28,21 @@ const SkMatrix& TestMatrix(SkRandom* random) { |
} |
return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))]; |
} |
+ |
+const SkRect& TestRect(SkRandom* random) { |
+ static SkRect gRects[1]; |
brucedawson
2015/04/30 20:19:35
Why is this array declared as having just one elem
|
+ static bool gOnce; |
+ if (!gOnce) { |
+ gRects[0] = SkRect::MakeWH(1.f, 1.f); |
+ gRects[1] = SkRect::MakeWH(1.0f, 256.0f); |
+ gRects[2] = SkRect::MakeWH(256.0f, 1.0f); |
+ gRects[4] = SkRect::MakeLargest(); |
+ gRects[5] = SkRect::MakeLTRB(-65535.0f, -65535.0f, 65535.0f, 65535.0f); |
+ gRects[6] = SkRect::MakeLTRB(10.0f, 10.0f, -10.0f, -10.0f); |
+ gOnce = true; |
+ } |
+ return gRects[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRects)))]; |
+} |
}; |
+ |
+#endif |