aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-10-26 08:17:04 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-26 08:17:04 -0700
commit950305ec77702639fe6ad1923f7b8d828ccef634 (patch)
tree94bd31af42271a4ac9e25da07f8383cc6a16e1f0 /src
parent05ded891272772d43acc16345b2f90a4560df090 (diff)
fix for teeny strokes
Pass the scale before evaluating degenerate line segments. This does not change other GMs. R=reed@google.com BUG=478337 Review URL: https://codereview.chromium.org/1418133007
Diffstat (limited to 'src')
-rw-r--r--src/core/SkStroke.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp
index 522a000712..e04d14aea5 100644
--- a/src/core/SkStroke.cpp
+++ b/src/core/SkStroke.cpp
@@ -51,10 +51,11 @@ static inline bool degenerate_vector(const SkVector& v) {
return !SkPoint::CanNormalize(v.fX, v.fY);
}
-static bool set_normal_unitnormal(const SkPoint& before, const SkPoint& after,
+static bool set_normal_unitnormal(const SkPoint& before, const SkPoint& after, SkScalar scale,
SkScalar radius,
SkVector* normal, SkVector* unitNormal) {
- if (!unitNormal->setNormalize(after.fX - before.fX, after.fY - before.fY)) {
+ if (!unitNormal->setNormalize((after.fX - before.fX) * scale,
+ (after.fY - before.fY) * scale)) {
return false;
}
unitNormal->rotateCCW();
@@ -244,7 +245,7 @@ bool SkPathStroker::preJoinTo(const SkPoint& currPt, SkVector* normal,
SkScalar prevX = fPrevPt.fX;
SkScalar prevY = fPrevPt.fY;
- if (!set_normal_unitnormal(fPrevPt, currPt, fRadius, normal, unitNormal)) {
+ if (!set_normal_unitnormal(fPrevPt, currPt, fResScale, fRadius, normal, unitNormal)) {
if (SkStrokerPriv::CapFactory(SkPaint::kButt_Cap) == fCapper) {
return false;
}
@@ -367,7 +368,7 @@ void SkPathStroker::line_to(const SkPoint& currPt, const SkVector& normal) {
void SkPathStroker::lineTo(const SkPoint& currPt) {
if (SkStrokerPriv::CapFactory(SkPaint::kButt_Cap) == fCapper
- && SkPath::IsLineDegenerate(fPrevPt, currPt, false)) {
+ && fPrevPt.equalsWithinTolerance(currPt, SK_ScalarNearlyZero * fInvResScale)) {
return;
}
SkVector normal, unitNormal;
@@ -381,7 +382,7 @@ void SkPathStroker::lineTo(const SkPoint& currPt) {
void SkPathStroker::setQuadEndNormal(const SkPoint quad[3], const SkVector& normalAB,
const SkVector& unitNormalAB, SkVector* normalBC, SkVector* unitNormalBC) {
- if (!set_normal_unitnormal(quad[1], quad[2], fRadius, normalBC, unitNormalBC)) {
+ if (!set_normal_unitnormal(quad[1], quad[2], fResScale, fRadius, normalBC, unitNormalBC)) {
*normalBC = normalAB;
*unitNormalBC = unitNormalAB;
}