diff options
author | emersion <contact@emersion.fr> | 2018-06-02 15:19:03 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-06-02 15:19:03 +0100 |
commit | 65845be802673f50b3021999c4b59b1c7a7c8c39 (patch) | |
tree | aa7c5ac1dc49810234662798741130891dd72fcc /sway/desktop/output.c | |
parent | Merge pull request #2080 from frsfnrrg/keyboard-remodeling (diff) | |
download | sway-65845be802673f50b3021999c4b59b1c7a7c8c39.tar.gz sway-65845be802673f50b3021999c4b59b1c7a7c8c39.tar.zst sway-65845be802673f50b3021999c4b59b1c7a7c8c39.zip |
Only send frame done to visible views
Also don't accumulate empty damage
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 4047fa3f..763f053c 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -948,6 +948,11 @@ static void send_frame_done_container_iterator(struct sway_container *con, | |||
948 | if (!sway_assert(con->type == C_VIEW, "expected a view")) { | 948 | if (!sway_assert(con->type == C_VIEW, "expected a view")) { |
949 | return; | 949 | return; |
950 | } | 950 | } |
951 | |||
952 | if (!view_is_visible(con->sway_view)) { | ||
953 | return; | ||
954 | } | ||
955 | |||
951 | output_view_for_each_surface(con->sway_view, &data->root_geo, | 956 | output_view_for_each_surface(con->sway_view, &data->root_geo, |
952 | send_frame_done_iterator, data); | 957 | send_frame_done_iterator, data); |
953 | } | 958 | } |
@@ -1039,21 +1044,23 @@ static void damage_surface_iterator(struct wlr_surface *surface, int sx, int sy, | |||
1039 | int center_x = box.x + box.width/2; | 1044 | int center_x = box.x + box.width/2; |
1040 | int center_y = box.y + box.height/2; | 1045 | int center_y = box.y + box.height/2; |
1041 | 1046 | ||
1042 | pixman_region32_t damage; | 1047 | if (pixman_region32_not_empty(&surface->current->surface_damage)) { |
1043 | pixman_region32_init(&damage); | 1048 | pixman_region32_t damage; |
1044 | pixman_region32_copy(&damage, &surface->current->surface_damage); | 1049 | pixman_region32_init(&damage); |
1045 | wlr_region_scale(&damage, &damage, output->wlr_output->scale); | 1050 | pixman_region32_copy(&damage, &surface->current->surface_damage); |
1046 | if (ceil(output->wlr_output->scale) > surface->current->scale) { | 1051 | wlr_region_scale(&damage, &damage, output->wlr_output->scale); |
1047 | // When scaling up a surface, it'll become blurry so we need to | 1052 | if (ceil(output->wlr_output->scale) > surface->current->scale) { |
1048 | // expand the damage region | 1053 | // When scaling up a surface, it'll become blurry so we need to |
1049 | wlr_region_expand(&damage, &damage, | 1054 | // expand the damage region |
1050 | ceil(output->wlr_output->scale) - surface->current->scale); | 1055 | wlr_region_expand(&damage, &damage, |
1056 | ceil(output->wlr_output->scale) - surface->current->scale); | ||
1057 | } | ||
1058 | pixman_region32_translate(&damage, box.x, box.y); | ||
1059 | wlr_region_rotated_bounds(&damage, &damage, rotation, | ||
1060 | center_x, center_y); | ||
1061 | wlr_output_damage_add(output->damage, &damage); | ||
1062 | pixman_region32_fini(&damage); | ||
1051 | } | 1063 | } |
1052 | pixman_region32_translate(&damage, box.x, box.y); | ||
1053 | wlr_region_rotated_bounds(&damage, &damage, rotation, | ||
1054 | center_x, center_y); | ||
1055 | wlr_output_damage_add(output->damage, &damage); | ||
1056 | pixman_region32_fini(&damage); | ||
1057 | 1064 | ||
1058 | if (whole) { | 1065 | if (whole) { |
1059 | wlr_box_rotated_bounds(&box, rotation, &box); | 1066 | wlr_box_rotated_bounds(&box, rotation, &box); |