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

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: Fix overlength line Created 4 years, 5 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
« no previous file with comments | « include/gpu/GrTestUtils.h ('k') | src/gpu/batches/GrNonAAFillRectBatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTestUtils.cpp
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index e962978fc3454380aaf9d9ff4f226fb6e688e617..d5cdbab1fb5ef86197ee4ab63a5a882ed68201f5 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];
« no previous file with comments | « include/gpu/GrTestUtils.h ('k') | src/gpu/batches/GrNonAAFillRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698