[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android 9a353545933 3/7: Update Android port
From: |
Po Lu |
Subject: |
feature/android 9a353545933 3/7: Update Android port |
Date: |
Mon, 29 May 2023 06:07:13 -0400 (EDT) |
branch: feature/android
commit 9a3535459333b5a1a32ed5b5ef4c593e585bfe9a
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Update Android port
* src/android.c (android_neon_mask_line): Fix iteration
over remainder.
(android_blit_copy): Be more paranoid.
---
src/android.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/android.c b/src/android.c
index 33d766a90d9..7b9c478f212 100644
--- a/src/android.c
+++ b/src/android.c
@@ -3958,14 +3958,14 @@ android_neon_mask_line (unsigned int *src, unsigned int
*dst,
uint32x4_t src_low, src_high, dst_low, dst_high;
int16x8_t vmask;
int32x4_t ext_mask_low, ext_mask_high, low, high;
- int rem;
+ int rem, i;
/* Calculate the remainder. */
- rem = n & 7;
+ rem = n & 7, n &= ~7;
/* Process eight pixels at a time. */
- if (n -= rem)
+ if (n)
{
again:
/* Load the low and high four pixels from the source. */
@@ -4008,14 +4008,13 @@ android_neon_mask_line (unsigned int *src, unsigned int
*dst,
/* Process the remaining pixels. */
- while (--rem)
+ for (i = 0; i < rem; ++i)
{
/* Sign extend the mask. */
- n = *(signed char *) mask++;
+ n = ((signed char *) mask)[i];
/* Combine src and dst. */
- *dst = ((*src & n) | (*dst & ~n));
- src++, dst++;
+ dst[i] = ((src[i] & n) | (dst[i] & ~n));
}
}
@@ -4262,7 +4261,8 @@ android_blit_copy (int src_x, int src_y, int width, int
height,
/* Make sure it's not out of bounds. */
eassert (dst_y - gc->clip_y_origin >= 0);
- if ((dst_y - gc->clip_y_origin) + height > mask_info->height)
+ if ((dst_y - gc->clip_y_origin) + height > mask_info->height
+ || width <= 0)
return;
/* Now move mask to the position of the first row. */
@@ -4277,6 +4277,9 @@ android_blit_copy (int src_x, int src_y, int width, int
height,
else
temp = MIN (mask_info->width, width);
+ if (temp <= 0)
+ return;
+
/* Copy bytes according to the mask. */
while (--height)
- feature/android updated (d33bf0a0afd -> 1a1cf6b86fc), Po Lu, 2023/05/29
- feature/android 327d2d01313 1/7: Add extra thread-related checking, Po Lu, 2023/05/29
- feature/android 00671b18438 2/7: Implement android_copy_area in C, Po Lu, 2023/05/29
- feature/android 787c947028c 5/7: ; * src/android.c (android_blit_copy): Fix typos., Po Lu, 2023/05/29
- feature/android 9a353545933 3/7: Update Android port,
Po Lu <=
- feature/android 7fdde02f321 4/7: Work around more problems with Bitmaps, Po Lu, 2023/05/29
- feature/android 1a1cf6b86fc 7/7: Merge remote-tracking branch 'origin/master' into feature/android, Po Lu, 2023/05/29
- feature/android 1088a8e8dab 6/7: Update Android port, Po Lu, 2023/05/29