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