align cap hairline first point

Hairlines with square caps move the endpoints out by 1/2 pixel.
The last point needs to be the first adjusted point, instead
of the point supplied to move to.

R=fmalita@chromium.org
TBR=reed@google.com
BUG=617658
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2189583003

Review-Url: https://codereview.chromium.org/2189583003
This commit is contained in:
caryclark 2016-07-27 12:50:09 -07:00 committed by Commit bot
parent 9913dfca2a
commit 52f85d4d09

View File

@ -538,10 +538,12 @@ void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter* blitter
if (SkPaint::kButt_Cap != capStyle) {
prevVerb = SkPath::kDone_Verb;
}
bool firstPtSet = false;
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
switch (verb) {
case SkPath::kMove_Verb:
firstPt = lastPt = pts[0];
firstPtSet = false;
break;
case SkPath::kLine_Verb:
if (SkPaint::kButt_Cap != capStyle) {
@ -592,6 +594,10 @@ void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter* blitter
case SkPath::kDone_Verb:
break;
}
if (!firstPtSet && SkPath::kLine_Verb <= verb && verb <= SkPath::kCubic_Verb) {
firstPt = lastPt = pts[0];
firstPtSet = true;
}
if (SkPaint::kButt_Cap != capStyle) {
prevVerb = verb;
}