summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-01-22 17:47:25 +0000
committerRobin Watts <robin.watts@artifex.com>2013-01-23 16:52:42 +0000
commit0e9c3462598dedc22ba7520865c83d29ffb160b9 (patch)
treed5eb673674b9d7ab625f77635426eb999551e151 /xps
parentd374ec148dda5934432112245716c8a207165c6c (diff)
downloadmupdf-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 'xps')
-rw-r--r--xps/xps_gradient.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xps/xps_gradient.c b/xps/xps_gradient.c
index 77d9c56f..a0b342bc 100644
--- a/xps/xps_gradient.c
+++ b/xps/xps_gradient.c
@@ -391,7 +391,7 @@ xps_draw_linear_gradient(xps_document *doc, fz_matrix ctm, fz_rect area,
xps_parse_point(end_point_att, &x1, &y1);
p1.x = x0; p1.y = y0; p2.x = x1; p2.y = y1;
- p1 = fz_transform_point(ctm, p1); p2 = fz_transform_point(ctm, p2);
+ area = fz_transform_rect(fz_invert_matrix(ctm), area);
x = p2.x - p1.x; y = p2.y - p1.y;
k = ((area.x0 - p1.x) * x + (area.y0 - p1.y) * y) / (x * x + y * y);
mi = floorf(k); ma = ceilf(k);