-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.1
-
sparc
-
solaris_8
Name: gm110360 Date: 07/30/2002
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
FULL OPERATING SYSTEM VERSION :
SunOS 5.8 Generic_108528-15 sun4u sparc SUNW,Netra-T4
ADDITIONAL OPERATING SYSTEMS :
Windows 2000
Redhat Linux
A DESCRIPTION OF THE PROBLEM :
It appears that using the Java2D graphics to draw filled
rectangles and lines is very slow, especially over remote
X sessions.
Here are the results of running the attached program:
1.) At the Console of the Sun
delta t for g fillRect = 1
delta t for drawing line = 0
delta t for g2d fill = 35
delta t for drawing g2d line = 9
After resizing:
delta t for g fillRect = 0
delta t for drawing line = 0
delta t for g2d fill = 19
delta t for drawing g2d line = 2
2.) At the Console of a 1.8 GHz PC running Windows 2000 and
Winaxe 6.2 to display the Java application running on the
Sun:
delta t for g fillRect = 1
delta t for drawing line = 0
delta t for g2d fill = 103
delta t for drawing line = 15
delta t for g fillRect = 0
delta t for drawing line = 0
delta t for g2d fill = 103
delta t for drawing line = 12
3.) At the Console of a 1.8 GHz
PC running Windows 2000:
delta t for g fillRect = 0
delta t for drawing line = 0
delta t for g2d fill = 93
delta t for drawing g2d line = 16
After resizing:
delta t for g fillRect = 0
delta t for drawing line = 0
delta t for g2d fill = 47
delta t for drawing g2d line = 0
Our actual code draws much larger rectangles and
thick lines resulting in delays of 400-1000 ms between
screen paints.
We've tried various work arounds such as:
setenv NO_J2D_DGA 1
setenv USE_DGA_PIXMAPS 1
but they had an adverse impact on the non-Java2D graphics
during remote X sessions.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Run the attached program
2.
3.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Draws on the order of 1-10 ms or less.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
public class DrawingTest extends JPanel {
public DrawingTest() {
setBackground(Color.GRAY);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
long t0,t1;
Rectangle rect2d = new Rectangle(50,50,200,200);
int lineLength = 200;
Graphics2D g2d;
t0 = System.currentTimeMillis();
g.setColor(Color.red);
g.fillRect(rect2d.x+200,rect2d.y+200,rect2d.width,rect2d.height);
t1 = System.currentTimeMillis();
System.out.println("delta t for g fillRect = " + (t1-t0));
t0 = System.currentTimeMillis();
g.setColor(Color.red);
g.drawLine
(rect2d.x+200,rect2d.y+190,rect2d.x+200+lineLength,rect2d.y+190);
t1 = System.currentTimeMillis();
System.out.println("delta t for drawing line = " + (t1-t0));
g2d = (Graphics2D)g;
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,.2f));
g2d.setPaint(Color.green);
t0 = System.currentTimeMillis();
g2d.fill(rect2d);
t1 = System.currentTimeMillis();
System.out.println("delta t for g2d fill = " + (t1-t0));
t0 = System.currentTimeMillis();
g.setColor(Color.green);
g2d.drawLine(rect2d.x,rect2d.y-10,rect2d.x+lineLength,rect2d.y-10);
t1 = System.currentTimeMillis();
System.out.println("delta t for drawing g2d line = " + (t1-t0));
}
public static void main(String[] args) {
JFrame frame = new JFrame("Drawing Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new DrawingTest());
frame.setSize(500,500);
frame.show();
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Don't use Java2D graphics for applications requiring
display on a remote X server. (We mimicked the
transluscent rectangle with closely spaced hatching
using java.awt.Graphics only.)
(Review ID: 159981)
======================================================================
- duplicates
-
JDK-4488401 Antialiasing/Compositing is slow on remote display
-
- Closed
-