images returned by createCompatibleImage() not cleared when -Dsun.java2d.pmoffscreen=true

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 6
    • Affects Version/s: 5.0
    • Component/s: client-libs
    • None
    • 2d
    • 1.4.0
    • beta
    • generic
    • solaris_9

      On Linux and Solaris, opaque images returned by
      GraphicsConfig.createCompatibleImage() are not cleared to black when the
      -Dsun.java2d.pmoffscreen=true property is specified. Since the background
      is not cleared, the image often contains garbage. This deviates from the
      behavior on other platforms, so we should fix this case to be consistent.
      The following testcase demonstrates the problem quite easily:

      ----
      import java.awt.*;
      import java.awt.image.*;

      public class PixmapBug extends Canvas {

          public void paint(Graphics g) {
              GraphicsConfiguration gc = getGraphicsConfiguration();
              BufferedImage img = gc.createCompatibleImage(200, 200);
              g.setColor(Color.blue);
              g.fillRect(0, 0, getWidth(), getHeight());
              g.drawImage(img, 50, 50, null);
          }

          public static void main(String[] args) {
              PixmapBug test = new PixmapBug();
              Frame frame = new Frame();
              frame.add(test);
              frame.pack();
              frame.setSize(400, 400);
              frame.setVisible(true);
          }
      }
      ----

      ###@###.### 2005-05-17 17:47:36 GMT

            Assignee:
            Dmitri Trembovetski (Inactive)
            Reporter:
            Christopher Campbell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: