src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java
changeset 47967 b69b22b7a9f9
parent 47216 71c04702a3d5
equal deleted inserted replaced
47966:a5fe5534b8a2 47967:b69b22b7a9f9
    38 import java.awt.image.VolatileImage;
    38 import java.awt.image.VolatileImage;
    39 import sun.java2d.SunGraphics2D;
    39 import sun.java2d.SunGraphics2D;
    40 import sun.java2d.SurfaceManagerFactory;
    40 import sun.java2d.SurfaceManagerFactory;
    41 import sun.java2d.DestSurfaceProvider;
    41 import sun.java2d.DestSurfaceProvider;
    42 import sun.java2d.Surface;
    42 import sun.java2d.Surface;
       
    43 import sun.java2d.pipe.Region;
    43 import static sun.java2d.pipe.hw.AccelSurface.*;
    44 import static sun.java2d.pipe.hw.AccelSurface.*;
    44 
    45 
    45 /**
    46 /**
    46  * This class is the base implementation of the VolatileImage
    47  * This class is the base implementation of the VolatileImage
    47  * abstract class.  The class implements most of the standard Image
    48  * abstract class.  The class implements most of the standard Image
   243     /**
   244     /**
   244      * This method creates a BufferedImage intended for use as a "snapshot"
   245      * This method creates a BufferedImage intended for use as a "snapshot"
   245      * or a backup surface with the given horizontal and vertical scale factors.
   246      * or a backup surface with the given horizontal and vertical scale factors.
   246      */
   247      */
   247     public BufferedImage getBackupImage(double scaleX, double scaleY) {
   248     public BufferedImage getBackupImage(double scaleX, double scaleY) {
   248         int w = (int) Math.ceil(getWidth() * scaleX);
   249         int w = Region.clipRound(getWidth() * scaleX);
   249         int h = (int) Math.ceil(getHeight() * scaleY);
   250         int h = Region.clipRound(getHeight() * scaleY);
   250         return graphicsConfig.createCompatibleImage(w, h, getTransparency());
   251         return graphicsConfig.createCompatibleImage(w, h, getTransparency());
   251     }
   252     }
   252 
   253 
   253     public BufferedImage getSnapshot() {
   254     public BufferedImage getSnapshot() {
   254         BufferedImage bi = getBackupImage();
   255         BufferedImage bi = getBackupImage();