Blame SOURCES/8075942-pr3602-rh1582032.patch

605045
# HG changeset patch
605045
# User prr
605045
# Date 1429299166 25200
605045
#      Fri Apr 17 12:32:46 2015 -0700
605045
# Node ID 1f4b038b9550afaf88a70cee4cf9c1422ecd86d6
605045
# Parent  533117ae5b7587c8d9c0612581682ab984475430
605045
8075942, PR3602: ArrayIndexOutOfBoundsException in sun.java2d.pisces.Dasher.goTo
605045
Reviewed-by: flar, lbourges
605045
605045
diff --git openjdk.orig/jdk/src/share/classes/sun/java2d/pisces/Dasher.java openjdk/jdk/src/share/classes/sun/java2d/pisces/Dasher.java
605045
--- openjdk.orig/jdk/src/share/classes/sun/java2d/pisces/Dasher.java
605045
+++ openjdk/jdk/src/share/classes/sun/java2d/pisces/Dasher.java
605045
@@ -146,7 +146,7 @@
605045
         if (dashOn) {
605045
             if (starting) {
605045
                 firstSegmentsBuffer = Helpers.widenArray(firstSegmentsBuffer,
605045
-                                      firstSegidx, type - 2);
605045
+                                      firstSegidx, type - 2 + 1);
605045
                 firstSegmentsBuffer[firstSegidx++] = type;
605045
                 System.arraycopy(pts, off, firstSegmentsBuffer, firstSegidx, type - 2);
605045
                 firstSegidx += type - 2;
605045
diff --git a/test/javopenjdk.orig/jdk/awt/BasicStroke/DashStrokeTest.java openjdk/jdk/test/java/awt/BasicStroke/DashStrokeTest.java
605045
new file mode 100644
605045
--- /dev/null
605045
+++ openjdk/jdk/test/java/awt/BasicStroke/DashStrokeTest.java
605045
@@ -0,0 +1,69 @@
605045
+/*
605045
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
605045
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
605045
+ *
605045
+ * This code is free software; you can redistribute it and/or modify it
605045
+ * under the terms of the GNU General Public License version 2 only, as
605045
+ * published by the Free Software Foundation.
605045
+ *
605045
+ * This code is distributed in the hope that it will be useful, but WITHOUT
605045
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
605045
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
605045
+ * version 2 for more details (a copy is included in the LICENSE file that
605045
+ * accompanied this code).
605045
+ *
605045
+ * You should have received a copy of the GNU General Public License version
605045
+ * 2 along with this work; if not, write to the Free Software Foundation,
605045
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
605045
+ *
605045
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
605045
+ * or visit www.oracle.com if you need additional information or have any
605045
+ * questions.
605045
+ *
605045
+ * @test
605045
+ * @bug 8075942
605045
+ * @summary test there is no exception rendering a dashed stroke
605045
+ * @run DashStrokeTest
605045
+ * @run -Dsun.java2d.renderer=sun.java2d.pisces.PiscesRenderingEngine
605045
+ */
605045
+
605045
+import java.awt.BasicStroke;
605045
+import java.awt.Color;
605045
+import java.awt.Graphics2D;
605045
+import java.awt.Stroke;
605045
+import java.awt.geom.GeneralPath;
605045
+import java.awt.image.BufferedImage;
605045
+
605045
+
605045
+public class DashStrokeTest {
605045
+
605045
+    public static void main(String[] args) {
605045
+
605045
+        GeneralPath shape = new GeneralPath();
605045
+        int[] pointTypes = {0, 0, 1, 1, 0, 1, 1, 0};
605045
+        double[] xpoints = {428, 420, 400, 400, 400, 400, 420, 733};
605045
+        double[] ypoints = {180, 180, 180, 160, 30, 10, 10, 10};
605045
+        shape.moveTo(xpoints[0], ypoints[0]);
605045
+        for (int i = 1; i < pointTypes.length; i++) {
605045
+            if (pointTypes[i] == 1 && i < pointTypes.length - 1) {
605045
+                shape.quadTo(xpoints[i], ypoints[i],
605045
+                             xpoints[i + 1], ypoints[i + 1]);
605045
+            } else {
605045
+                shape.lineTo(xpoints[i], ypoints[i]);
605045
+            }
605045
+        }
605045
+
605045
+        BufferedImage image = new
605045
+            BufferedImage(1000, 1000, BufferedImage.TYPE_INT_ARGB);
605045
+        Graphics2D g2 = image.createGraphics();
605045
+
605045
+        Color color = new Color(124, 0, 124, 255);
605045
+        g2.setColor(color);
605045
+        Stroke stroke = new BasicStroke(1.0f,
605045
+                                        BasicStroke.CAP_BUTT,
605045
+                                        BasicStroke.JOIN_BEVEL,
605045
+                                        10.0f, new float[] {9, 6}, 0.0f);
605045
+        g2.setStroke(stroke);
605045
+        g2.draw(shape);
605045
+    }
605045
+}