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

Funky multiresolution image breaks graphics context

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 16, 17
    • client-libs
    • None
    • 2d
    • 16
    • b10
    • generic

      I discovered this problem when a system service returned a 2x image with user size 28.0 x 0.5. I created a multiresolution image to preserve the extra resolution, but (erroneously) gave it a size of 28 x 0. Prior to JDK 16, this erroneous image was rejected when painted (see below). However, in JDK 16 and 17, there is no exception. Instead, the graphics context is apparently damaged. In this example, the label text is not painted. In other examples, it seems to have cleared the rendering buffer.

      (Actually, I believe the exception is thrown but is caught internally, at which point different drawing code is used.)

      The exception from JDK 15:

      Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Invalid Image variant
      at java.desktop/sun.awt.image.SurfaceManager.getManager(SurfaceManager.java:82)
      at java.desktop/sun.java2d.SurfaceData.getSourceSurfaceData(SurfaceData.java:219)
      at java.desktop/sun.java2d.opengl.OGLDrawImage.renderImageXform(OGLDrawImage.java:62)
      at java.desktop/sun.java2d.pipe.DrawImage.transformImage(DrawImage.java:264)
      at java.desktop/sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:76)
      at java.desktop/sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:1027)
      at java.desktop/sun.java2d.pipe.ValidatePipe.copyImage(ValidatePipe.java:186)
      at java.desktop/sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3425)
      at java.desktop/sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3401)

            serb Sergey Bylokhov
            alans Alan Snyder
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: