changeset 1536:7d2c8cf626c4

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
author aivanov
date Tue, 20 Dec 2016 02:45:29 +0000
parents d4302a24427c
children 92f45941d640
files src/solaris/classes/sun/awt/X11GraphicsConfig.java src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/sun/awt/X11GraphicsConfig.java	Wed Sep 14 11:39:01 2016 +0300
+++ b/src/solaris/classes/sun/awt/X11GraphicsConfig.java	Tue Dec 20 02:45:29 2016 +0000
@@ -424,9 +424,13 @@
     public VolatileImage createBackBufferImage(Component target,
                                                long backBuffer)
     {
+        // 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(),
-                                    new Long(backBuffer));
+                                    w, h,
+                                    Long.valueOf(backBuffer));
     }
 
     /**
--- a/src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Wed Sep 14 11:39:01 2016 +0300
+++ b/src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Tue Dec 20 02:45:29 2016 +0000
@@ -323,8 +323,12 @@
     @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);
     }