Separate quad UV calculation from bloat_quad
For GPU hairlines move UV calculation on vertices for quads to its
own function outside of bloat_quad. This is done since conics share
the bloat quad function and don't need to do this calcuation.
BUG=
R=bsalomon@google.com
Review URL: https://codereview.chromium.org/22043006
git-svn-id: http://skia.googlecode.com/svn/trunk@10547 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index ecd9389..c1f951a 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -472,6 +472,12 @@
result->fY = SkScalarMul(result->fY, wInv);
}
+void set_uv_quad(const SkPoint qpts[3], Vertex verts[kVertsPerQuad]) {
+ // this should be in the src space, not dev coords, when we have perspective
+ GrPathUtils::QuadUVMatrix DevToUV(qpts);
+ DevToUV.apply<kVertsPerQuad, sizeof(Vertex), sizeof(GrPoint)>(verts);
+}
+
void bloat_quad(const SkPoint qpts[3], const SkMatrix* toDevice,
const SkMatrix* toSrc, Vertex verts[kVertsPerQuad],
SkRect* devBounds) {
@@ -481,9 +487,6 @@
SkPoint b = qpts[1];
SkPoint c = qpts[2];
- // this should be in the src space, not dev coords, when we have perspective
- GrPathUtils::QuadUVMatrix DevToUV(qpts);
-
if (toDevice) {
toDevice->mapPoints(&a, 1);
toDevice->mapPoints(&b, 1);
@@ -549,7 +552,6 @@
if (toSrc) {
toSrc->mapPointsWithStride(&verts[0].fPos, sizeof(Vertex), kVertsPerQuad);
}
- DevToUV.apply<kVertsPerQuad, sizeof(Vertex), sizeof(GrPoint)>(verts);
}
// Input:
@@ -641,6 +643,7 @@
add_quads(newP + 2, subdiv-1, toDevice, toSrc, vert, devBounds);
} else {
bloat_quad(p, toDevice, toSrc, *vert, devBounds);
+ set_uv_quad(p, *vert);
*vert += kVertsPerQuad;
}
}