Repository navigation
Conversation
… own size: its edge texels fill the rest until the next buffer, instead of the buffer stretched over the slot while a window grows
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a window grows faster than its client draws (an interactive resize, for example), the forced slot of the window is larger than the client's last buffer.
ClippedSurfaceElementdraws a quad that covers the slot, and the texture coordinates map that whole quad onto the buffer. The old buffer is then stretched over the larger slot until the client commits a buffer of the new size. The window content visibly scales during the resize.Fix
backend/clipped_surface.rs: newcompute_sample_fit(element, drawn, transform). If the drawn quad differs from the surface's own geometry and the buffer transform isNormal, it returns a scale and an offset so thatbuffer = quad * scale - offsetin 0..1 coordinates. The buffer keeps its own size and position in the quad. The UV compensation now projects onto the surface's own geometry when the fit is enabled, and onto the whole quad otherwise (as before, which handles the 1 px larger quad without blur).sample_fit_scale,sample_fit_offsetandsample_fit_enabled, registered with the program and set per element. The solid-colour constructor uses a disabled fit.backend/clipped_surface.frag: when the fit is enabled, the sample coordinates are first mapped through the fit, then through the existing compensation. At the end they are clamped to half a texel inside the buffer, so the area past the buffer repeats the buffer's edge texels instead of sampling the other side or blending.A transformed buffer (rotated or flipped) keeps the old behaviour.
Tests
Unit tests added in
clipped_surface.rs:no_fit_when_the_quad_is_the_surfacea_grown_slot_keeps_the_buffer_at_its_sizea_slot_grown_up_and_left_offsets_the_buffera_transformed_buffer_is_not_fittedcargo test --workspacepasses, except two tests that also fail on upstreammainin our environment:evaluator::tests::embedded_runtime_ipc_does_not_leak_fds_across_reloadsandinput_method_keyboard_grab_gets_the_keymap_of_the_keys_it_is_sent.The shader change is not covered by an automated test. It has been running daily in the author's own session (a Windows-7-like desktop on ShojiWM).