Fix image center flash during window resize on zoom#101
Fix image center flash during window resize on zoom#101justnullname wants to merge 1 commit intomainfrom
Conversation
Added DwmFlush() immediately after g_compEngine->Commit() in OnResize and WM_SIZE. This synchronizes the DirectComposition hardware transform submission with the Win32 WM_SIZE vsync, preventing a one-frame screen tearing/flickering issue where the window size was updated but the DirectComposition visual tree was not yet committed.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Fixed a visual bug where the image center flickers rapidly every few mouse scrolls when zooming in/out of an image while the "window adapts to image scale" mode is enabled.
The problem was caused by a synchronization issue between the Win32 Desktop Window Manager (DWM) and DirectComposition. When the window is resized and DirectComposition content changes simultaneously, race conditions can cause DWM to render a frame where the window size has updated but the DirectComposition visual tree hasn't been committed yet (or vice-versa), resulting in a one-frame flicker or "jump".
This commit fixes the issue by calling
DwmFlush()immediately afterg_compEngine->Commit()inOnResizeandWM_SIZE.DwmFlush()blocks the calling thread until the next DWM frame is presented, ensuring the DirectComposition changes and window resize are synchronized and rendered in the same frame.PR created automatically by Jules for task 6698394441088915593 started by @justnullname