< prev index next >

src/share/classes/sun/awt/image/SunVolatileImage.java

Print this page
rev 1534 : 8159495: Fix index offsets
8140530: Creating a VolatileImage with size 0,0 results in no longer working g2d.drawString
Reviewed-by: prr, psadhukhan

@@ -68,10 +68,14 @@
                                int transparency, ImageCapabilities caps,
                                int accType)
     {
         this.comp = comp;
         this.graphicsConfig = graphicsConfig;
+        if (width <= 0 || height <= 0) {
+            throw new IllegalArgumentException("Width (" + width + ")" +
+                              " and height (" + height + ") cannot be <= 0");
+        }
         this.width = width;
         this.height = height;
         this.forcedAccelSurfaceType = accType;
         if (!(transparency == Transparency.OPAQUE ||
             transparency == Transparency.BITMASK ||
< prev index next >