From 0e9c3462598dedc22ba7520865c83d29ffb160b9 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 22 Jan 2013 17:47:25 +0000 Subject: Bug 693520: Fix rendering of non-orthogonal gradients. Jarkko Poyry(*) points out that gradients are incorrectly rendered when they aren't axis aligned. This review fixes it here using a patch inspired by both his and zenikos patch. Thanks guys. Further thanks to zeniko for spotting that it applies to the XPS code too and providing a patch. * Apologies for the lack of the accent - my editor/git gives problems with them in commit messages. --- fitz/res_shade.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'fitz') diff --git a/fitz/res_shade.c b/fitz/res_shade.c index aa53a63b..15f631da 100644 --- a/fitz/res_shade.c +++ b/fitz/res_shade.c @@ -81,21 +81,21 @@ fz_point_on_circle(fz_point p, float r, float theta) static void fz_mesh_type2_process(fz_context *ctx, fz_shade *shade, fz_matrix ctm, fz_mesh_processor *painter) { - fz_point p0, p1; + fz_point p0, p1, dir; fz_vertex v0, v1, v2, v3; fz_vertex e0, e1; float theta; p0.x = shade->u.l_or_r.coords[0][0]; p0.y = shade->u.l_or_r.coords[0][1]; - p0 = fz_transform_point(ctm, p0); - p1.x = shade->u.l_or_r.coords[1][0]; p1.y = shade->u.l_or_r.coords[1][1]; + dir.x = p0.y - p1.y; + dir.y = p1.x - p0.x; + p0 = fz_transform_point(ctm, p0); p1 = fz_transform_point(ctm, p1); - - theta = atan2f(p1.y - p0.y, p1.x - p0.x); - theta += (float)M_PI * 0.5f; + dir = fz_transform_vector(ctm, dir); + theta = atan2f(dir.y, dir.x); v0.p = fz_point_on_circle(p0, HUGENUM, theta); v1.p = fz_point_on_circle(p1, HUGENUM, theta); -- cgit v1.2.3