1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
--- openjdk/jdk/src/share/classes/sun/java2d/pisces/Stroker.java.orig 2009-04-29 13:30:24.000000000 -0400
+++ openjdk/jdk/src/share/classes/sun/java2d/pisces/Stroker.java 2009-04-29 13:31:05.000000000 -0400
@@ -614,6 +614,8 @@
ROUND_JOIN_INTERNAL_THRESHOLD);
}
+ emitLineTo(x0, y0, !ccw);
+
emitLineTo(x0 + mx, y0 + my);
emitLineTo(sx0 + mx, sy0 + my);
--- /dev/null 2009-04-15 13:37:55.776002308 -0400
+++ openjdk/jdk/test/sun/pisces/MiterInternalJointTest.java 2009-04-29 13:41:30.000000000 -0400
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2009 Red Hat, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ @test
+ @summary Check that the penultimate joint created using
+ generalPath.closePath() is correct
+ @author Omair Majid <omajid@redhat.com>
+ @run main MiterInternalJointTest
+ */
+
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.geom.GeneralPath;
+import java.awt.image.BufferedImage;
+
+public class MiterInternalJointTest {
+
+ static final int WIDTH = 200;
+ static final int HEIGHT = 200;
+
+ static final int x0 = 50, y0 = 50;
+ static final int x1 = 150, y1 = 50;
+ static final int x2 = 100, y2 = 100;
+
+ private static BufferedImage createTestImage() {
+ final BufferedImage image = new BufferedImage(WIDTH, HEIGHT,
+ BufferedImage.TYPE_INT_BGR);
+ Graphics2D g = image.createGraphics();
+
+ g.setColor(Color.BLACK);
+ g.fillRect(0, 0, WIDTH, HEIGHT);
+
+ float wideStrokeWidth = 20.0f;
+ BasicStroke wideStroke = new BasicStroke(wideStrokeWidth,
+ BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, wideStrokeWidth);
+ float thinStrokeWidth = 3.0f;
+ BasicStroke thinStroke = new BasicStroke(thinStrokeWidth,
+ BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, thinStrokeWidth);
+
+ g.setColor(Color.WHITE);
+ GeneralPath path = new GeneralPath();
+ path.moveTo(x0, y0);
+ path.lineTo(x1, y1);
+ path.lineTo(x2, y2);
+ path.closePath();
+ path.closePath();
+ g.setStroke(thinStroke);
+ g.draw(wideStroke.createStrokedShape(path));
+
+ return image;
+ }
+
+ public static void main(String[] args) {
+
+ BufferedImage testImage = createTestImage();
+
+ int color = testImage.getRGB(x2,y2);
+ System.out.println("Color seen: #" + Integer.toHexString(color));
+ if (color != Color.WHITE.getRGB()) {
+ throw new RuntimeException(
+ "Test Failed; expected to see a white vertex above the bottom of the triangle");
+ }
+
+ }
+}
|