[Mono-dev] Patch for scaled/cropped drawing bug in libgdi

Dan Parnham parnham at gmail.com
Wed Apr 28 09:25:43 EDT 2010

We started using the System.Drawing.Graphics.DrawImage function that
supports a source and destination rectangle, but found that the output was
incorrect. After digging into the source we determined that the problem
originated in the "image.c" file of the libgdi source. The translation of
the matrix was being applied using both the source and destination
coordinates after scaling, even though the source and destination rectangles
are at different scales. The fix is to apply the source translation before
the matrix scale and the destination translation afterwards.

The result of this problem can be seen in the following bug:

I have attached a patch (which is against the 2.6.4 release of libgdi but
can also apply to the trunk since that file has not been changed).

Kind regards,
Dan Parnham and Justen Hyde

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100428/6ab5bcc8/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.c.patch
Type: text/x-diff
Size: 1129 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100428/6ab5bcc8/attachment-0001.bin 

More information about the Mono-devel-list mailing list