Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6231864

Some images loaded via Toolkit or ImageIcon can't be accelerated

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 7
    • 5.0, 6
    • client-libs
    • 2d
    • beta
    • 5.0
    • generic, x86
    • linux, solaris_9

      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);
          }
      }

            flar Jim Graham
            campbell Christopher Campbell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: