Funky multiresolution image breaks graphics context

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 21
    • Affects Version/s: 16, 17
    • Component/s: 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)

            Assignee:
            Sergey Bylokhov
            Reporter:
            Alan Snyder
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: