mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00
[uwac] scaling: fix damage surface
Some detailed overview of this change: I was trying to use the wl_surface_damage_buffer() [1] function, like in this [2] code, but there were some problems with calling it; even more, we also need to check the compositor version before calling it. Next approach was using full damage like described here [3]. This was working fine, but it was of course suboptimal. Finally: looking at chromium/ozone code [4] I ended up with correctly calculating the damage region within surface coordinates. Refs: [1] https://wayland-client-d.dpldocs.info/wayland.client.protocol.wl_surface_damage_buffer.html [2]b01c31b24f/clients/simple-damage.c (L585)
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1648872#c21 [4]6763b7710c/ui/ozone/platform/wayland/host/wayland_surface.cc (118)
This commit is contained in:
parent
b14fe531a6
commit
72b6c7096d
@ -677,26 +677,26 @@ static void frame_done_cb(void* data, struct wl_callback* callback, uint32_t tim
|
||||
static const struct wl_callback_listener frame_listener = { frame_done_cb };
|
||||
|
||||
#ifdef UWAC_HAVE_PIXMAN_REGION
|
||||
static void damage_surface(UwacWindow* window, UwacBuffer* buffer)
|
||||
static void damage_surface(UwacWindow* window, UwacBuffer* buffer, int scale)
|
||||
{
|
||||
int nrects, i;
|
||||
const pixman_box32_t* box = pixman_region32_rectangles(&buffer->damage, &nrects);
|
||||
|
||||
for (i = 0; i < nrects; i++, box++)
|
||||
wl_surface_damage(window->surface, box->x1, box->y1, (box->x2 - box->x1),
|
||||
(box->y2 - box->y1));
|
||||
wl_surface_damage(window->surface, box->x1 / scale, box->y1 / scale,
|
||||
(box->x2 - box->x1) / scale, (box->y2 - box->y1) / scale);
|
||||
|
||||
pixman_region32_clear(&buffer->damage);
|
||||
}
|
||||
#else
|
||||
static void damage_surface(UwacWindow* window, UwacBuffer* buffer)
|
||||
static void damage_surface(UwacWindow* window, UwacBuffer* buffer, int scale)
|
||||
{
|
||||
uint32_t nrects, i;
|
||||
const RECTANGLE_16* box = region16_rects(&buffer->damage, &nrects);
|
||||
|
||||
for (i = 0; i < nrects; i++, box++)
|
||||
wl_surface_damage(window->surface, box->left, box->top, (box->right - box->left),
|
||||
(box->bottom - box->top));
|
||||
wl_surface_damage(window->surface, box->left / scale, box->top / scale,
|
||||
(box->right - box->left) / scale, (box->bottom - box->top) / scale);
|
||||
|
||||
region16_clear(&buffer->damage);
|
||||
}
|
||||
@ -706,7 +706,8 @@ static void UwacSubmitBufferPtr(UwacWindow* window, UwacBuffer* buffer)
|
||||
{
|
||||
wl_surface_attach(window->surface, buffer->wayland_buffer, 0, 0);
|
||||
|
||||
damage_surface(window, buffer);
|
||||
int scale = window->display->actual_scale;
|
||||
damage_surface(window, buffer, scale);
|
||||
|
||||
struct wl_callback* frame_callback = wl_surface_frame(window->surface);
|
||||
wl_callback_add_listener(frame_callback, &frame_listener, window);
|
||||
|
Loading…
Reference in New Issue
Block a user