https://bugs.winehq.org/show_bug.cgi?id=54271
Bug ID: 54271 Summary: gdiplus:get_gif_background_color can't get gif background color Product: Wine Version: unspecified Hardware: x86 OS: other Status: UNCONFIRMED Severity: critical Priority: P2 Component: gdiplus Assignee: wine-bugs@winehq.org Reporter: 399989567@qq.com
Created attachment 73837 --> https://bugs.winehq.org/attachment.cgi?id=73837 wrong picture
OS:debian
When I was using WeChat, I found that when sending an animated gif, the same image would have different serious errors, such as misalignment, flickering, solid black(sometimes pink, brown) background .
I know that using winetricks gidplus can fix this problem, but this method introduces some other problems, so I come here for help hoping to find a solution to the problem. I really need your help! ! !
Maybe you need an account for this application. Of course, it would be great if you can find a similar demo. I am trying to find a demo
APP download url:https://weixin.qq.com/
https://bugs.winehq.org/show_bug.cgi?id=54271
Bartosz gang65@poczta.onet.pl changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gang65@poczta.onet.pl
https://bugs.winehq.org/show_bug.cgi?id=54271
--- Comment #1 from Bartosz gang65@poczta.onet.pl --- How I could reproduce the issue? Please provide step by step instruction.
https://bugs.winehq.org/show_bug.cgi?id=54271
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEEDINFO Hardware|x86 |x86-64 OS|other |Linux Ever confirmed|0 |1 Distribution|--- |Debian Severity|critical |normal
--- Comment #2 from Gijs Vermeulen gijsvrm@gmail.com --- Not critical, see: https://wiki.winehq.org/Bugs#severity
What version of wine did you test with? Please attach (not paste) the full terminal output as well, see: https://wiki.winehq.org/FAQ#How_can_I_get_a_debugging_log_.28a.k.a._terminal...
https://bugs.winehq.org/show_bug.cgi?id=54271
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|gdiplus:get_gif_background_ |WeChat has graphical |color can't get gif |artifacts displaying |background color |animated GIFs
https://bugs.winehq.org/show_bug.cgi?id=54271
--- Comment #3 from 399989567@qq.com --- (In reply to Bartosz from comment #1)
How I could reproduce the issue? Please provide step by step instruction.
1: You need download windows-wechat from https://weixin.qq.com/
2:Unfortunately, you need to register an account: https://wise.com/zh-cn/blog/wechat-registration (if you need help can email me)
3.Use the mobile phone's WeChat to scan the QR code of the computer to log in
4.Send gif emoticons to others to reproduce this problem
https://bugs.winehq.org/show_bug.cgi?id=54271
--- Comment #4 from 399989567@qq.com --- (In reply to Gijs Vermeulen from comment #2)
Not critical, see: https://wiki.winehq.org/Bugs#severity
What version of wine did you test with? Please attach (not paste) the full terminal output as well, see: https://wiki.winehq.org/FAQ#How_can_I_get_a_debugging_log_.28a.k.a. _terminal_output.29.3F
version:7.22 bug log: the next attachment
https://bugs.winehq.org/show_bug.cgi?id=54271
--- Comment #5 from 399989567@qq.com --- Created attachment 73848 --> https://bugs.winehq.org/attachment.cgi?id=73848 gif wrong log
This bug has been reproduced from 7.12 to 7.22, because I failed to compile 8.1, so I reproduced this problem with 7.22 as the prototype
https://bugs.winehq.org/show_bug.cgi?id=54271
--- Comment #6 from 399989567@qq.com --- (In reply to Bartosz from comment #1)
How I could reproduce the issue? Please provide step by step instruction.
A relatively new clue: I commented out everything in get_gif_background_color and used the following writeup, and the background color no longer shows up as solid black (or various other strange colors)
Is there a problem with reading in the data
'''
/* Get window handle by pid */ HWND GetHwndByPid(DWORD dwProcessID) { HWND h = GetTopWindow(0); HWND retHwnd = NULL; while (h) { DWORD pid = 0; DWORD dwTheardId = GetWindowThreadProcessId(h, &pid); if (dwTheardId != 0) if (pid == dwProcessID && GetParent(h) == NULL && IsWindowVisible(h)) retHwnd = h; h = GetNextWindow(h, GW_HWNDNEXT); } return retHwnd; }
/* Get the default background color of the window */ static DWORD get_win_default_background_color(void) { DWORD pid = GetCurrentProcessId(); if(pid) { HWND hwnd = GetHwndByPid(pid); if(hwnd) return GetClassLongW(hwnd,GCLP_HBRBACKGROUND); } return 0xffffffff; }
static DWORD get_gif_background_color(GpBitmap *bitmap) { BYTE bgcolor_idx = 0; UINT i;
// for(i=0; i<bitmap->prop_count; i++) { // if(bitmap->prop_item[i].id == PropertyTagIndexBackground) { // bgcolor_idx = *(BYTE*)bitmap->prop_item[i].value; // break; // } // } // // for(i=0; i<bitmap->prop_count; i++) { // if(bitmap->prop_item[i].id == PropertyTagIndexTransparent) { // BYTE transparent_idx; // transparent_idx = *(BYTE*)bitmap->prop_item[i].value; // // if(transparent_idx == bgcolor_idx) // return 0; // } // } // // for(i=0; i<bitmap->prop_count; i++) { // if(bitmap->prop_item[i].id == PropertyTagGlobalPalette) { // if(bitmap->prop_item[i].length/3 > bgcolor_idx) { // BYTE *color = ((BYTE*)bitmap->prop_item[i].value)+bgcolor_idx*3; // return color[2] + (color[1]<<8) + (color[0]<<16) + (0xffu<<24); // } // break; // } // }
FIXME("can't get gif background color\n"); return get_win_default_background_color(); }
'''
https://bugs.winehq.org/show_bug.cgi?id=54271
--- Comment #7 from 399989567@qq.com --- In the wrong picture I submitted, there are two errors: 1. The first gif in the wrong picture is the misplaced wrong 2. The background of the 2nd and 3rd gif in the wrong picture flickers wildly in black (other gifs may be red, brown, yellow, etc.)
I still don't know the reason for the first question, but I already know the reason for the second question:
In the function get_gif_background_color we will get two colors: - PropertyTagIndexBackground - PropertyTagIndexTransparent
The color is expressed in 8-digit hexadecimal, the first 6 digits represent RGB, and the last digit represents transparency.
The reason for the problem is that all 8-digit hexadecimal values of the obtained PropertyTagIndexBackground and PropertyTagIndexTransparent are compared in the source code, and it is expected to return 0 when the two data are equal
// if(transparent_idx == bgcolor_idx) // { // return 0; // }
But there is a problem here. When RGB is 0 and the transparency is different, the function does not return here, but enters the subsequent logic (in the subsequent logic, the above-mentioned flashing red and black are calculated. , white, brown, etc.)
Therefore, you only need to add a judgment here. When the first six bits are equal and 0, return 0 directly here without judging the transparency.
The second problem can be solved by the method I said, but I still don't understand the reason for the first problem.
For the first question, I really need your help. If you don't know how to reproduce this problem, we can make an appointment for a suitable time, and I will help you reproduce the problem online (by zoom or other thing)
https://bugs.winehq.org/show_bug.cgi?id=54271
399989567@qq.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|WeChat has graphical |WeChat gif shows misplaced |artifacts displaying | |animated GIFs |
https://bugs.winehq.org/show_bug.cgi?id=54271
cuijiajin cuijiajin@uniontech.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |cuijiajin@uniontech.com
--- Comment #8 from cuijiajin cuijiajin@uniontech.com --- I've sent a patch that should fix it: https://gitlab.winehq.org/wine/wine/-/merge_requests/3131