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.
This commit is contained in:
Simon Ser 2022-10-24 12:47:59 +02:00 committed by Simon Zeni
parent 8bbe8624df
commit feb5691240
3 changed files with 10 additions and 11 deletions

View file

@ -240,11 +240,11 @@ static bool atomic_crtc_commit(struct wlr_drm_connector *conn,
uint32_t fb_damage_clips = 0; uint32_t fb_damage_clips = 0;
if ((state->base->committed & WLR_OUTPUT_STATE_DAMAGE) && 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) { crtc->primary->props.fb_damage_clips != 0) {
int rects_len; int rects_len;
const pixman_box32_t *rects = pixman_region32_rectangles( const pixman_box32_t *rects =
(pixman_region32_t *)&state->base->damage, &rects_len); pixman_region32_rectangles(&state->base->damage, &rects_len);
if (drmModeCreatePropertyBlob(drm->fd, rects, if (drmModeCreatePropertyBlob(drm->fd, rects,
sizeof(*rects) * rects_len, &fb_damage_clips) != 0) { sizeof(*rects) * rects_len, &fb_damage_clips) != 0) {
wlr_log_errno(WLR_ERROR, "Failed to create FB_DAMAGE_CLIPS property blob"); wlr_log_errno(WLR_ERROR, "Failed to create FB_DAMAGE_CLIPS property blob");

View file

@ -291,9 +291,9 @@ static bool output_commit(struct wlr_output *wlr_output,
output->surface); output->surface);
} }
pixman_region32_t *damage = NULL; const pixman_region32_t *damage = NULL;
if (state->committed & WLR_OUTPUT_STATE_DAMAGE) { if (state->committed & WLR_OUTPUT_STATE_DAMAGE) {
damage = (pixman_region32_t *) &state->damage; damage = &state->damage;
} }
if (output->frame_callback != NULL) { if (output->frame_callback != NULL) {
@ -318,10 +318,10 @@ static bool output_commit(struct wlr_output *wlr_output,
0, 0, INT32_MAX, INT32_MAX); 0, 0, INT32_MAX, INT32_MAX);
} else { } else {
int rects_len; int rects_len;
pixman_box32_t *rects = const pixman_box32_t *rects =
pixman_region32_rectangles(damage, &rects_len); pixman_region32_rectangles(damage, &rects_len);
for (int i = 0; i < rects_len; i++) { 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, wl_surface_damage_buffer(output->surface, r->x1, r->y1,
r->x2 - r->x1, r->y2 - r->y1); r->x2 - r->x1, r->y2 - r->y1);
} }

View file

@ -283,11 +283,10 @@ static bool output_commit_buffer(struct wlr_x11_output *output,
xcb_xfixes_region_t region = XCB_NONE; xcb_xfixes_region_t region = XCB_NONE;
if (state->committed & WLR_OUTPUT_STATE_DAMAGE) { if (state->committed & WLR_OUTPUT_STATE_DAMAGE) {
pixman_region32_union(&output->exposed, &output->exposed, pixman_region32_union(&output->exposed, &output->exposed, &state->damage);
(pixman_region32_t *) &state->damage);
int rects_len = 0; 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)); xcb_rectangle_t *xcb_rects = calloc(rects_len, sizeof(xcb_rectangle_t));
if (!xcb_rects) { 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++) { 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){ xcb_rects[i] = (struct xcb_rectangle_t){
.x = box->x1, .x = box->x1,
.y = box->y1, .y = box->y1,