mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 06:24:20 +01:00
desktop/render: Pass explicit clip box to render
render_surface_iterator previously deduced the clip box from an optional container passed with render data. This causes problems when offsets in view geometry need to be compensated for in the clip dimensions. Instead, prepare the clip box in render_view_toplevels where the offsets are being applied, and compensate for them immediately. A similar compensation is applied to render_saved_view. Closes: https://github.com/swaywm/sway/issues/6223
This commit is contained in:
parent
7ec9d07fc5
commit
4e6f515253
@ -32,7 +32,7 @@
|
|||||||
struct render_data {
|
struct render_data {
|
||||||
pixman_region32_t *damage;
|
pixman_region32_t *damage;
|
||||||
float alpha;
|
float alpha;
|
||||||
struct sway_container *container;
|
struct wlr_box *clip_box;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,10 +157,10 @@ static void render_surface_iterator(struct sway_output *output, struct sway_view
|
|||||||
wlr_output->transform_matrix);
|
wlr_output->transform_matrix);
|
||||||
|
|
||||||
struct wlr_box dst_box = *_box;
|
struct wlr_box dst_box = *_box;
|
||||||
struct sway_container *container = data->container;
|
struct wlr_box *clip_box = data->clip_box;
|
||||||
if (container != NULL) {
|
if (clip_box != NULL) {
|
||||||
dst_box.width = fmin(dst_box.width, container->current.content_width);
|
dst_box.width = fmin(dst_box.width, clip_box->width);
|
||||||
dst_box.height = fmin(dst_box.height, container->current.content_height);
|
dst_box.height = fmin(dst_box.height, clip_box->height);
|
||||||
}
|
}
|
||||||
scale_box(&dst_box, wlr_output->scale);
|
scale_box(&dst_box, wlr_output->scale);
|
||||||
|
|
||||||
@ -262,8 +262,13 @@ static void render_view_toplevels(struct sway_view *view,
|
|||||||
.damage = damage,
|
.damage = damage,
|
||||||
.alpha = alpha,
|
.alpha = alpha,
|
||||||
};
|
};
|
||||||
|
struct wlr_box clip_box;
|
||||||
if (!container_is_current_floating(view->container)) {
|
if (!container_is_current_floating(view->container)) {
|
||||||
data.container = view->container;
|
// As we pass the geometry offsets to the surface iterator, we will
|
||||||
|
// need to account for the offsets in the clip dimensions.
|
||||||
|
clip_box.width = view->container->current.content_width + view->geometry.x;
|
||||||
|
clip_box.height = view->container->current.content_height + view->geometry.y;
|
||||||
|
data.clip_box = &clip_box;
|
||||||
}
|
}
|
||||||
// Render all toplevels without descending into popups
|
// Render all toplevels without descending into popups
|
||||||
double ox = view->container->surface_x -
|
double ox = view->container->surface_x -
|
||||||
@ -329,10 +334,10 @@ static void render_saved_view(struct sway_view *view,
|
|||||||
if (!floating) {
|
if (!floating) {
|
||||||
dst_box.width = fmin(dst_box.width,
|
dst_box.width = fmin(dst_box.width,
|
||||||
view->container->current.content_width -
|
view->container->current.content_width -
|
||||||
(saved_buf->x - view->container->current.content_x));
|
(saved_buf->x - view->container->current.content_x) + view->saved_geometry.x);
|
||||||
dst_box.height = fmin(dst_box.height,
|
dst_box.height = fmin(dst_box.height,
|
||||||
view->container->current.content_height -
|
view->container->current.content_height -
|
||||||
(saved_buf->y - view->container->current.content_y));
|
(saved_buf->y - view->container->current.content_y) + view->saved_geometry.y);
|
||||||
}
|
}
|
||||||
scale_box(&dst_box, wlr_output->scale);
|
scale_box(&dst_box, wlr_output->scale);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user