[OpenJDK 2D-Dev] miter line join bug
Hiroshi Yamauchi
yamauchi at google.com
Mon Feb 23 21:59:21 UTC 2009
Here's an automated test.
import java.awt.*;
import java.awt.image.BufferedImage;
public class JoinMiterTest {
public static void main(String[] args) throws Exception {
BufferedImage image = new BufferedImage(200, 200,
BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.setPaint(Color.WHITE);
g.fill(new Rectangle(image.getWidth(), image.getHeight()));
g.translate(25, 100);
g.setPaint(Color.BLACK);
g.setStroke(new BasicStroke(20, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER));
g.draw(new Polygon(new int[] {0, 150, 0}, new int[] {75, 0, -75}, 3));
if (image.getRGB(15, 9) == Color.WHITE.getRGB()) {
throw new RuntimeException("Miter is not rendered.");
}
}
}
On Wed, Feb 18, 2009 at 9:48 PM, Phil Race <Phil.Race at sun.com> wrote:
> Without verifying the proposed fix itself, the problem I see here is that
> this test doesn't appear to be automated. See the one for the dashed line
> bug for ideas on automation.
>
> For the record: we require that tests be provided and automated if at all
> feasible, or there
> must be a justification why its not provided or feasible be provided. Fixes
> which don't
> provide this will be pended once this is noted.
> Reviewers will likewise reject fixes that don't conform.
>
> The reason for this requirement is that its then possible to test the fix on
> all platforms with minimal effort.
> A fix that isn't automated likely won't be tested and isn't worth much.
>
> -phil.
>
> Hiroshi Yamauchi wrote:
>>
>> Hi,
>>
>> Here's a miter bugfix, and a test.
>>
>> Thanks,
>> Hiroshi
>>
>> ---- bug ----
>> The miter line join decoration isn't rendered properly.
>>
>> ---- fix ----
>> +++ jdk/src/share/classes/sun/java2d/pisces/PiscesRenderingEngine.java
>> 2009-02-18
>> 17:14:05.000000000 -0800
>> @@ -245,6 +245,7 @@
>> FloatToS15_16(coords[1]));
>> break;
>> case PathIterator.SEG_CLOSE:
>> + lsink.lineJoin();
>> lsink.close();
>> break;
>> default:
>>
>> ---- test ----
>> public class JoinMiterTest {
>> public static void main(String[] args) throws Exception {
>> BufferedImage image = new BufferedImage(200, 200,
>> BufferedImage.TYPE_INT_RGB);
>> Graphics2D g = image.createGraphics();
>> g.setPaint(Color.WHITE);
>> g.fill(new Rectangle(image.getWidth(), image.getHeight()));
>> g.translate(25, 100);
>> g.setPaint(Color.BLACK);
>> g.setStroke(new BasicStroke(20, BasicStroke.CAP_BUTT,
>> BasicStroke.JOIN_MITER));
>> g.draw(new Polygon(new int[] {0, 150, 0}, new int[] {75, 0, -75},
>> 3));
>> ImageIO.write(image, "PNG", new File(args[0]));
>> }
>> }
>>
>
>
More information about the 2d-dev
mailing list