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

Unified Diff: include/gpu/GrTestUtils.h

Issue 1957363002: Replace GrStrokeInfo with GrStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@resscale
Patch Set: Fix issue where hairlines were going to MSAAPathRenderer Created 4 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
Index: include/gpu/GrTestUtils.h
diff --git a/include/gpu/GrTestUtils.h b/include/gpu/GrTestUtils.h
index 475e38a6a11d50034aebaf1145973dbfd16726df..caaf5d978560ebfb9c67143f6078fc827435ed8b 100644
--- a/include/gpu/GrTestUtils.h
+++ b/include/gpu/GrTestUtils.h
@@ -13,10 +13,12 @@
#ifdef GR_TEST_UTILS
#include "GrColor.h"
+#include "SkPathEffect.h"
#include "SkRandom.h"
#include "SkStrokeRec.h"
+#include "../private/SkTemplates.h"
-class GrStrokeInfo;
+class GrStyle;
class SkMatrix;
class SkPath;
class SkRRect;
@@ -24,7 +26,7 @@ struct SkRect;
namespace GrTest {
/**
- * A helper for use in Test functions.
+ * Helpers for use in Test functions.
*/
const SkMatrix& TestMatrix(SkRandom*);
const SkMatrix& TestMatrixPreservesRightAngles(SkRandom*);
@@ -36,9 +38,34 @@ const SkRRect& TestRRectSimple(SkRandom*);
const SkPath& TestPath(SkRandom*);
const SkPath& TestPathConvex(SkRandom*);
SkStrokeRec TestStrokeRec(SkRandom*);
-GrStrokeInfo TestStrokeInfo(SkRandom*);
+/** Creates styles with dash path effects and null path effects */
+void TestStyle(SkRandom*, GrStyle*);
-}
+// We have a simplified dash path effect here to avoid relying on SkDashPathEffect which
+// is in the optional build target effects.
+class TestDashPathEffect : public SkPathEffect {
+public:
+ static sk_sp<SkPathEffect> Make(const SkScalar* intervals, int count, SkScalar phase) {
+ return sk_sp<SkPathEffect>(new TestDashPathEffect(intervals, count, phase));
+ }
+
+ bool filterPath(SkPath* dst, const SkPath&, SkStrokeRec* , const SkRect*) const override;
+ DashType asADash(DashInfo* info) const override;
+ Factory getFactory() const override { return nullptr; }
+ void toString(SkString*) const override {}
+
+private:
+ TestDashPathEffect(const SkScalar* intervals, int count, SkScalar phase);
+
+ int fCount;
+ SkAutoTArray<SkScalar> fIntervals;
+ SkScalar fPhase;
+ SkScalar fInitialDashLength;
+ int fInitialDashIndex;
+ SkScalar fIntervalLength;
+};
+
+} // namespace GrTest
static inline GrColor GrRandomColor(SkRandom* random) {
// There are only a few cases of random colors which interest us

Powered by Google App Engine
This is Rietveld 408576698