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

Unified Diff: src/gpu/GrTestUtils.cpp

Issue 1129083005: AADistanceFieldPathRenderer unit tests (Closed) Base URL: https://skia.googlesource.com/skia.git@randbatch7
Patch Set: Created 5 years, 7 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
« src/gpu/GrAADistanceFieldPathRenderer.cpp ('K') | « src/gpu/GrOvalRenderer.cpp ('k') | no next file » | 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 00742e955ce29ab94ec5db5b90271cfa4127dc20..3f74bb92fc5b43410c9c8109bb29953b526d42ea 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -171,6 +171,21 @@ const SkPath& TestPath(SkRandom* random) {
return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPath)))];
}
+SkStrokeRec TestStrokeRec(SkRandom* random) {
+ SkStrokeRec::InitStyle style =
robertphillips 2015/05/07 19:30:24 Should we add a 'kInitStyleCount ' ?
joshualitt 2015/05/07 21:22:39 Well, there is a macro which Mike Klein made to ma
+ SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_InitStyle + 1));
+ SkStrokeRec rec(style);
+ bool strokeAndFill = random->nextBool();
robertphillips 2015/05/07 19:30:24 A width one too? Maybe 10?
joshualitt 2015/05/07 21:22:39 you want me to make an enum of possible widths wit
robertphillips 2015/05/08 12:02:07 I was just angling for a wider one (i.e., a stroke
+ SkScalar strokeWidth = random->nextBool() ? 0.f : 1.f;
+ rec.setStrokeStyle(strokeWidth, strokeAndFill);
+
+ SkPaint::Cap cap = SkPaint::Cap(random->nextULessThan(SkPaint::kCapCount));
+ SkPaint::Join join = SkPaint::Join(random->nextULessThan(SkPaint::kJoinCount));
+ SkScalar miterLimit = random->nextRangeScalar(1.f, 5.f);
+ rec.setStrokeParams(cap, join, miterLimit);
+ return rec;
+}
+
};
#endif
« src/gpu/GrAADistanceFieldPathRenderer.cpp ('K') | « src/gpu/GrOvalRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698