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

Unified Diff: gm/strokes.cpp

Issue 1547483003: fix hair fuzz (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: handle case where all points are equal 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 | src/core/SkScan_Hairline.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/strokes.cpp
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index f2abb0b7dd6d54d82fc880973810471873a54318..261db9c69d8cb3c245a8df93875b41fde0a8f629 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -236,6 +236,38 @@ DEF_SIMPLE_GM(zerolinestroke, canvas, 90, 120) {
canvas->drawPath(path, paint);
}
+DEF_SIMPLE_GM(quadcap, canvas, 200, 200) {
+ SkPaint p;
+ p.setAntiAlias(true);
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setStrokeWidth(0);
+ SkPath path;
+ SkPoint pts[] = {{105.738571f,13.126318f},
+ {105.738571f,13.126318f},
+ {123.753784f,1.f}};
+ SkVector tangent = pts[1] - pts[2];
+ tangent.normalize();
+ SkPoint pts2[3];
+ memcpy(pts2, pts, sizeof(pts));
+ const SkScalar capOutset = SK_ScalarPI / 8;
+ pts2[0].fX += tangent.fX * capOutset;
+ pts2[0].fY += tangent.fY * capOutset;
+ pts2[1].fX += tangent.fX * capOutset;
+ pts2[1].fY += tangent.fY * capOutset;
+ pts2[2].fX += -tangent.fX * capOutset;
+ pts2[2].fY += -tangent.fY * capOutset;
+ path.moveTo(pts2[0]);
+ path.quadTo(pts2[1], pts2[2]);
+ canvas->drawPath(path, p);
+
+ path.reset();
+ path.moveTo(pts[0]);
+ path.quadTo(pts[1], pts[2]);
+ p.setStrokeCap(SkPaint::kRound_Cap);
+ canvas->translate(30, 0);
+ canvas->drawPath(path, p);
+}
+
class Strokes2GM : public skiagm::GM {
SkPath fPath;
protected:
« no previous file with comments | « no previous file | src/core/SkScan_Hairline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698