summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan <mail@3v1n0.net>2024-05-29 11:50:01 +0000
committerMatt Turner <mattst88@gmail.com>2024-08-14 02:41:08 +0000
commit5b8e92813950d2c83c0e3c2c0d1bedf067dba0ea (patch)
treec76a70f58ec7828c57384cd7d8b4a86ca522b4a5
parent2e29b7c43d5a3be7b70d4326f975ad1cdf18ac81 (diff)
pixman-region: Make translate a no-op when using 0 offsets
This avoids callers to have to optimize this codepath, in case this scenario happens. And definitely it may happen when the function is not explicitly called.
-rw-r--r--pixman/pixman-region.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 537d5fb..d75e519 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -2229,6 +2229,10 @@ PREFIX (_translate) (region_type_t *region, int x, int y)
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;