From 800f133a291500aac783017d57e0b8055f52ddff Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 17 Mar 2020 13:46:19 -0700 Subject: [PATCH] 8240119: Less Affine Transformations Reviewed-by: serb, bpb, mschoene, rhalade --- .../native/libmlib_image/mlib_ImageScanPoly.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c index a35d0fd0e88..a643b9c111c 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c @@ -415,7 +415,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if ((dxs < dxCl) || (dxs >= dwCl) || (dys < dyCl) || (dys >= dhCl)) { dxs += dx; dys += dy; - xLeft++; + if (xLeft < MLIB_S32_MAX) { + xLeft++; + } if ((dxs < dxCl) || (dxs >= dwCl) || (dys < dyCl) || (dys >= dhCl)) xRight = -1; @@ -427,7 +429,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if ((dxe < dxCl) || (dxe >= dwCl) || (dye < dyCl) || (dye >= dhCl)) { dxe -= dx; dye -= dy; - xRight--; + if (xRight > MLIB_S32_MIN) { + xRight--; + } if ((dxe < dxCl) || (dxe >= dwCl) || (dye < dyCl) || (dye >= dhCl)) xRight = -1; @@ -498,7 +502,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if ((dxs > dxCl) || (dxs <= dwCl) || (dys > dyCl) || (dys <= dhCl)) { dxs += dx; dys += dy; - xLeft++; + if (xLeft < MLIB_S32_MAX) { + xLeft++; + } if ((dxs > dxCl) || (dxs <= dwCl) || (dys > dyCl) || (dys <= dhCl)) xRight = -1; @@ -510,7 +516,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if ((dxe > dxCl) || (dxe <= dwCl) || (dye > dyCl) || (dye <= dhCl)) { dxe -= dx; dye -= dy; - xRight--; + if (xRight > MLIB_S32_MIN) { + xRight--; + } if ((dxe > dxCl) || (dxe <= dwCl) || (dye > dyCl) || (dye <= dhCl)) xRight = -1;