pixman: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Jul 9 01:53:32 UTC 2023
pixman/pixman-region.c | 8 ++++++++
pixman/pixman.c | 4 ++--
pixman/pixman.h | 6 ++++++
3 files changed, 16 insertions(+), 2 deletions(-)
New commits:
commit 672f67db96a1e8b1d80f64b9ba286220ca475ec8
Author: Simon Ser <contact at emersion.fr>
Date: Tue Apr 11 21:58:51 2023 +0200
Add pixman_region{,32}_empty()
Inverse of pixman_region32_not_empty().
Most of the time, callers want to check whether a region is empty,
not whether a region is not empty. This results in code with
double-negatives such as !pixman_region32_not_empty(), which is
confusing to read.
Signed-off-by: Simon Ser <contact at emersion.fr>
diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index a2daa27..537d5fb 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -2386,6 +2386,14 @@ PREFIX (_contains_point) (const region_type_t * region,
return(FALSE);
}
+PIXMAN_EXPORT int
+PREFIX (_empty) (const region_type_t * region)
+{
+ GOOD (region);
+
+ return(PIXREGION_NIL (region));
+}
+
PIXMAN_EXPORT int
PREFIX (_not_empty) (const region_type_t * region)
{
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 17015a8..82ec236 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -182,7 +182,7 @@ clip_general_image (pixman_region32_t * region,
return FALSE;
}
}
- else if (!pixman_region32_not_empty (clip))
+ else if (pixman_region32_empty (clip))
{
return FALSE;
}
@@ -277,7 +277,7 @@ _pixman_compute_composite_region32 (pixman_region32_t * region,
{
return FALSE;
}
- if (!pixman_region32_not_empty (region))
+ if (pixman_region32_empty (region))
return FALSE;
if (dest_image->common.alpha_map->common.have_clip_region)
{
diff --git a/pixman/pixman.h b/pixman/pixman.h
index 2cd875b..e6b235c 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -581,6 +581,9 @@ PIXMAN_API
pixman_region_overlap_t pixman_region_contains_rectangle (const pixman_region16_t *region,
const pixman_box16_t *prect);
+PIXMAN_API
+pixman_bool_t pixman_region_empty (const pixman_region16_t *region);
+
PIXMAN_API
pixman_bool_t pixman_region_not_empty (const pixman_region16_t *region);
@@ -722,6 +725,9 @@ PIXMAN_API
pixman_region_overlap_t pixman_region32_contains_rectangle (const pixman_region32_t *region,
const pixman_box32_t *prect);
+PIXMAN_API
+pixman_bool_t pixman_region32_empty (const pixman_region32_t *region);
+
PIXMAN_API
pixman_bool_t pixman_region32_not_empty (const pixman_region32_t *region);
More information about the xorg-commit
mailing list