From f38e215de57747d6f121730e4e92e1f90cb0cc03 Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:46:08 +0100 Subject: [PATCH] Fix build with devel logging, but without --enable-pixman If ./configure is used with devel logging, but without --enable-pixman, the stub pixman development files are used. However, in this configuration, the pixman_region_selfcheck() function is declared, but not defined. This is a regression introduced in 7e58209b195052205831d53a9f4cd0b4604a293d --- common/pixman-region.c | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/common/pixman-region.c b/common/pixman-region.c index 899bd58e..60977bf3 100644 --- a/common/pixman-region.c +++ b/common/pixman-region.c @@ -1631,3 +1631,78 @@ PREFIX (_extents) (region_type_t *region) return (®ion->extents); } +#ifdef USE_DEVEL_LOGGING +/* + * Clip a list of scanlines to a region. The caller has allocated the + * space. FSorted is non-zero if the scanline origins are in ascending order. + * + * returns the number of new, clipped scanlines. + * + * NB: For xrdp this function is only used if we are running devel logging + */ + +PIXMAN_EXPORT pixman_bool_t +PREFIX (_selfcheck) (region_type_t *reg) +{ + int i, numRects; + + if ((reg->extents.x1 > reg->extents.x2) || + (reg->extents.y1 > reg->extents.y2)) + { + return FALSE; + } + + numRects = PIXREGION_NUMRECTS (reg); + if (!numRects) + { + return ((reg->extents.x1 == reg->extents.x2) && + (reg->extents.y1 == reg->extents.y2) && + (reg->data->size || (reg->data == pixman_region_empty_data))); + } + else if (numRects == 1) + { + return (!reg->data); + } + else + { + box_type_t *pbox_p, *pbox_n; + box_type_t box; + + pbox_p = PIXREGION_RECTS (reg); + box = *pbox_p; + box.y2 = pbox_p[numRects - 1].y2; + pbox_n = pbox_p + 1; + + for (i = numRects; --i > 0; pbox_p++, pbox_n++) + { + if ((pbox_n->x1 >= pbox_n->x2) || + (pbox_n->y1 >= pbox_n->y2)) + { + return FALSE; + } + + if (pbox_n->x1 < box.x1) + { + box.x1 = pbox_n->x1; + } + + if (pbox_n->x2 > box.x2) + { + box.x2 = pbox_n->x2; + } + + if ((pbox_n->y1 < pbox_p->y1) || + ((pbox_n->y1 == pbox_p->y1) && + ((pbox_n->x1 < pbox_p->x2) || (pbox_n->y2 != pbox_p->y2)))) + { + return FALSE; + } + } + + return ((box.x1 == reg->extents.x1) && + (box.x2 == reg->extents.x2) && + (box.y1 == reg->extents.y1) && + (box.y2 == reg->extents.y2)); + } +} +#endif // USE_DEVEL_LOGGING