Skip to content

Fix image center flash during window resize on zoom#101

Open
justnullname wants to merge 1 commit intomainfrom
fix-resize-flash-6698394441088915593
Open

Fix image center flash during window resize on zoom#101
justnullname wants to merge 1 commit intomainfrom
fix-resize-flash-6698394441088915593

Conversation

@justnullname
Copy link
Copy Markdown
Owner

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 after g_compEngine->Commit() in OnResize and WM_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

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.
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant