diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-01-22 17:47:25 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-01-23 16:52:42 +0000 |
commit | 0e9c3462598dedc22ba7520865c83d29ffb160b9 (patch) | |
tree | d5eb673674b9d7ab625f77635426eb999551e151 /fitz | |
parent | d374ec148dda5934432112245716c8a207165c6c (diff) | |
download | mupdf-0e9c3462598dedc22ba7520865c83d29ffb160b9.tar.xz |
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.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/res_shade.c | 12 |
1 files changed, 6 insertions, 6 deletions
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); |