diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-26 12:05:32 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-26 12:05:32 +0000 |
commit | 6c000321f2b910b95734bc96d7613b1c2c795109 (patch) | |
tree | f636c2a6b62282659f0b9cb7876df61d37a5a3a6 | |
parent | 441433e9c47b445202a5e9c635aae67b1314cd2b (diff) |
Add GM case for arc truncation error bug
https://codereview.chromium.org/23532082/
git-svn-id: http://skia.googlecode.com/svn/trunk@11466 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | expectations/gm/ignored-tests.txt | 4 | ||||
-rw-r--r-- | gm/hairlines.cpp | 25 |
2 files changed, 29 insertions, 0 deletions
diff --git a/expectations/gm/ignored-tests.txt b/expectations/gm/ignored-tests.txt index 0cc2bbabd0..a41e7bdb84 100644 --- a/expectations/gm/ignored-tests.txt +++ b/expectations/gm/ignored-tests.txt @@ -21,3 +21,7 @@ ## Added by edisonn as part of https://codereview.chromium.org/23851037/ #gradients +# Added by robertphillips as part of https://codereview.chromium.org/23532082/ +hairlines + + diff --git a/gm/hairlines.cpp b/gm/hairlines.cpp index d4d142fa7a..fb7258ea4a 100644 --- a/gm/hairlines.cpp +++ b/gm/hairlines.cpp @@ -133,6 +133,31 @@ protected: 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 { |