United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6967436 OpenJDK: long lines can fill window (using Pisces, when they're thick or dashed)
JDK-6967436 : OpenJDK: long lines can fill window (using Pisces, when they're thick or dashed)

Details
Type:
Bug
Submit Date:
2010-07-07
Status:
Closed
Updated Date:
2011-04-05
Project Name:
JDK
Resolved Date:
2011-04-05
Component:
client-libs
OS:
linux
Sub-Component:
2d
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Duplicate:
Relates:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8) (fedora-41.b18.fc13-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
2.6.33.5-124.fc13.x86_64 #1 SMP Fri Jun 11 09:38:12 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
When drawing dashed lines or lines with thickness > 1, or anti-aliased lines, instead of a line being drawn, much of the window is filled with whatever colour is being used to draw.

This happens because of overflows in Stroker.java and Dasher.java, which explains why it doesn't happen on thin, undashed lines, aliased lines (i.e. when a line is dashed, aliased, and thin, Pisces is not used).

One of the line endpoints must be a bit larger than 2^15 in at least one coordinate to trigger this.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided test.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The output png file has a white line drawn on black background.
ACTUAL -
A large part of the window goes white.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.imageio.*;

public class TestDBZ extends Frame {

    public static void main(String[] args) {
        BufferedImage bImg = new BufferedImage(512, 512, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) bImg.getGraphics();

        g2d.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND, 10.0f, new float[] {12f, 12f}, 0));

        g2d.drawLine(10, 10, 33000, 33000);
        try {
            ImageIO.write(bImg, "png", new java.io.File("test.png"));
        } catch (Exception e) {
        }
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
The application should do it's own clipping and not pass any large coordinates to the Graphics2D methods.

                                    

Comments
EVALUATION

Fixed as suggested by external contributor.
                                     
2010-08-30



Hardware and Software, Engineered to Work Together