mirror of
https://github.com/cage-kiosk/cage.git
synced 2025-11-01 22:58:41 -04:00
output: add cage_output_damage_surface
This commit is contained in:
parent
5feeb33505
commit
0e9dae18e6
3 changed files with 30 additions and 19 deletions
|
|
@ -48,6 +48,33 @@ cage_output_damage_region(struct cg_output *output, struct wlr_box *region)
|
||||||
wlr_output_damage_add_box(output->damage, region);
|
wlr_output_damage_add_box(output->damage, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cage_output_damage_surface(struct cg_output *output, struct wlr_surface *surface, int sx, int sy)
|
||||||
|
{
|
||||||
|
assert(output != NULL);
|
||||||
|
assert(surface != NULL);
|
||||||
|
struct wlr_output *wlr_output = output->wlr_output;
|
||||||
|
|
||||||
|
assert(wlr_output->enabled);
|
||||||
|
|
||||||
|
if (pixman_region32_not_empty(&surface->buffer_damage)) {
|
||||||
|
pixman_region32_t damage;
|
||||||
|
pixman_region32_init(&damage);
|
||||||
|
wlr_surface_get_effective_damage(surface, &damage);
|
||||||
|
|
||||||
|
wlr_region_scale(&damage, &damage, wlr_output->scale);
|
||||||
|
if (ceil(wlr_output->scale) > surface->current.scale) {
|
||||||
|
/* When scaling up a surface it'll becomevblurry, so we
|
||||||
|
* need to expand the damage region. */
|
||||||
|
wlr_region_expand(&damage, &damage, ceil(wlr_output->scale) - surface->current.scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
pixman_region32_translate(&damage, sx, sy);
|
||||||
|
wlr_output_damage_add(output->damage, &damage);
|
||||||
|
pixman_region32_fini(&damage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct send_frame_done_data {
|
struct send_frame_done_data {
|
||||||
struct timespec when;
|
struct timespec when;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include <wlr/types/wlr_box.h>
|
#include <wlr/types/wlr_box.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include <wlr/types/wlr_output_damage.h>
|
#include <wlr/types/wlr_output_damage.h>
|
||||||
|
#include <wlr/types/wlr_surface.h>
|
||||||
|
|
||||||
struct cg_output {
|
struct cg_output {
|
||||||
struct wlr_output *wlr_output;
|
struct wlr_output *wlr_output;
|
||||||
|
|
@ -26,6 +27,7 @@ struct cg_output {
|
||||||
|
|
||||||
void cage_output_damage_whole(struct cg_output *output);
|
void cage_output_damage_whole(struct cg_output *output);
|
||||||
void cage_output_damage_region(struct cg_output *output, struct wlr_box *region);
|
void cage_output_damage_region(struct cg_output *output, struct wlr_box *region);
|
||||||
|
void cage_output_damage_surface(struct cg_output *output, struct wlr_surface *surface, int sx, int sy);
|
||||||
void cage_output_get_geometry(struct cg_output *output, struct wlr_box *geometry);
|
void cage_output_get_geometry(struct cg_output *output, struct wlr_box *geometry);
|
||||||
void cage_output_disable(struct cg_output *output);
|
void cage_output_disable(struct cg_output *output);
|
||||||
void cage_output_enable(struct cg_output *output);
|
void cage_output_enable(struct cg_output *output);
|
||||||
|
|
|
||||||
|
|
@ -70,25 +70,7 @@ static void
|
||||||
damage_surface_iterator(struct wlr_surface *surface, int sx, int sy, void *user_data)
|
damage_surface_iterator(struct wlr_surface *surface, int sx, int sy, void *user_data)
|
||||||
{
|
{
|
||||||
struct cg_view *view = (struct cg_view *) surface->data;
|
struct cg_view *view = (struct cg_view *) surface->data;
|
||||||
struct cg_output *output = view->output;
|
cage_output_damage_surface(view->output, surface, sx, sy);
|
||||||
struct wlr_output *wlr_output = output->wlr_output;
|
|
||||||
|
|
||||||
if (pixman_region32_not_empty(&surface->buffer_damage)) {
|
|
||||||
pixman_region32_t damage;
|
|
||||||
pixman_region32_init(&damage);
|
|
||||||
wlr_surface_get_effective_damage(surface, &damage);
|
|
||||||
|
|
||||||
wlr_region_scale(&damage, &damage, wlr_output->scale);
|
|
||||||
if (ceil(wlr_output->scale) > surface->current.scale) {
|
|
||||||
/* When scaling up a surface it'll become
|
|
||||||
blurry, so we need to expand the damage
|
|
||||||
region. */
|
|
||||||
wlr_region_expand(&damage, &damage, ceil(wlr_output->scale) - surface->current.scale);
|
|
||||||
}
|
|
||||||
pixman_region32_translate(&damage, sx, sy);
|
|
||||||
wlr_output_damage_add(output->damage, &damage);
|
|
||||||
pixman_region32_fini(&damage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue