< prev index next >

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

Print this page

        

@@ -38,10 +38,11 @@
 import java.awt.image.VolatileImage;
 import sun.java2d.SunGraphics2D;
 import sun.java2d.SurfaceManagerFactory;
 import sun.java2d.DestSurfaceProvider;
 import sun.java2d.Surface;
+import sun.java2d.pipe.Region;
 import static sun.java2d.pipe.hw.AccelSurface.*;
 
 /**
  * This class is the base implementation of the VolatileImage
  * abstract class.  The class implements most of the standard Image

@@ -243,12 +244,12 @@
     /**
      * This method creates a BufferedImage intended for use as a "snapshot"
      * or a backup surface with the given horizontal and vertical scale factors.
      */
     public BufferedImage getBackupImage(double scaleX, double scaleY) {
-        int w = (int) Math.ceil(getWidth() * scaleX);
-        int h = (int) Math.ceil(getHeight() * scaleY);
+        int w = Region.clipRound(getWidth() * scaleX);
+        int h = Region.clipRound(getHeight() * scaleY);
         return graphicsConfig.createCompatibleImage(w, h, getTransparency());
     }
 
     public BufferedImage getSnapshot() {
         BufferedImage bi = getBackupImage();
< prev index next >