From ff174b39474df20945fc7cc5c9d5bb68916f39a8 Mon Sep 17 00:00:00 2001 From: "senorblanco@chromium.org" Date: Mon, 16 May 2011 16:59:57 +0000 Subject: [PATCH] Fix winding order check for negative scale in tesselated path rendering. The isCCW() code in GrTesselatedPathRenderer was using untransformed vertices, which fails for transforms with negative scale. Doing the check after transformation fixes it. This was causing some missing geometry in the PolyToPoly and Shapes tests in SampleApp. Review URL: http://codereview.appspot.com/4545049/ git-svn-id: http://skia.googlecode.com/svn/trunk@1334 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gpu/src/GrTesselatedPathRenderer.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gpu/src/GrTesselatedPathRenderer.cpp b/gpu/src/GrTesselatedPathRenderer.cpp index 3993adb..19ee46d 100644 --- a/gpu/src/GrTesselatedPathRenderer.cpp +++ b/gpu/src/GrTesselatedPathRenderer.cpp @@ -97,10 +97,10 @@ class Edge { typedef GrTDArray EdgeArray; -bool isCCW(const GrPoint* v) +bool isCCW(const GrPoint* pts) { - GrVec v1 = v[1] - v[0]; - GrVec v2 = v[2] - v[1]; + GrVec v1 = pts[1] - pts[0]; + GrVec v2 = pts[2] - pts[1]; return v1.cross(v2) < 0; } @@ -110,12 +110,11 @@ static size_t computeEdgesAndOffsetVertices(const GrMatrix& matrix, size_t numVertices, EdgeArray* edges) { + matrix.mapPoints(vertices, numVertices); GrPoint p = vertices[numVertices - 1]; - matrix.mapPoints(&p, 1); float sign = isCCW(vertices) ? -1.0f : 1.0f; for (size_t i = 0; i < numVertices; ++i) { GrPoint q = vertices[i]; - matrix.mapPoints(&q, 1); if (p == q) continue; GrVec tangent = GrVec::Make(p.fY - q.fY, q.fX - p.fX); float scale = sign / tangent.length(); -- 2.7.4