Fix artifacts on tiny stroked paths scaled up a lot.

Set doConsumeDegenerates to false when calling SkPath::Iter::next() for
all paths which are not in screen space. These lines are not degenerate
for world space paths.

Note: this change fixes only GrTessellatingPathRenderer and
GrDefaultPathRenderer. GrMSAAPathRenderer still exhibits the bug.

Bug: skia:6987
Change-Id: Ie3d494703211925c77052c68513948484e341486
Reviewed-on: https://skia-review.googlesource.com/37522
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2017-08-23 09:37:16 -04:00 committed by Skia Commit-Bot
parent 9d9022477f
commit 2cee283fda
4 changed files with 19 additions and 3 deletions

View File

@ -358,3 +358,19 @@ DEF_SIMPLE_GM(bug339297, canvas, 640, 480) {
paint.setStrokeWidth(1);
canvas->drawPath(path, paint);
}
DEF_SIMPLE_GM(bug6987, canvas, 200, 200) {
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(0.0001f);
paint.setAntiAlias(true);
SkPath path;
canvas->save();
canvas->scale(50000.0f, 50000.0f);
path.moveTo(0.0005f, 0.0004f);
path.lineTo(0.0008f, 0.0010f);
path.lineTo(0.0002f, 0.0010f);
path.close();
canvas->drawPath(path, paint);
canvas->restore();
}

View File

@ -167,7 +167,7 @@ int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths, SkScalar
SkPath::Verb verb;
SkPoint pts[4];
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
while ((verb = iter.next(pts, false)) != SkPath::kDone_Verb) {
switch (verb) {
case SkPath::kLine_Verb:

View File

@ -711,7 +711,7 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
}
SkAutoConicToQuads converter;
SkPath::Verb verb;
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
while ((verb = iter.next(pts, false)) != SkPath::kDone_Verb) {
switch (verb) {
case SkPath::kConic_Verb: {
SkScalar weight = iter.conicWeight();

View File

@ -148,7 +148,7 @@ public:
bool done = false;
while (!done) {
SkPath::Verb verb = iter.next(pts);
SkPath::Verb verb = iter.next(pts, false);
switch (verb) {
case SkPath::kMove_Verb:
this->moveTo(pts[0]);