drisw/xlib: loop over all the boxes in display() hook

Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27703>
This commit is contained in:
Mike Blumenkrantz 2024-02-12 14:00:44 -05:00 committed by Marge Bot
parent c83768c76c
commit 389e83c4fe

View file

@ -315,7 +315,8 @@ xlib_sw_display(struct xlib_drawable *xlib_drawable,
if (no_swap)
return;
if (nboxes != 1) {
if (!nboxes) {
nboxes = 1;
_box.width = xlib_dt->width;
_box.height = xlib_dt->height;
box = &_box;
@ -350,33 +351,35 @@ xlib_sw_display(struct xlib_drawable *xlib_drawable,
XSetFunction(display, xlib_dt->gc, GXcopy);
}
if (xlib_dt->shm) {
ximage = xlib_dt->tempImage;
ximage->data = xlib_dt->data;
for (unsigned i = 0; i < nboxes; i++) {
if (xlib_dt->shm) {
ximage = xlib_dt->tempImage;
ximage->data = xlib_dt->data;
/* _debug_printf("XSHM\n"); */
XShmPutImage(xlib_dt->display, xlib_drawable->drawable, xlib_dt->gc,
ximage, box->x, box->y, box->x, box->y,
box->width, box->height, False);
}
else {
/* display image in Window */
ximage = xlib_dt->tempImage;
ximage->data = xlib_dt->data;
/* _debug_printf("XSHM\n"); */
XShmPutImage(xlib_dt->display, xlib_drawable->drawable, xlib_dt->gc,
ximage, box[i].x, box[i].y, box[i].x, box[i].y,
box[i].width, box[i].height, False);
}
else {
/* display image in Window */
ximage = xlib_dt->tempImage;
ximage->data = xlib_dt->data;
/* check that the XImage has been previously initialized */
assert(ximage->format);
assert(ximage->bitmap_unit);
/* check that the XImage has been previously initialized */
assert(ximage->format);
assert(ximage->bitmap_unit);
/* update XImage's fields */
ximage->width = xlib_dt->width;
ximage->height = xlib_dt->height;
ximage->bytes_per_line = xlib_dt->stride;
/* update XImage's fields */
ximage->width = xlib_dt->width;
ximage->height = xlib_dt->height;
ximage->bytes_per_line = xlib_dt->stride;
/* _debug_printf("XPUT\n"); */
XPutImage(xlib_dt->display, xlib_drawable->drawable, xlib_dt->gc,
ximage, box->x, box->y, box->x, box->y,
box->width, box->height);
/* _debug_printf("XPUT\n"); */
XPutImage(xlib_dt->display, xlib_drawable->drawable, xlib_dt->gc,
ximage, box[i].x, box[i].y, box[i].x, box[i].y,
box[i].width, box[i].height);
}
}
XFlush(xlib_dt->display);