Index: src/gpu/GrTestUtils.cpp |
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp |
index afd9fd80b6787a5f010d965e932e6205907afda8..d0cea5565ce9c2c39af51b7b06ec08526980ec29 100644 |
--- a/src/gpu/GrTestUtils.cpp |
+++ b/src/gpu/GrTestUtils.cpp |
@@ -29,6 +29,32 @@ const SkMatrix& TestMatrix(SkRandom* random) { |
return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))]; |
} |
+const SkMatrix& TestMatrixPreservesRightAngles(SkRandom* random) { |
+ static SkMatrix gMatrices[4]; |
+ static bool gOnce; |
+ if (!gOnce) { |
+ // identity |
+ gMatrices[0].reset(); |
+ // translation |
+ gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100)); |
+ // scale |
+ gMatrices[2].setScale(SkIntToScalar(17), SkIntToScalar(17)); |
+ // scale + translation |
+ gMatrices[3].setScale(SkIntToScalar(-17), SkIntToScalar(-17)); |
+ gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33)); |
+ // orthogonal basis vectors |
+ gMatrices[4].reset(); |
+ gMatrices[4].setScale(SkIntToScalar(-1), SkIntToScalar(-1)); |
+ gMatrices[4].setRotate(47); |
brucedawson
2015/04/30 20:19:06
These three lines of code reference gMatrices[4] b
|
+ gOnce = true; |
+ |
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gMatrices); i++) { |
+ SkASSERT(gMatrices[i].preservesRightAngles()); |
+ } |
+ } |
+ return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))]; |
+} |
+ |
const SkRect& TestRect(SkRandom* random) { |
static SkRect gRects[1]; |
static bool gOnce; |