From 99b3c4575f12f97c0a331dd420514da5b3fbe80e Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 31 Dec 2018 23:54:06 +0000 Subject: [PATCH] Fix handling of region == NULL in paint_all_new Signed-off-by: Yuxuan Shui --- src/backend/backend.c | 21 ++++++++++++++------- src/backend/backend_common.c | 2 -- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/backend/backend.c b/src/backend/backend.c index 7a705b1..0bbc095 100644 --- a/src/backend/backend.c +++ b/src/backend/backend.c @@ -18,23 +18,30 @@ bool default_is_frame_transparent(void *backend_data, win *w, void *win_data) { } /// paint all windows -void paint_all_new(session_t *ps, region_t *region, win *const t) { +void paint_all_new(session_t *ps, region_t *_region, win *const t) { auto bi = backend_list[ps->o.backend]; assert(bi); + const region_t *region; + if (!_region) { + region = &ps->screen_reg; + } else { + // Ignore out-of-screen damages + pixman_region32_intersect(_region, _region, &ps->screen_reg); + region = _region; + } + #ifdef DEBUG_REPAINT static struct timespec last_paint = {0}; #endif - // Ignore out-of-screen damages - pixman_region32_intersect(region, region, &ps->screen_reg); - - region_t reg_tmp, *reg_paint; + region_t reg_tmp; + const region_t *reg_paint; pixman_region32_init(®_tmp); if (t) { // Calculate the region upon which the root window (wallpaper) is to be // painted based on the ignore region of the lowest window, if available - pixman_region32_subtract(®_tmp, region, t->reg_ignore); + pixman_region32_subtract(®_tmp, (region_t *)region, t->reg_ignore); reg_paint = ®_tmp; } else { reg_paint = region; @@ -52,7 +59,7 @@ void paint_all_new(session_t *ps, region_t *region, win *const t) { // Calculate the region based on the reg_ignore of the next (higher) // window and the bounding region // XXX XXX - pixman_region32_subtract(®_tmp, region, w->reg_ignore); + pixman_region32_subtract(®_tmp, (region_t *)region, w->reg_ignore); if (pixman_region32_not_empty(®_tmp)) { // Render window content diff --git a/src/backend/backend_common.c b/src/backend/backend_common.c index 2cdc2e7..6c19d23 100644 --- a/src/backend/backend_common.c +++ b/src/backend/backend_common.c @@ -244,5 +244,3 @@ shadow_picture_err: return false; } - -// vim: set noet sw=8 ts=8 :