pixman: Branch 'master' - 2 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 9 21:26:39 UTC 2025
pixman/pixman-region.c | 152 +++++++++++++++++++++++++++++++++++++++++++++++++
pixman/pixman.h | 11 +++
2 files changed, 163 insertions(+)
New commits:
commit 4d1bc50bb426fcd532094c0467266123f0f3d4a8
Author: Loukas Agorgianitis <loukas at agorgianitis.com>
Date: Fri May 30 12:02:12 2025 +0300
region: add contains_pointf function for fractional regions
Signed-off-by: Loukas Agorgianitis <loukas at agorgianitis.com>
diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 960425b..aedaee1 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -2573,6 +2573,50 @@ PREFIX (_contains_point) (const region_type_t * region,
return(FALSE);
}
+PIXMAN_EXPORT int
+PREFIX (_contains_pointf) (const region_type_t * region,
+ double x, double y,
+ box_type_t * box)
+{
+ box_type_t *pbox, *pbox_end;
+ int numRects;
+
+ GOOD (region);
+ numRects = PIXREGION_NUMRECTS (region);
+
+ if (!numRects || !INBOX (®ion->extents, x, y))
+ return(FALSE);
+
+ if (numRects == 1)
+ {
+ if (box)
+ *box = region->extents;
+
+ return(TRUE);
+ }
+
+ pbox = PIXREGION_BOXPTR (region);
+ pbox_end = pbox + numRects;
+
+ pbox = find_box_for_y (pbox, pbox_end, y);
+
+ for (;pbox != pbox_end; pbox++)
+ {
+ if ((y < pbox->y1) || (x < pbox->x1))
+ break; /* missed it */
+
+ if (x >= pbox->x2)
+ continue; /* not there yet */
+
+ if (box)
+ *box = *pbox;
+
+ return(TRUE);
+ }
+
+ return(FALSE);
+}
+
PIXMAN_EXPORT int
PREFIX (_empty) (const region_type_t * region)
{
diff --git a/pixman/pixman.h b/pixman/pixman.h
index f035cb5..3cfe36d 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -893,6 +893,12 @@ pixman_bool_t pixman_region64f_contains_point (const pixman_region6
int y,
pixman_box64f_t *box);
+PIXMAN_API
+pixman_bool_t pixman_region64f_contains_pointf (const pixman_region64f_t *region,
+ double x,
+ double y,
+ pixman_box64f_t *box);
+
PIXMAN_API
pixman_region_overlap_t pixman_region64f_contains_rectangle(const pixman_region64f_t *region,
const pixman_box64f_t *prect);
commit aafa6b51f608a46a33ad23dfe13c3c7bd8ab10a1
Author: Loukas Agorgianitis <loukas at agorgianitis.com>
Date: Fri May 30 12:01:54 2025 +0300
region: add translatef function for fractional regions
Signed-off-by: Loukas Agorgianitis <loukas at agorgianitis.com>
diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 849f615..960425b 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -2396,6 +2396,114 @@ PREFIX (_translate) (region_type_t *region, int x, int y)
GOOD (region);
}
+PIXMAN_EXPORT void
+PREFIX (_translatef) (region_type_t *region, double x, double y)
+{
+ double x1, x2, y1, y2;
+ int nbox;
+ box_type_t * pbox;
+
+ GOOD (region);
+
+ if (x == 0 && y == 0)
+ return;
+
+ region->extents.x1 = x1 = region->extents.x1 + x;
+ region->extents.y1 = y1 = region->extents.y1 + y;
+ region->extents.x2 = x2 = region->extents.x2 + x;
+ region->extents.y2 = y2 = region->extents.y2 + y;
+
+ if ((((overflow_int_t)(x1 - PIXMAN_REGION_MIN)) |
+ ((overflow_int_t)(y1 - PIXMAN_REGION_MIN)) |
+ ((overflow_int_t)(PIXMAN_REGION_MAX - x2)) |
+ ((overflow_int_t)(PIXMAN_REGION_MAX - y2))) >= 0)
+ {
+ if (region->data && (nbox = region->data->numRects))
+ {
+ for (pbox = PIXREGION_BOXPTR (region); nbox--; pbox++)
+ {
+ pbox->x1 += x;
+ pbox->y1 += y;
+ pbox->x2 += x;
+ pbox->y2 += y;
+ }
+ }
+ return;
+ }
+
+ if ((((overflow_int_t)(x2 - PIXMAN_REGION_MIN)) |
+ ((overflow_int_t)(y2 - PIXMAN_REGION_MIN)) |
+ ((overflow_int_t)(PIXMAN_REGION_MAX - x1)) |
+ ((overflow_int_t)(PIXMAN_REGION_MAX - y1))) <= 0)
+ {
+ region->extents.x2 = region->extents.x1;
+ region->extents.y2 = region->extents.y1;
+ FREE_DATA (region);
+ region->data = pixman_region_empty_data;
+ return;
+ }
+
+ if (x1 < PIXMAN_REGION_MIN)
+ region->extents.x1 = PIXMAN_REGION_MIN;
+ else if (x2 > PIXMAN_REGION_MAX)
+ region->extents.x2 = PIXMAN_REGION_MAX;
+
+ if (y1 < PIXMAN_REGION_MIN)
+ region->extents.y1 = PIXMAN_REGION_MIN;
+ else if (y2 > PIXMAN_REGION_MAX)
+ region->extents.y2 = PIXMAN_REGION_MAX;
+
+ if (region->data && (nbox = region->data->numRects))
+ {
+ box_type_t * pbox_out;
+
+ for (pbox_out = pbox = PIXREGION_BOXPTR (region); nbox--; pbox++)
+ {
+ pbox_out->x1 = x1 = pbox->x1 + x;
+ pbox_out->y1 = y1 = pbox->y1 + y;
+ pbox_out->x2 = x2 = pbox->x2 + x;
+ pbox_out->y2 = y2 = pbox->y2 + y;
+
+ if ((((overflow_int_t)(x2 - PIXMAN_REGION_MIN)) |
+ ((overflow_int_t)(y2 - PIXMAN_REGION_MIN)) |
+ ((overflow_int_t)(PIXMAN_REGION_MAX - x1)) |
+ ((overflow_int_t)(PIXMAN_REGION_MAX - y1))) <= 0)
+ {
+ region->data->numRects--;
+ continue;
+ }
+
+ if (x1 < PIXMAN_REGION_MIN)
+ pbox_out->x1 = PIXMAN_REGION_MIN;
+ else if (x2 > PIXMAN_REGION_MAX)
+ pbox_out->x2 = PIXMAN_REGION_MAX;
+
+ if (y1 < PIXMAN_REGION_MIN)
+ pbox_out->y1 = PIXMAN_REGION_MIN;
+ else if (y2 > PIXMAN_REGION_MAX)
+ pbox_out->y2 = PIXMAN_REGION_MAX;
+
+ pbox_out++;
+ }
+
+ if (pbox_out != pbox)
+ {
+ if (region->data->numRects == 1)
+ {
+ region->extents = *PIXREGION_BOXPTR (region);
+ FREE_DATA (region);
+ region->data = (region_data_type_t *)NULL;
+ }
+ else
+ {
+ pixman_set_extents (region);
+ }
+ }
+ }
+
+ GOOD (region);
+}
+
PIXMAN_EXPORT void
PREFIX (_reset) (region_type_t *region, const box_type_t *box)
{
diff --git a/pixman/pixman.h b/pixman/pixman.h
index 7a3dff8..f035cb5 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -826,6 +826,11 @@ void pixman_region64f_translate (pixman_region64f_t *
int x,
int y);
+PIXMAN_API
+void pixman_region64f_translatef (pixman_region64f_t *region,
+ double x,
+ double y);
+
PIXMAN_API
pixman_bool_t pixman_region64f_copy (pixman_region64f_t *dest,
const pixman_region64f_t *source);
More information about the xorg-commit
mailing list