changeset 13689:1f5e1d743e4b

8218877: Help transform transformers Reviewed-by: serb, prr, mschoene, bpb, ssahoo
author alitvinov
date Fri, 31 May 2019 18:16:57 +0100
parents dd50896e9dec
children f0bbf5b47d57
files src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h src/share/native/sun/java2d/loops/LoopMacros.h src/share/native/sun/java2d/opengl/OGLBlitLoops.c src/windows/native/sun/java2d/d3d/D3DContext.cpp
diffstat 4 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h	Mon Mar 25 17:15:27 2019 +0000
+++ b/src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h	Fri May 31 18:16:57 2019 +0100
@@ -489,6 +489,8 @@
 #define PtrCoord(p, x, xinc, y, yinc)   PtrAddBytes(p, \
                                                     ((ptrdiff_t)(y))*(yinc) + \
                                                     ((ptrdiff_t)(x))*(xinc))
+#define PtrPixelsRow(p, y, scanStride)    PtrAddBytes(p, \
+    ((intptr_t) (y)) * (scanStride))
 
 /*
  * The function to call with an array of NativePrimitive structures
--- a/src/share/native/sun/java2d/loops/LoopMacros.h	Mon Mar 25 17:15:27 2019 +0000
+++ b/src/share/native/sun/java2d/loops/LoopMacros.h	Fri May 31 18:16:57 2019 +0100
@@ -137,7 +137,7 @@
         do { \
             juint w = WIDTH; \
             jint tmpsxloc = SXLOC; \
-            SRCPTR = PtrAddBytes(SRCBASE, ((SYLOC >> SHIFT) * srcScan)); \
+            SRCPTR = PtrPixelsRow(SRCBASE, (SYLOC >> SHIFT), srcScan); \
             Init ## DSTTYPE ## StoreVarsX(DSTPREFIX, DSTINFO); \
             do { \
                 jint XVAR = (tmpsxloc >> SHIFT); \
@@ -2015,7 +2015,7 @@
  \
     Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
     while (pRGB < pEnd) { \
-        SRC ## DataType *pRow = PtrAddBytes(pBase, WholeOfLong(ylong) * scan); \
+        SRC ## DataType *pRow = PtrPixelsRow(pBase, WholeOfLong(ylong), scan); \
         Copy ## SRC ## ToIntArgbPre(pRGB, 0, \
                                     SrcRead, pRow, WholeOfLong(xlong)); \
         pRGB++; \
@@ -2063,7 +2063,7 @@
         ydelta &= scan; \
  \
         xwhole += cx; \
-        pRow = PtrAddBytes(pSrcInfo->rasBase, (ywhole + cy) * scan); \
+        pRow = PtrPixelsRow(pSrcInfo->rasBase, (ywhole + cy), scan); \
         Copy ## SRC ## ToIntArgbPre(pRGB, 0, SrcRead, pRow, xwhole); \
         Copy ## SRC ## ToIntArgbPre(pRGB, 1, SrcRead, pRow, xwhole+xdelta); \
         pRow = PtrAddBytes(pRow, ydelta); \
@@ -2121,7 +2121,7 @@
         ydelta1 += (isneg & -scan); \
  \
         xwhole += cx; \
-        pRow = PtrAddBytes(pSrcInfo->rasBase, (ywhole + cy) * scan); \
+        pRow = PtrPixelsRow(pSrcInfo->rasBase, (ywhole + cy), scan); \
         pRow = PtrAddBytes(pRow, ydelta0); \
         Copy ## SRC ## ToIntArgbPre(pRGB,  0, SrcRead, pRow, xwhole+xdelta0); \
         Copy ## SRC ## ToIntArgbPre(pRGB,  1, SrcRead, pRow, xwhole        ); \
--- a/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Mon Mar 25 17:15:27 2019 +0000
+++ b/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Fri May 31 18:16:57 2019 +0100
@@ -717,8 +717,8 @@
     juint step = 0;
     // vertical flip and convert argbpre to argb if necessary
     for (; i < h / 2; ++i) {
-        juint *r1 = PtrAddBytes(pDst, (i * scanStride));
-        juint *r2 = PtrAddBytes(pDst, (h - i - 1) * scanStride);
+        juint *r1 = PtrPixelsRow(pDst, i, scanStride);
+        juint *r2 = PtrPixelsRow(pDst, h - i - 1, scanStride);
         if (tempRow) {
             // fast path
             memcpy(tempRow, r1, clippedStride);
@@ -740,7 +740,7 @@
     }
     // convert the middle line if necessary
     if (convert && h % 2) {
-        juint *r1 = PtrAddBytes(pDst, (i * scanStride));
+        juint *r1 = PtrPixelsRow(pDst, i, scanStride);
         for (step = 0; step < w; ++step) {
             LoadIntArgbPreTo1IntArgb(r1, 0, step, r1[step]);
         }
@@ -813,7 +813,7 @@
             height = srcInfo.bounds.y2 - srcInfo.bounds.y1;
 
             pDst = PtrAddBytes(pDst, dstx * dstInfo.pixelStride);
-            pDst = PtrAddBytes(pDst, dsty * dstInfo.scanStride);
+            pDst = PtrPixelsRow(pDst, dsty, dstInfo.scanStride);
 
             j2d_glPixelStorei(GL_PACK_ROW_LENGTH,
                               dstInfo.scanStride / dstInfo.pixelStride);
--- a/src/windows/native/sun/java2d/d3d/D3DContext.cpp	Mon Mar 25 17:15:27 2019 +0000
+++ b/src/windows/native/sun/java2d/d3d/D3DContext.cpp	Fri May 31 18:16:57 2019 +0100
@@ -1156,7 +1156,9 @@
 {
 #ifndef PtrAddBytes
 #define PtrAddBytes(p, b)               ((void *) (((intptr_t) (p)) + (b)))
-#define PtrCoord(p, x, xinc, y, yinc)   PtrAddBytes(p, (y)*(yinc) + (x)*(xinc))
+#define PtrCoord(p, x, xinc, y, yinc)   PtrAddBytes(p, \
+                                                    ((ptrdiff_t)(y))*(yinc) + \
+                                                    ((ptrdiff_t)(x))*(xinc))
 #endif // PtrAddBytes
 
     HRESULT res = S_OK;