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
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 @@
typedef GrTDArray<Edge> 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 @@
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();