mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 01:16:26 +00:00
video: wayland: Set the surface damage region when using fullscreen viewports
When using emulated display modes, the output size is often larger than the drawable buffer. As the surface damage region is automatically calculated from the smaller drawable buffer size, the damage region needs to be manually set to cover the entire viewport region or visual repaint artifacts can result.
This commit is contained in:
@@ -241,6 +241,11 @@ ConfigureViewport(SDL_Window *window)
|
||||
GetFullScreenDimensions(window, &fs_width, &fs_height, &src_width, &src_height);
|
||||
SetViewport(window, src_width, src_height, output->width, output->height);
|
||||
|
||||
data->damage_region.x = 0;
|
||||
data->damage_region.y = 0;
|
||||
data->damage_region.w = output->width;
|
||||
data->damage_region.h = output->height;
|
||||
|
||||
data->pointer_scale_x = (float)fs_width / (float)output->width;
|
||||
data->pointer_scale_y = (float)fs_height / (float)output->height;
|
||||
} else {
|
||||
@@ -253,6 +258,8 @@ ConfigureViewport(SDL_Window *window)
|
||||
UnsetViewport(window);
|
||||
}
|
||||
|
||||
SDL_zero(data->damage_region);
|
||||
|
||||
data->pointer_scale_x = 1.0f;
|
||||
data->pointer_scale_y = 1.0f;
|
||||
}
|
||||
@@ -400,6 +407,11 @@ handle_surface_frame_done(void *data, struct wl_callback *cb, uint32_t time)
|
||||
SDL_WindowData *wind = (SDL_WindowData *) data;
|
||||
SDL_AtomicSet(&wind->swap_interval_ready, 1); /* mark window as ready to present again. */
|
||||
|
||||
if (!SDL_RectEmpty(&wind->damage_region)) {
|
||||
wl_surface_damage(wind->surface, wind->damage_region.x, wind->damage_region.y,
|
||||
wind->damage_region.w, wind->damage_region.h);
|
||||
}
|
||||
|
||||
/* reset this callback to fire again once a new frame was presented and compositor wants the next one. */
|
||||
wind->frame_callback = wl_surface_frame(wind->frame_surface_wrapper);
|
||||
wl_callback_destroy(cb);
|
||||
|
Reference in New Issue
Block a user