< prev index next >

src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java

Print this page
rev 1536 : 8147077: IllegalArgumentException thrown by api/java_awt/Component/FlipBufferStrategy/indexTGF_General
8148127: IllegalArgumentException thrown by JCK test api/java_awt/Component/FlipBufferStrategy/indexTGF_General in opengl pipeline
Reviewed-by: flar, arapte

@@ -321,12 +321,16 @@
      * image wrapper.
      */
     @Override
     public VolatileImage createBackBuffer(WComponentPeer peer) {
         Component target = (Component)peer.getTarget();
+        // it is possible for the component to have size 0x0, adjust it to
+        // be at least 1x1 to avoid IAE
+        int w = Math.max(1, target.getWidth());
+        int h = Math.max(1, target.getHeight());
         return new SunVolatileImage(target,
-                                    target.getWidth(), target.getHeight(),
+                                    w, h,
                                     Boolean.TRUE);
     }
 
     /**
      * Performs the native WGL flip operation for the given target Component.
< prev index next >