changeset 60178:ba523f6a9d1e

8240119: Less Affine Transformations Reviewed-by: serb, bpb, mschoene, rhalade
author prr
date Tue, 17 Mar 2020 13:46:19 -0700
parents 494fadc61317
children ead87257da2f
files src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c	Tue Mar 10 07:07:09 2020 +0100
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c	Tue Mar 17 13:46:19 2020 -0700
@@ -415,7 +415,9 @@
         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 @@
         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 @@
         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 @@
         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;