changeset 1487:713678ee2064

2009-04-29 Omair Majid <omajid@redhat.com> * patches/icedtea-java2d-stroker-internal-joint.patch: New patch. Fixes the penultimate miter joint created by GeneralPath.closePath(). * Makefile.am (ICEDTEA_PATCHES): Apply the above. * HACKING: Document the above.
author Omair Majid <omajid@redhat.com>
date Wed, 29 Apr 2009 13:46:09 -0400
parents 059f6ba0c7dd
children 0cf247b95e6c
files ChangeLog HACKING Makefile.am patches/icedtea-java2d-stroker-internal-joint.patch
diffstat 4 files changed, 107 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Apr 29 18:09:17 2009 +0100
+++ b/ChangeLog	Wed Apr 29 13:46:09 2009 -0400
@@ -1,3 +1,10 @@
+2009-04-29  Omair Majid  <omajid@redhat.com>
+
+	* patches/icedtea-java2d-stroker-internal-joint.patch: New patch. Fixes
+	the penultimate miter joint created by GeneralPath.closePath().
+	* Makefile.am (ICEDTEA_PATCHES): Apply the above.
+	* HACKING: Document the above.
+
 2009-04-29  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am:
--- a/HACKING	Wed Apr 29 18:09:17 2009 +0100
+++ b/HACKING	Wed Apr 29 13:46:09 2009 -0400
@@ -93,6 +93,7 @@
 * icedtea-jtreg-jrunscript.patch: Fix jrunscript test so it works with newer versions of rhino (by comparing the actual numbers).
 * icedtea-ignore-unrecognized-options.patch: Add -XX:+IgnoreUnrecognizedVMOptions flag to hotspot (S6788376).
 * icedtea-java2d-mitre-join.patch: Backport fix for mitre join decoration (S6812600).
+* icedtea-java2d-stroker-internal-joint.patch: Fix penultimate joint created by GeneralPath.closePath().
 
 The following patches are only applied to OpenJDK6 in IcedTea6:
 
--- a/Makefile.am	Wed Apr 29 18:09:17 2009 +0100
+++ b/Makefile.am	Wed Apr 29 13:46:09 2009 -0400
@@ -678,6 +678,7 @@
 	patches/icedtea-network-unreachable.patch \
 	patches/icedtea-dnd-filelists.patch \
 	patches/icedtea-java2d-mitre-join.patch \
+	patches/icedtea-java2d-stroker-internal-joint.patch \
 	$(DISTRIBUTION_PATCHES)
 
 stamps/extract.stamp: stamps/download.stamp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-java2d-stroker-internal-joint.patch	Wed Apr 29 13:46:09 2009 -0400
@@ -0,0 +1,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");
++        }
++
++    }
++}