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

Unified Diff: gm/hairlines.cpp

Issue 23532082: Add GM case for arc truncation error bug (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Added suppression Created 7 years, 3 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 | « expectations/gm/ignored-tests.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/hairlines.cpp
===================================================================
--- gm/hairlines.cpp (revision 11440)
+++ gm/hairlines.cpp (working copy)
@@ -133,6 +133,31 @@
bug2->lineTo(5.5f, 0.5f);
bug2->lineTo(0.5f, 0.5f);
}
+
+ {
+ // Arc example to test imperfect truncation bug (crbug.com/295626)
+ static const SkScalar kRad = SkIntToScalar(2000);
+ static const SkScalar kStartAngle = SkFloatToScalar(262.59717f);
+ static const SkScalar kSweepAngle = SkScalarHalf(SkFloatToScalar(17.188717f));
+
+ SkPath* bug = &fPaths.push_back();
+
+ // Add a circular arc
+ SkRect circle = SkRect::MakeLTRB(-kRad, -kRad, kRad, kRad);
+ bug->addArc(circle, kStartAngle, kSweepAngle);
+
+ // Now add the chord that should cap the circular arc
+ SkScalar cosV, sinV = SkScalarSinCos(SkDegreesToRadians(kStartAngle), &cosV);
+
+ SkPoint p0 = SkPoint::Make(kRad * cosV, kRad * sinV);
+
+ sinV = SkScalarSinCos(SkDegreesToRadians(kStartAngle + kSweepAngle), &cosV);
+
+ SkPoint p1 = SkPoint::Make(kRad * cosV, kRad * sinV);
+
+ bug->moveTo(p0);
+ bug->lineTo(p1);
+ }
}
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698