diff options
author | robertphillips <robertphillips@google.com> | 2016-07-06 09:58:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-06 09:58:57 -0700 |
commit | 01a19504c4dbd980e96b1c5b9fe8c8779432488d (patch) | |
tree | d70cbbab2b648ec1c40657457d520d18e999cecc /src/gpu/GrTestUtils.cpp | |
parent | afd6340d560846a8fa88d888cf460b6866237035 (diff) |
Move GrNonAAFillRectPerspectiveBatch to its own file
Get this out of the way of the upcoming changes (and add a test for it)
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2108403005
Review-Url: https://codereview.chromium.org/2108403005
Diffstat (limited to 'src/gpu/GrTestUtils.cpp')
-rw-r--r-- | src/gpu/GrTestUtils.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp index e962978fc3..d5cdbab1fb 100644 --- a/src/gpu/GrTestUtils.cpp +++ b/src/gpu/GrTestUtils.cpp @@ -14,7 +14,9 @@ #ifdef GR_TEST_UTILS -static const SkMatrix& test_matrix(SkRandom* random, bool includePerspective) { +static const SkMatrix& test_matrix(SkRandom* random, + bool includeNonPerspective, + bool includePerspective) { static SkMatrix gMatrices[5]; static const int kPerspectiveCount = 1; static bool gOnce; @@ -34,15 +36,18 @@ static const SkMatrix& test_matrix(SkRandom* random, bool includePerspective) { } uint32_t count = static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)); - if (includePerspective) { + if (includeNonPerspective && includePerspective) { return gMatrices[random->nextULessThan(count)]; + } else if (!includeNonPerspective) { + return gMatrices[count - 1 - random->nextULessThan(kPerspectiveCount)]; } else { + SkASSERT(includeNonPerspective && !includePerspective); return gMatrices[random->nextULessThan(count - kPerspectiveCount)]; } } namespace GrTest { -const SkMatrix& TestMatrix(SkRandom* random) { return test_matrix(random, true); } +const SkMatrix& TestMatrix(SkRandom* random) { return test_matrix(random, true, true); } const SkMatrix& TestMatrixPreservesRightAngles(SkRandom* random) { static SkMatrix gMatrices[5]; @@ -96,7 +101,8 @@ const SkMatrix& TestMatrixRectStaysRect(SkRandom* random) { return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))]; } -const SkMatrix& TestMatrixInvertible(SkRandom* random) { return test_matrix(random, false); } +const SkMatrix& TestMatrixInvertible(SkRandom* random) { return test_matrix(random, true, false); } +const SkMatrix& TestMatrixPerspective(SkRandom* random) { return test_matrix(random, false, true); } const SkRect& TestRect(SkRandom* random) { static SkRect gRects[7]; |