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

Unified Diff: gm/dashing.cpp

Issue 1534223002: fix large dashed paths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « no previous file | include/core/SkPathMeasure.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/dashing.cpp
diff --git a/gm/dashing.cpp b/gm/dashing.cpp
index 300eb776f518e8a723ccfae749b67b24a7565048..aed4c0019f5d729fb29b49fff5b9064272d5168f 100644
--- a/gm/dashing.cpp
+++ b/gm/dashing.cpp
@@ -476,6 +476,32 @@ private:
bool fDoAA;
};
+DEF_SIMPLE_GM(longpathdash, canvas, 512, 512) {
+ SkPath lines;
+ for (int x = 32; x < 256; x += 16) {
+ for (SkScalar a = 0; a < 3.141592f * 2; a += 0.03141592f) {
+ SkPoint pts[2] = {
+ { 256 + (float) sin(a) * x,
+ 256 + (float) cos(a) * x },
+ { 256 + (float) sin(a + 3.141592 / 3) * (x + 64),
+ 256 + (float) cos(a + 3.141592 / 3) * (x + 64) }
+ };
+ lines.moveTo(pts[0]);
+ for (SkScalar i = 0; i < 1; i += 0.05f) {
+ lines.lineTo(pts[0].fX * (1 - i) + pts[1].fX * i,
+ pts[0].fY * (1 - i) + pts[1].fY * i);
+ }
+ }
+ }
+ SkPaint p;
+ p.setAntiAlias(true);
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setStrokeWidth(1);
+ const SkScalar intervals[] = { 1, 1 };
+ p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals), 0))->unref();
+ canvas->drawPath(lines, p);
+}
+
//////////////////////////////////////////////////////////////////////////////
DEF_GM(return new DashingGM;)
« no previous file with comments | « no previous file | include/core/SkPathMeasure.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698