src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java
changeset 49694 69f7e3ed043c
parent 47216 71c04702a3d5
child 52248 2e330da7cbf4
equal deleted inserted replaced
49693:fa23ea24dade 49694:69f7e3ed043c
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package sun.awt.image;
    26 package sun.awt.image;
    27 
    27 
    28 import java.awt.Color;
       
    29 import java.awt.Rectangle;
    28 import java.awt.Rectangle;
    30 import java.awt.GraphicsConfiguration;
    29 import java.awt.GraphicsConfiguration;
    31 import java.awt.image.ColorModel;
    30 import java.awt.image.ColorModel;
    32 import java.awt.image.SampleModel;
    31 import java.awt.image.SampleModel;
    33 import java.awt.image.DirectColorModel;
    32 import java.awt.image.DirectColorModel;
    36 import java.awt.image.BufferedImage;
    35 import java.awt.image.BufferedImage;
    37 import java.awt.image.DataBuffer;
    36 import java.awt.image.DataBuffer;
    38 
    37 
    39 import sun.java2d.SurfaceData;
    38 import sun.java2d.SurfaceData;
    40 import sun.java2d.SunGraphics2D;
    39 import sun.java2d.SunGraphics2D;
    41 import sun.java2d.StateTrackable;
       
    42 import sun.java2d.StateTrackable.*;
       
    43 import sun.java2d.StateTracker;
       
    44 import sun.java2d.loops.SurfaceType;
    40 import sun.java2d.loops.SurfaceType;
    45 import sun.java2d.loops.CompositeType;
    41 import sun.java2d.loops.CompositeType;
    46 import sun.java2d.loops.RenderLoops;
    42 import sun.java2d.loops.RenderLoops;
    47 
    43 
    48 
    44 
   444     protected void checkCustomComposite() {
   440     protected void checkCustomComposite() {
   445         // BufferedImages always allow Custom Composite objects since
   441         // BufferedImages always allow Custom Composite objects since
   446         // their pixels are immediately retrievable anyway.
   442         // their pixels are immediately retrievable anyway.
   447     }
   443     }
   448 
   444 
   449     private static native void freeNativeICMData(long pData);
       
   450 
       
   451     /**
   445     /**
   452      * Returns destination Image associated with this SurfaceData.
   446      * Returns destination Image associated with this SurfaceData.
   453      */
   447      */
   454     public Object getDestination() {
   448     public Object getDestination() {
   455         return bufImg;
   449         return bufImg;
   469         private long pData = 0L;
   463         private long pData = 0L;
   470 
   464 
   471         private ICMColorData(long pData) {
   465         private ICMColorData(long pData) {
   472             this.pData = pData;
   466             this.pData = pData;
   473         }
   467         }
   474 
       
   475         @SuppressWarnings("deprecation")
       
   476         public void finalize() {
       
   477             if (pData != 0L) {
       
   478                 BufImgSurfaceData.freeNativeICMData(pData);
       
   479                 pData = 0L;
       
   480             }
       
   481         }
       
   482     }
   468     }
   483 }
   469 }