Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1265)

Unified Diff: src/gpu/GrTestUtils.cpp

Issue 2108403005: Move GrNonAAFillRectPerspectiveBatch to its own file (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrTestUtils.cpp
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index e962978fc3454380aaf9d9ff4f226fb6e688e617..526da89fe35c9fd03cc7592851aeca517559cd67 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -14,7 +14,7 @@
#ifdef GR_TEST_UTILS
-static const SkMatrix& test_matrix(SkRandom* random, bool includePerspective) {
+static const SkMatrix& test_matrix(SkRandom* random, bool includeNonPerspective, bool includePerspective) {
bsalomon 2016/07/02 00:45:28 wrap?
robertphillips 2016/07/06 15:23:50 Done.
static SkMatrix gMatrices[5];
static const int kPerspectiveCount = 1;
static bool gOnce;
@@ -34,15 +34,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 +99,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];

Powered by Google App Engine
This is Rietveld 408576698