http://bugs.winehq.org/show_bug.cgi?id=36504
Bug ID: 36504 Summary: The XFORM matrix is calculated incorrectly in PlgBlt() Product: Wine Version: 1.7.19 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdi32 Assignee: wine-bugs@winehq.org Reporter: sashoalm@gmail.com
I initially posted this at the wine-devel mailing list - http://www.winehq.org/pipermail/wine-devel/2014-May/104356.html
For now, I'll copy/paste the relevant parts describing how to reproduce the bug.
The test is a VC6 project, you can find it at https://drive.google.com/file/d/0B9PGUhmmnsm1S2VvZzc3WmhBY3c/edit?usp=sharin.... The test is a demo of PlgBlt that I found on CodeProjecthttp://www.codeproject.com/Articles/17712/The-GDI-magic-Rendering-reflections-and-smooth-sha. You can compare how it works on XP and on Wine. For testing, I directly inserted the original Wine implementation of PlgBlt, as well as my patched version, into the VC6 project, and tested on that. This is because there seems to be an additional problem with MaskBlt, which I'll try tackling next.
I have screenshots of what the demo looks using Windows's PlgBlthttp://imgur.com/q8qKGd7, and Wine's PlgBlt http://imgur.com/smYEV6z.
To test it, simply look at this function in the VC6 project:
BOOL MyPlgBlt( HDC hdcDest, const POINT *lpPoint, HDC hdcSrc, INT nXSrc, INT nYSrc, INT nWidth, INT nHeight, HBITMAP hbmMask, INT xMask, INT yMask) { // return MyPlgBltWinePatched(hdcDest, lpPoint, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, hbmMask, xMask, yMask); return MyPlgBltWineUnpatched(hdcDest, lpPoint, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, hbmMask, xMask, yMask); // return PlgBlt(hdcDest, lpPoint, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, hbmMask, xMask, yMask); }
https://bugs.winehq.org/show_bug.cgi?id=36504
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, testcase
http://bugs.winehq.org/show_bug.cgi?id=36504
Julian Rüger jr98@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jr98@gmx.net
https://bugs.winehq.org/show_bug.cgi?id=36504
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |adys.wh@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=36504
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian@fds-team.de
http://bugs.winehq.org/show_bug.cgi?id=36504
--- Comment #1 from Sebastian Lackner sebastian@fds-team.de --- @Other readers: I have analyzed the differences between the old and the new set of equations, you can find some more details here on the mailing list: http://www.winehq.org/pipermail/wine-devel/2014-June/104518.html
Most likely fixing the equation for eM22 should be sufficient, no need to rewrite the whole function:
xf.eM22 = (rect[1].x*(plg[2].y - plg[0].y) - rect[2].x*(plg[1].y - plg[0].y) - rect[0].x*(plg[2].y - plg[1].y)) / det;
@Alexander: Can you confirm that this single change resolves the issue? If yes I would suggest you to send a new patch, which really only modifies this part. I don't think you'll need to write a test for this single-line change, where most likely everyone can agree, that it looks like a mistake in the old code. The main problem of your huge patch was just, that noone could really follow, what has changed exactly.
Regards, Sebastian
http://bugs.winehq.org/show_bug.cgi?id=36504
--- Comment #2 from Alexander Almaleh sashoalm@gmail.com --- Hi, @Sebastian
I have just tested your proposed change in my demo project from http://www.codeproject.com/Articles/17712/The-GDI-magic-Rendering-reflection..., and indeed it produces the same image as Windows' own PlgBlt.
Thank you for the suggestion. By the way, my equations were difficult to follow because they were machine-generated, as I've already said.
So since this works, what is the next step? Should I propose a patch consisting of this change?
Regards, Alexander
http://bugs.winehq.org/show_bug.cgi?id=36504
--- Comment #3 from Sebastian Lackner sebastian@fds-team.de --- I would recommend to start a new try with such a minimal changes patch (creating a patch and sending it to wine-devel) - it seems like the author of the original formula already had the right idea, and just made a small "typo" in this line.
https://bugs.winehq.org/show_bug.cgi?id=36504
--- Comment #4 from Sebastian Lackner sebastian@fds-team.de --- Nice, the patch already got upstream :)
Fixed with http://source.winehq.org/git/wine.git/commit/8762842cd337a809a6504420da2aeee...
https://bugs.winehq.org/show_bug.cgi?id=36504
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |8762842cd337a809a6504420da2 | |aeeeb5d3618b6 Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #5 from Jerome Leclanche adys.wh@gmail.com --- reported fixed
https://bugs.winehq.org/show_bug.cgi?id=36504
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.21.
https://bugs.winehq.org/show_bug.cgi?id=36504
Reuben reuben_p@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |reuben_p@yahoo.com
https://bugs.winehq.org/show_bug.cgi?id=36504
Reuben reuben_p@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|reuben_p@yahoo.com |