-
Bug
-
Resolution: Duplicate
-
P4
-
5.0, 6
Some images loaded via Toolkit.createImage() (or ImageIcon, which uses the
Toolkit methods internally) cannot be accelerated. Run the attached testcase
(ManagedTest.java) with tracing enabled, and note that we always render using
the sysmem-based surface:
% java -Dsun.java2d.trace=log ManagedTest
Note that this bug does not affect the way an application will look, but it
does make rendering certain images much slower than necessary.
###@###.### 2005-2-22 22:03:16 GMT
I am adding the test case (ManagedTest.java) here so it will be visible to members of the jdk-collaboration.dev.java.net community.
import java.awt.*;
import javax.swing.ImageIcon;
public class ManagedTest extends Canvas {
private Image oimg, timg;
public void paint(Graphics g) {
if (oimg == null) {
oimg = new ImageIcon("opaque.png").getImage();
timg = new ImageIcon("translucent.png").getImage();
}
g.setColor(Color.yellow);
g.fillRect(0, 0, getWidth(), getHeight());
System.err.println("rendering opaque image");
g.drawImage(oimg, 0, 0, null);
System.err.println("rendering translucent image");
g.drawImage(timg, 200, 0, null);
}
public static void main(String[] args) {
ManagedTest t = new ManagedTest();
Frame f = new Frame();
f.add(t);
f.setSize(500, 500);
f.setVisible(true);
}
}
Toolkit methods internally) cannot be accelerated. Run the attached testcase
(ManagedTest.java) with tracing enabled, and note that we always render using
the sysmem-based surface:
% java -Dsun.java2d.trace=log ManagedTest
Note that this bug does not affect the way an application will look, but it
does make rendering certain images much slower than necessary.
###@###.### 2005-2-22 22:03:16 GMT
I am adding the test case (ManagedTest.java) here so it will be visible to members of the jdk-collaboration.dev.java.net community.
import java.awt.*;
import javax.swing.ImageIcon;
public class ManagedTest extends Canvas {
private Image oimg, timg;
public void paint(Graphics g) {
if (oimg == null) {
oimg = new ImageIcon("opaque.png").getImage();
timg = new ImageIcon("translucent.png").getImage();
}
g.setColor(Color.yellow);
g.fillRect(0, 0, getWidth(), getHeight());
System.err.println("rendering opaque image");
g.drawImage(oimg, 0, 0, null);
System.err.println("rendering translucent image");
g.drawImage(timg, 200, 0, null);
}
public static void main(String[] args) {
ManagedTest t = new ManagedTest();
Frame f = new Frame();
f.add(t);
f.setSize(500, 500);
f.setVisible(true);
}
}
- duplicates
-
JDK-6340082 OGL: Slowness when rendering transparent image created via getScaledInstance()
-
- Closed
-
-
JDK-6205557 Changes to image data should be tracked at a finer granularity
-
- Closed
-
- relates to
-
JDK-6615272 D3D: Some images loaded via Toolkit or ImageIcon can't be accelerated
-
- Closed
-