From cb4ea3e7fb36d942dd9d495462fc591f54707b40 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 14 Jul 2023 15:35:58 +0800 Subject: [PATCH] Update Android port * src/android.c (android_blit_copy): Don't check for overflow where not required. --- src/android.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/android.c b/src/android.c index f8ad78a2b39..acc49219b35 100644 --- a/src/android.c +++ b/src/android.c @@ -4382,13 +4382,16 @@ android_blit_copy (int src_x, int src_y, int width, int height, overlap. Calculate the coordinate of the last pixel of the last row in both src and dst. */ - overflow = ckd_mul (&start, src_y + height - 1, - src_info->stride); - if (mask) /* If a mask is set, put the pointers before the end - of the row. */ + overflow = ckd_mul (&start, src_y + height - 1, + src_info->stride); + + if (mask) + /* If a mask is set, put the pointers before the end of the + row. */ overflow |= ckd_mul (&end, src_x + width - 1, pixel); else - overflow |= ckd_mul (&end, src_x, pixel); + end = src_x * pixel; + overflow |= ckd_add (&start, start, end); overflow |= ckd_add (&start, (uintptr_t) src, start); @@ -4397,13 +4400,16 @@ android_blit_copy (int src_x, int src_y, int width, int height, src_current = (unsigned char *) start; - overflow = ckd_mul (&start, dst_y + height - 1, - dst_info->stride); - if (mask) /* If a mask is set, put the pointers before the end - of the row. */ + overflow = ckd_mul (&start, dst_y + height - 1, + dst_info->stride); + + if (mask) + /* If a mask is set, put the pointers before the end of the + row. */ overflow |= ckd_mul (&end, dst_x + width - 1, pixel); else - overflow |= ckd_mul (&end, dst_x, pixel); + end = dst_x * pixel; + overflow |= ckd_add (&start, start, end); overflow |= ckd_add (&start, (uintptr_t) dst, start); -- 2.39.2