aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Stephen White <senorblanco@chromium.org>2017-01-16 11:47:21 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-17 15:59:50 +0000
commiteaf0079d81beac9fea2da7a20c3587ebbbbe6463 (patch)
tree7aae7f43f6a062edf4f8e0252a06c3e526f2389e /src/gpu
parentf76885694d4345363cb541170d18040a5c3f01cc (diff)
GrTessellator: fix for disappearing thin path.
simplify_boundary() was incorrectly comparing squared distances against a non-squared constant. For .25 of a pixel, we need to compare against 0.25 squared, or 0.0625. This also includes a fix to get_edge_normal(), We were actually returning edge "vectors", instead of edge normals. This wasn't causing problems, since the error cancels itself out, but it's confusing. BUG=skia: Change-Id: I0d50f2d001ed5e41de2900139c396b9ef75d2ddf Reviewed-on: https://skia-review.googlesource.com/7043 Commit-Queue: Stephan White <senorblanco@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrTessellator.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp
index 09a5662f8d..d193b7486c 100644
--- a/src/gpu/GrTessellator.cpp
+++ b/src/gpu/GrTessellator.cpp
@@ -1457,8 +1457,8 @@ void remove_non_boundary_edges(const VertexList& mesh, SkPath::FillType fillType
}
void get_edge_normal(const Edge* e, SkVector* normal) {
- normal->setNormalize(SkDoubleToScalar(-e->fLine.fB) * e->fWinding,
- SkDoubleToScalar(e->fLine.fA) * e->fWinding);
+ normal->setNormalize(SkDoubleToScalar(e->fLine.fA) * e->fWinding,
+ SkDoubleToScalar(e->fLine.fB) * e->fWinding);
}
// Stage 5c: detect and remove "pointy" vertices whose edge normals point in opposite directions
@@ -1475,7 +1475,7 @@ void simplify_boundary(EdgeList* boundary, Comparator& c, SkChunkAlloc& alloc) {
double dist = e->dist(prev->fPoint);
SkVector normal;
get_edge_normal(e, &normal);
- float denom = 0.25f * static_cast<float>(e->fLine.magSq());
+ float denom = 0.0625f * static_cast<float>(e->fLine.magSq());
if (prevNormal.dot(normal) < 0.0 && (dist * dist) <= denom) {
Edge* join = new_edge(prev, next, Edge::Type::kInner, c, alloc);
insert_edge(join, e, boundary);