From feb56912409d8208253942e48bcd861400f32172 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 24 Oct 2022 12:47:59 +0200 Subject: [PATCH] backend: remove const casts for pixman_region32_t Pixman 0.42.0 has constified APIs for pixman_region32_t. We no longer need the casts. --- backend/drm/atomic.c | 6 +++--- backend/wayland/output.c | 8 ++++---- backend/x11/output.c | 7 +++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index da1119b2..c882fff9 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -240,11 +240,11 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn, uint32_t fb_damage_clips = 0; if ((state->base->committed & WLR_OUTPUT_STATE_DAMAGE) && - pixman_region32_not_empty((pixman_region32_t *)&state->base->damage) && + pixman_region32_not_empty(&state->base->damage) && crtc->primary->props.fb_damage_clips != 0) { int rects_len; - const pixman_box32_t *rects = pixman_region32_rectangles( - (pixman_region32_t *)&state->base->damage, &rects_len); + const pixman_box32_t *rects = + pixman_region32_rectangles(&state->base->damage, &rects_len); if (drmModeCreatePropertyBlob(drm->fd, rects, sizeof(*rects) * rects_len, &fb_damage_clips) != 0) { wlr_log_errno(WLR_ERROR, "Failed to create FB_DAMAGE_CLIPS property blob"); diff --git a/backend/wayland/output.c b/backend/wayland/output.c index ea3c6dea..b09a30c8 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -291,9 +291,9 @@ static bool output_commit(struct wlr_output *wlr_output, output->surface); } - pixman_region32_t *damage = NULL; + const pixman_region32_t *damage = NULL; if (state->committed & WLR_OUTPUT_STATE_DAMAGE) { - damage = (pixman_region32_t *) &state->damage; + damage = &state->damage; } if (output->frame_callback != NULL) { @@ -318,10 +318,10 @@ static bool output_commit(struct wlr_output *wlr_output, 0, 0, INT32_MAX, INT32_MAX); } else { int rects_len; - pixman_box32_t *rects = + const pixman_box32_t *rects = pixman_region32_rectangles(damage, &rects_len); for (int i = 0; i < rects_len; i++) { - pixman_box32_t *r = &rects[i]; + const pixman_box32_t *r = &rects[i]; wl_surface_damage_buffer(output->surface, r->x1, r->y1, r->x2 - r->x1, r->y2 - r->y1); } diff --git a/backend/x11/output.c b/backend/x11/output.c index 05d53a43..7ea0459a 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -283,11 +283,10 @@ static bool output_commit_buffer(struct wlr_x11_output *output, xcb_xfixes_region_t region = XCB_NONE; if (state->committed & WLR_OUTPUT_STATE_DAMAGE) { - pixman_region32_union(&output->exposed, &output->exposed, - (pixman_region32_t *) &state->damage); + pixman_region32_union(&output->exposed, &output->exposed, &state->damage); int rects_len = 0; - pixman_box32_t *rects = pixman_region32_rectangles(&output->exposed, &rects_len); + const pixman_box32_t *rects = pixman_region32_rectangles(&output->exposed, &rects_len); xcb_rectangle_t *xcb_rects = calloc(rects_len, sizeof(xcb_rectangle_t)); if (!xcb_rects) { @@ -295,7 +294,7 @@ static bool output_commit_buffer(struct wlr_x11_output *output, } for (int i = 0; i < rects_len; i++) { - pixman_box32_t *box = &rects[i]; + const pixman_box32_t *box = &rects[i]; xcb_rects[i] = (struct xcb_rectangle_t){ .x = box->x1, .y = box->y1,