Skip to content

fix: texture stretching during resize#327

Open
Stumblinbear wants to merge 11 commits intojnschulze:mainfrom
theblitzapp:fix-windows-resize-stretching
Open

fix: texture stretching during resize#327
Stumblinbear wants to merge 11 commits intojnschulze:mainfrom
theblitzapp:fix-windows-resize-stretching

Conversation

@Stumblinbear
Copy link

@Stumblinbear Stumblinbear commented Mar 4, 2026

This resolves the issue of the texture being stretched when the WebView is resized. This PR results in the texture being cut off instead of stretching, which (while still not great) is a big improvement over the previous behavior.

Recording.2026-03-04.174536.mp4

To resolve the issue, we call texture_registrar_->MarkTextureFrameAvailable(texture_id_); when receiving setSize over the platform channel. This tells Flutter to call GetSurfaceDescriptor, which syncs the size of the texture on the next frame (oftentimes the current frame) instead of being delayed until WebView2 produces a frame.

However, this still results in resizing the window being unusually heavy and a bit janky. To fix this, I set the frame pool to over-size itself by 25% so that rapid changes in the size (which typically occurs when resizing a window) doesn't result in dozens of intermediate textures being created and destroyed.

Lastly, I've created a render object to dispatch the setSize call during layout instead of waiting for a size change notification. This is admittedly a somewhat minor performance improvement, but does reduce the time it takes for the call to make it to the platform channel

Resolves #307

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.

webview content like a spring when dragging

1 participant