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
This commit is contained in:
egdaniel@google.com 2013-08-05 20:43:12 +00:00
parent 97333f2da9
commit 34b05ca379

View File

@ -472,6 +472,12 @@ void intersect_lines(const SkPoint& ptA, const SkVector& normA,
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 @@ void bloat_quad(const SkPoint qpts[3], const SkMatrix* toDevice,
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 @@ void bloat_quad(const SkPoint qpts[3], const SkMatrix* toDevice,
if (toSrc) {
toSrc->mapPointsWithStride(&verts[0].fPos, sizeof(Vertex), kVertsPerQuad);
}
DevToUV.apply<kVertsPerQuad, sizeof(Vertex), sizeof(GrPoint)>(verts);
}
// Input:
@ -641,6 +643,7 @@ void add_quads(const SkPoint p[3],
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;
}
}