https://bugs.winehq.org/show_bug.cgi?id=46375
Bug ID: 46375 Summary: Vietcong: game save thumbnails (screenshots) have corrupted colors Product: Wine Version: 4.0-rc2 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: trivial Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: havran.jan@email.cz Distribution: Other
Created attachment 63117 --> https://bugs.winehq.org/attachment.cgi?id=63117 Game-save screenshots - left = created on windows, right = Wine
Every time Vietcong game creates new game save (psg file), it also creates in-game screenshot of what scene game currently render on screen. This screenshot is part of the psg file. In main menu, game shows screenshot of selected game save (as a thumbnail). On native Windows, these screenshots are created relative nice (but they are low quality/compressed pictures), while on Wine they have always corrupted colors.
It is not problem of showing these screenshots (since I tried in Wine to load game save created on Windows, which had nice thumbnail), but they are being created corrupted. I have not looked into this bug deeply yet, so I do not know which API game uses to create these screens.
This bug is in Wine probably for very long time, maybe since beginning. There is nothing special in the Wine log.
https://bugs.winehq.org/show_bug.cgi?id=46375
--- Comment #1 from Jan Havran havran.jan@email.cz --- Created attachment 63118 --> https://bugs.winehq.org/attachment.cgi?id=63118 Game-save screenshots2 - left = windows, right = Wine
Better comparison of game save screenshots made in Windows vs Wine (both are from loading screen). Even though they are made in different missions, the difference is clearly visible.
https://bugs.winehq.org/show_bug.cgi?id=46375
Paul Gofman gofmanp@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gofmanp@gmail.com
--- Comment #2 from Paul Gofman gofmanp@gmail.com --- Created attachment 63130 --> https://bugs.winehq.org/attachment.cgi?id=63130 test patch
The game is using user32.CopyImage() for image shrinking from screen size to thumbnail size. This is where colors get distorted. Wine uses default stretch blit mode (BLACKONWHITE) which distorts colored images on shrinking. According to my tests, Windows is doing halftone filtering in this case.
I am attaching the patch which fixes this (or at least greatly improves the look of the images) and also has some basic tests suggesting that Windows controls stretch mode in CopyImage(). I could not find any documentation where this behaviour is discussed. The fix sets stretch blit mode to HALFTONE in CopyImage for colored images. While HALFTONE stretch blit is not implemented in Wine gdi dibdrv (and so the test still does not pass), STRETCH_DELETESCANS it falls back to looks more appropriate for colored images than STRETCH_ANDSCANS (BLACKONWHITE).
https://bugs.winehq.org/show_bug.cgi?id=46375
--- Comment #3 from Jan Havran havran.jan@email.cz --- Created attachment 63137 --> https://bugs.winehq.org/attachment.cgi?id=63137 thumbnail comparsion with patched wine (L=Windows,R=Wine)
Good job Paul, I confirm that your patch rapidly improves look of the images, they are nearly the same as on Windows (except the horizontal and vertical lines).
Tested on Windows XP and Wine 4.0-rc2 with your patch.
https://bugs.winehq.org/show_bug.cgi?id=46375
--- Comment #4 from Mathew Hodson mathew.hodson@gmail.com --- https://source.winehq.org/git/wine.git/commitdiff/bfe1ea26dd5ee401159e117029...
https://bugs.winehq.org/show_bug.cgi?id=46375
--- Comment #5 from Paul Gofman gofmanp@gmail.com --- The patch tested here is committed, but this is not a complete fix yet, see Comment #2 and Comment #3. Lines in the image concerned in Comment #3 exhibit the aliasing effect which needs a true "halftone" interpolation to be avoided. I don't know actually if this bug should be closed or not.
https://bugs.winehq.org/show_bug.cgi?id=46375
--- Comment #6 from Jan Havran havran.jan@email.cz --- Paul Gofman: are you going to implement halftone in near future? I have no plans for doing it at the moment, but I want to avoid duplicate work in case I will find some time for it in the future. Or can you put a comment here if you start working on it?
About the closing of this bug: I let it open for now, but feel free to close it if any of Wine devs have different opinion - I will create new bug.
https://bugs.winehq.org/show_bug.cgi?id=46375
Zhiyi Zhang zzhang@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |zzhang@codeweavers.com Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #7 from Zhiyi Zhang zzhang@codeweavers.com --- Implementing HALFTONE mode
https://bugs.winehq.org/show_bug.cgi?id=46375
--- Comment #8 from Zhiyi Zhang zzhang@codeweavers.com --- HALFTONE is partially implemented at https://source.winehq.org/git/wine.git/commitdiff/04b4d0f380943bed5328c2957b... Please retest.
https://bugs.winehq.org/show_bug.cgi?id=46375
Zhiyi Zhang zzhang@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |04b4d0f380943bed5328c2957b5 | |0d975ecb55635 Resolution|--- |FIXED Status|NEW |RESOLVED
--- Comment #9 from Zhiyi Zhang zzhang@codeweavers.com --- HALFTONE is implemented by 04b4d0f380943bed5328c2957b50d975ecb55635. Closing.
https://bugs.winehq.org/show_bug.cgi?id=46375
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #10 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.16.