Fix for 686843, Error in scaling masked images.
"Jeong Kim" <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
This is a reminder for my previous posting on 9 May 2003.
Reviewers,
Thanks to Len Sorensen's analysis, I could find that when scaling factors
of /ImageMatrix in a image mask are negative values, translation offset
values for rendering the mask are not appropriate.
As you can see in the following code,
gximage3.c ( 332): origin.y = (int)floor(mrect.p.y);
origin is the variable for translation of the mask and
it just takes floor of the mrect.p.y.
As it is the offset value, it must take 'ceil' value in the case of
negative.
So I changed the code as follows and it works now!
origin.y = (mrect.p.y < 0) ? (int)ceil(mrect.p.y) : (int)floor(mrect.p.y);
Log:
When scaling factors of /ImageMatrix in a image mask for ImageType3 are
negative, translation offset values for image mask rendering are
incorrect and it makes abnormal output (eg. white lines).
This patch fixes this bug #686843. Thanks to Len Sorensen for the analysis.
Index: src/gximage3.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gximage3.c,v
retrieving revision 1.12
diff -C2 -r1.12 gximage3.c
*** src/gximage3.c 18 Aug 2003 21:21:57 -0000 1.12
--- src/gximage3.c 11 Jan 2004 23:04:39 -0000
***************
*** 329,334 ****
)
return code;
! origin.x = (int)floor(mrect.p.x);
! origin.y = (int)floor(mrect.p.y);
code = make_mid(&mdev, dev, (int)ceil(mrect.q.x) - origin.x,
(int)ceil(mrect.q.y) - origin.y, mem);
--- 329,334 ----
)
return code;
! origin.x = (mrect.p.x < 0) ? (int)ceil(mrect.p.x) :
(int)floor(mrect.p.x);
! origin.y = (mrect.p.y < 0) ? (int)ceil(mrect.p.y) :
(int)floor(mrect.p.y);
code = make_mid(&mdev, dev, (int)ceil(mrect.q.x) - origin.x,
(int)ceil(mrect.q.y) - origin.y, mem);