view patches/openjdk/7105461-pr2662-xrender_jtables.patch @ 3229:ae390d52ddeb

Add backports destined for the next update, 1.13.9. S6440786, PR363: Cannot create a ZIP file containing zero entries S6599383, PR363: Unable to open zip files more than 2GB in size S6929479, PR363: Add a system property sun.zip.disableMemoryMapping to disable mmap use in ZipFile S7105461, PR2662: Large JTables are not rendered correctly with Xrender pipeline S7150134, PR2662: JCK api/java_awt/Graphics/index.html#DrawLine fails with OOM for jdk8 with XRender pipeline PR2513: Reset success following calls in LayoutManager.cpp 2015-10-12 Andrew John Hughes <gnu.andrew@redhat.com> * Makefile.am: (ICEDTEA_PATCHES): Add new patches. * NEWS: Updated. * patches/openjdk/6440786-pr363-zero_entry_zips.patch, * patches/openjdk/6599383-pr363-large_zip_files.patch, * patches/openjdk/6929479-pr363-disable_mmap_zip.patch, * patches/openjdk/7105461-pr2662-xrender_jtables.patch, * patches/openjdk/7150134-pr2662-xrender_drawline_oom.patch, * patches/pr2513-layoutengine_reset.patch: New backports for issues to be fixed in 1.13.9.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Tue, 27 Oct 2015 18:34:34 +0000
parents
children
line wrap: on
line source

# HG changeset patch
# User ceisserer
# Date 1352851930 28800
#      Tue Nov 13 16:12:10 2012 -0800
# Node ID 96b5c3822ce9ff27bce5977e55ba36d5d15c524c
# Parent  b0194003cf27684b07bbcfdb94d5a7f9594f5978
7105461, PR2662: Large JTables are not rendered correctly with Xrender pipeline
Reviewed-by: flar, prr

diff -r b0194003cf27 -r 96b5c3822ce9 src/solaris/classes/sun/java2d/xr/XRRenderer.java
--- openjdk/jdk/src/solaris/classes/sun/java2d/xr/XRRenderer.java	Mon Apr 09 15:49:33 2012 -0700
+++ openjdk/jdk/src/solaris/classes/sun/java2d/xr/XRRenderer.java	Tue Nov 13 16:12:10 2012 -0800
@@ -27,7 +27,6 @@
 
 import java.awt.*;
 import java.awt.geom.*;
-
 import sun.awt.SunToolkit;
 import sun.java2d.SunGraphics2D;
 import sun.java2d.loops.*;
@@ -39,6 +38,9 @@
 import sun.java2d.pipe.ShapeSpanIterator;
 import sun.java2d.pipe.LoopPipe;
 
+import static sun.java2d.xr.XRUtils.clampToShort;
+import static sun.java2d.xr.XRUtils.clampToUShort;
+
 /**
  * XRender provides only accalerated rectangles. To emulate higher "order"
  *  geometry we have to pass everything else to DoPath/FillSpans.
@@ -70,17 +72,16 @@
 
     public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) {
         Region compClip = sg2d.getCompClip();
-        int transX1 = x1 + sg2d.transX;
-        int transY1 = y1 + sg2d.transY;
-        int transX2 = x2 + sg2d.transX;
-        int transY2 = y2 + sg2d.transY;
+        int transX1 = Region.clipAdd(x1, sg2d.transX);
+        int transY1 = Region.clipAdd(y1, sg2d.transY);
+        int transX2 = Region.clipAdd(x2, sg2d.transX);
+        int transY2 = Region.clipAdd(y2, sg2d.transY);
 
         // Non clipped fast path
         if (compClip.contains(transX1, transY1)
                 && compClip.contains(transX2, transY2)) {
+            SunToolkit.awtLock();
             try {
-                SunToolkit.awtLock();
-
                 validateSurface(sg2d);
                 tileManager.addLine(transX1, transY1, transX2, transY2);
                 tileManager.fillMask((XRSurfaceData) sg2d.surfaceData);
@@ -115,20 +116,40 @@
         draw(sg2d, new Polygon(xpoints, ypoints, npoints));
     }
 
-    public synchronized void fillRect(SunGraphics2D sg2d,
-                                      int x, int y, int width, int height) {
+    public void fillRect(SunGraphics2D sg2d, int x, int y, int width, int height) {
+        x = Region.clipAdd(x, sg2d.transX);
+        y = Region.clipAdd(y, sg2d.transY);
+
+        /*
+         * Limit x/y to signed short, width/height to unsigned short,
+         * to match the X11 coordinate limits for rectangles.
+         * Correct width/height in case x/y have been modified by clipping.
+         */
+        if (x > Short.MAX_VALUE || y > Short.MAX_VALUE) {
+            return;
+        }
+
+        int x2 = Region.dimAdd(x, width);
+        int y2 = Region.dimAdd(y, height);
+
+        if (x2 < Short.MIN_VALUE || y2 < Short.MIN_VALUE) {
+            return;
+        }
+
+        x = clampToShort(x);
+        y = clampToShort(y);
+        width = clampToUShort(x2 - x);
+        height = clampToUShort(y2 - y);
+
+        if (width == 0 || height == 0) {
+            return;
+        }
+
         SunToolkit.awtLock();
         try {
             validateSurface(sg2d);
-
-            XRSurfaceData xrsd = (XRSurfaceData) sg2d.surfaceData;
-
-            x += sg2d.transform.getTranslateX();
-            y += sg2d.transform.getTranslateY();
-
             tileManager.addRect(x, y, width, height);
-            tileManager.fillMask(xrsd);
-
+            tileManager.fillMask((XRSurfaceData) sg2d.surfaceData);
         } finally {
             SunToolkit.awtUnlock();
         }
diff -r b0194003cf27 -r 96b5c3822ce9 src/solaris/classes/sun/java2d/xr/XRUtils.java
--- openjdk/jdk/src/solaris/classes/sun/java2d/xr/XRUtils.java	Mon Apr 09 15:49:33 2012 -0700
+++ openjdk/jdk/src/solaris/classes/sun/java2d/xr/XRUtils.java	Tue Nov 13 16:12:10 2012 -0800
@@ -255,7 +255,7 @@
                            : (x < Short.MIN_VALUE ? Short.MIN_VALUE : x));
     }
 
-    public static short clampToUShort(int x) {
-        return (short) (x > 65535 ? 65535 : (x < 0) ? 0 : x);
+    public static int clampToUShort(int x) {
+        return (x > 65535 ? 65535 : (x < 0) ? 0 : x);
     }
 }