jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java
author erikj
Thu, 07 Jun 2012 18:05:09 -0700
changeset 12813 c10ab96dcf41
parent 12047 320a714614e9
child 16734 da1901d79073
permissions -rw-r--r--
7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI Reviewed-by: ohair, ohrstrom, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
7668
d4a77089c587 6962318: Update copyright year
ohair
parents: 6861
diff changeset
     2
 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.awt.image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.Rectangle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.GraphicsConfiguration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.image.ColorModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.image.SampleModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.awt.image.DirectColorModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.awt.image.IndexColorModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.awt.image.Raster;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.awt.image.BufferedImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.awt.image.DataBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import sun.java2d.SurfaceData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import sun.java2d.SunGraphics2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import sun.java2d.StateTrackable;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11080
diff changeset
    42
import sun.java2d.StateTrackable.*;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import sun.java2d.StateTracker;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import sun.java2d.loops.SurfaceType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import sun.java2d.loops.CompositeType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import sun.java2d.loops.RenderLoops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 12047
diff changeset
    48
import javax.tools.annotation.GenerateNativeHeader;
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 12047
diff changeset
    49
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 12047
diff changeset
    50
/* No native methods here, but the constants are needed in the supporting JNI code */
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 12047
diff changeset
    51
@GenerateNativeHeader
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
public class BufImgSurfaceData extends SurfaceData {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    BufferedImage bufImg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private BufferedImageGraphicsConfig graphicsConfig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    RenderLoops solidloops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
6861
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
    57
    private static native void initIDs(Class ICM, Class ICMColorData);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    private static final int DCM_RGBX_RED_MASK   = 0xff000000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    private static final int DCM_RGBX_GREEN_MASK = 0x00ff0000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private static final int DCM_RGBX_BLUE_MASK  = 0x0000ff00;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private static final int DCM_555X_RED_MASK = 0xF800;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    private static final int DCM_555X_GREEN_MASK = 0x07C0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    private static final int DCM_555X_BLUE_MASK = 0x003E;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    private static final int DCM_4444_RED_MASK   = 0x0f00;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    private static final int DCM_4444_GREEN_MASK = 0x00f0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private static final int DCM_4444_BLUE_MASK  = 0x000f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    private static final int DCM_4444_ALPHA_MASK = 0xf000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    private static final int DCM_ARGBBM_ALPHA_MASK = 0x01000000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    private static final int DCM_ARGBBM_RED_MASK   = 0x00ff0000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    private static final int DCM_ARGBBM_GREEN_MASK = 0x0000ff00;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    private static final int DCM_ARGBBM_BLUE_MASK  = 0x000000ff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    static {
6861
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
    75
        initIDs(IndexColorModel.class, ICMColorData.class);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    public static SurfaceData createData(BufferedImage bufImg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        if (bufImg == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            throw new NullPointerException("BufferedImage cannot be null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        SurfaceData sData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        ColorModel cm = bufImg.getColorModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        int type = bufImg.getType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        // REMIND: Check the image type and pick an appropriate subclass
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        case BufferedImage.TYPE_INT_BGR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            sData = createDataIC(bufImg, SurfaceType.IntBgr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        case BufferedImage.TYPE_INT_RGB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            sData = createDataIC(bufImg, SurfaceType.IntRgb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        case BufferedImage.TYPE_INT_ARGB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            sData = createDataIC(bufImg, SurfaceType.IntArgb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        case BufferedImage.TYPE_INT_ARGB_PRE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            sData = createDataIC(bufImg, SurfaceType.IntArgbPre);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        case BufferedImage.TYPE_3BYTE_BGR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            sData = createDataBC(bufImg, SurfaceType.ThreeByteBgr, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        case BufferedImage.TYPE_4BYTE_ABGR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
            sData = createDataBC(bufImg, SurfaceType.FourByteAbgr, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        case BufferedImage.TYPE_4BYTE_ABGR_PRE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            sData = createDataBC(bufImg, SurfaceType.FourByteAbgrPre, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        case BufferedImage.TYPE_USHORT_565_RGB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            sData = createDataSC(bufImg, SurfaceType.Ushort565Rgb, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        case BufferedImage.TYPE_USHORT_555_RGB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            sData = createDataSC(bufImg, SurfaceType.Ushort555Rgb, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        case BufferedImage.TYPE_BYTE_INDEXED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                SurfaceType sType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                switch (cm.getTransparency()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                case OPAQUE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                    if (isOpaqueGray((IndexColorModel)cm)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                        sType = SurfaceType.Index8Gray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                        sType = SurfaceType.ByteIndexedOpaque;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                case BITMASK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                    sType = SurfaceType.ByteIndexedBm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                case TRANSLUCENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                    sType = SurfaceType.ByteIndexed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                    throw new InternalError("Unrecognized transparency");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                sData = createDataBC(bufImg, sType, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        case BufferedImage.TYPE_BYTE_GRAY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            sData = createDataBC(bufImg, SurfaceType.ByteGray, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        case BufferedImage.TYPE_USHORT_GRAY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            sData = createDataSC(bufImg, SurfaceType.UshortGray, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        case BufferedImage.TYPE_BYTE_BINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                SurfaceType sType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                SampleModel sm = bufImg.getRaster().getSampleModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                switch (sm.getSampleSize(0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                    sType = SurfaceType.ByteBinary1Bit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                    sType = SurfaceType.ByteBinary2Bit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                    sType = SurfaceType.ByteBinary4Bit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                    throw new InternalError("Unrecognized pixel size");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                sData = createDataBP(bufImg, sType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        case BufferedImage.TYPE_CUSTOM:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                Raster raster = bufImg.getRaster();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                int numBands = raster.getNumBands();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                if (raster instanceof IntegerComponentRaster &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                    raster.getNumDataElements() == 1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                    ((IntegerComponentRaster)raster).getPixelStride() == 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                    SurfaceType sType = SurfaceType.AnyInt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                    if (cm instanceof DirectColorModel) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                        DirectColorModel dcm = (DirectColorModel) cm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                        int aMask = dcm.getAlphaMask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                        int rMask = dcm.getRedMask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                        int gMask = dcm.getGreenMask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                        int bMask = dcm.getBlueMask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                        if (numBands == 3 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                            aMask == 0 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                            rMask == DCM_RGBX_RED_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                            gMask == DCM_RGBX_GREEN_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                            bMask == DCM_RGBX_BLUE_MASK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                            sType = SurfaceType.IntRgbx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                        } else if (numBands == 4 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                                   aMask == DCM_ARGBBM_ALPHA_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                                   rMask == DCM_ARGBBM_RED_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                                   gMask == DCM_ARGBBM_GREEN_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                                   bMask == DCM_ARGBBM_BLUE_MASK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                            sType = SurfaceType.IntArgbBm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                            sType = SurfaceType.AnyDcm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                    sData = createDataIC(bufImg, sType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                } else if (raster instanceof ShortComponentRaster &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                           raster.getNumDataElements() == 1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                           ((ShortComponentRaster)raster).getPixelStride() == 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                    SurfaceType sType = SurfaceType.AnyShort;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                    IndexColorModel icm = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                    if (cm instanceof DirectColorModel) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                        DirectColorModel dcm = (DirectColorModel) cm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                        int aMask = dcm.getAlphaMask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                        int rMask = dcm.getRedMask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                        int gMask = dcm.getGreenMask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                        int bMask = dcm.getBlueMask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                        if (numBands == 3 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                            aMask == 0 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                            rMask == DCM_555X_RED_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                            gMask == DCM_555X_GREEN_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                            bMask == DCM_555X_BLUE_MASK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                            sType = SurfaceType.Ushort555Rgbx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                        } else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                        if (numBands == 4 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                            aMask == DCM_4444_ALPHA_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                            rMask == DCM_4444_RED_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                            gMask == DCM_4444_GREEN_MASK &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                            bMask == DCM_4444_BLUE_MASK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                            sType = SurfaceType.Ushort4444Argb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                    } else if (cm instanceof IndexColorModel) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                        icm = (IndexColorModel)cm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                        if (icm.getPixelSize() == 12) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                            if (isOpaqueGray(icm)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
                                sType = SurfaceType.Index12Gray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                                sType = SurfaceType.UshortIndexed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                            icm = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                    sData = createDataSC(bufImg, sType, icm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                sData = new BufImgSurfaceData(raster.getDataBuffer(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                                              bufImg, SurfaceType.Custom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        ((BufImgSurfaceData) sData).initSolidLoops();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        return sData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    public static SurfaceData createData(Raster ras, ColorModel cm) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        throw new InternalError("SurfaceData not implemented for Raster/CM");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    public static SurfaceData createDataIC(BufferedImage bImg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
                                           SurfaceType sType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        IntegerComponentRaster icRaster =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
            (IntegerComponentRaster)bImg.getRaster();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        BufImgSurfaceData bisd =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            new BufImgSurfaceData(icRaster.getDataBuffer(), bImg, sType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        bisd.initRaster(icRaster.getDataStorage(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                        icRaster.getDataOffset(0) * 4, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                        icRaster.getWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                        icRaster.getHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                        icRaster.getPixelStride() * 4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                        icRaster.getScanlineStride() * 4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                        null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        return bisd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    public static SurfaceData createDataSC(BufferedImage bImg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                                           SurfaceType sType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                                           IndexColorModel icm) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        ShortComponentRaster scRaster =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            (ShortComponentRaster)bImg.getRaster();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        BufImgSurfaceData bisd =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            new BufImgSurfaceData(scRaster.getDataBuffer(), bImg, sType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        bisd.initRaster(scRaster.getDataStorage(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
                        scRaster.getDataOffset(0) * 2, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                        scRaster.getWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                        scRaster.getHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                        scRaster.getPixelStride() * 2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                        scRaster.getScanlineStride() * 2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                        icm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        return bisd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    public static SurfaceData createDataBC(BufferedImage bImg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                                           SurfaceType sType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
                                           int primaryBank) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        ByteComponentRaster bcRaster =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            (ByteComponentRaster)bImg.getRaster();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        BufImgSurfaceData bisd =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            new BufImgSurfaceData(bcRaster.getDataBuffer(), bImg, sType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        ColorModel cm = bImg.getColorModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        IndexColorModel icm = ((cm instanceof IndexColorModel)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                               ? (IndexColorModel) cm
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
                               : null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        bisd.initRaster(bcRaster.getDataStorage(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                        bcRaster.getDataOffset(primaryBank), 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                        bcRaster.getWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                        bcRaster.getHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                        bcRaster.getPixelStride(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                        bcRaster.getScanlineStride(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                        icm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        return bisd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    public static SurfaceData createDataBP(BufferedImage bImg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                                           SurfaceType sType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        BytePackedRaster bpRaster =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
            (BytePackedRaster)bImg.getRaster();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        BufImgSurfaceData bisd =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            new BufImgSurfaceData(bpRaster.getDataBuffer(), bImg, sType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        ColorModel cm = bImg.getColorModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        IndexColorModel icm = ((cm instanceof IndexColorModel)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                               ? (IndexColorModel) cm
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                               : null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        bisd.initRaster(bpRaster.getDataStorage(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                        bpRaster.getDataBitOffset() / 8,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                        bpRaster.getDataBitOffset() & 7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                        bpRaster.getWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                        bpRaster.getHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                        0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                        bpRaster.getScanlineStride(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                        icm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        return bisd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
11080
7e18e343964e 7117914: Fix javac warnings in src/share/classes/sun/java2d
neugens
parents: 7668
diff changeset
   331
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
7e18e343964e 7117914: Fix javac warnings in src/share/classes/sun/java2d
neugens
parents: 7668
diff changeset
   332
            sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
            return solidloops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        return super.getRenderLoops(sg2d);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    public java.awt.image.Raster getRaster(int x, int y, int w, int h) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
        return bufImg.getRaster();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * Initializes the native Ops pointer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    protected native void initRaster(Object theArray,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                                     int offset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                                     int bitoffset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
                                     int width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                                     int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                                     int pixStr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                                     int scanStr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                                     IndexColorModel icm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    public BufImgSurfaceData(DataBuffer db,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                             BufferedImage bufImg, SurfaceType sType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        super(SunWritableRaster.stealTrackable(db),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
              sType, bufImg.getColorModel());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        this.bufImg = bufImg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11080
diff changeset
   363
    protected BufImgSurfaceData(SurfaceType surfaceType, ColorModel cm) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11080
diff changeset
   364
        super(surfaceType, cm);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11080
diff changeset
   365
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11080
diff changeset
   366
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    public void initSolidLoops() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        this.solidloops = getSolidLoops(getSurfaceType());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    private static final int CACHE_SIZE = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    private static RenderLoops loopcache[] = new RenderLoops[CACHE_SIZE];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    private static SurfaceType typecache[] = new SurfaceType[CACHE_SIZE];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    public static synchronized RenderLoops getSolidLoops(SurfaceType type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        for (int i = CACHE_SIZE - 1; i >= 0; i--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
            SurfaceType t = typecache[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
            if (t == type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                return loopcache[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
            } else if (t == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        RenderLoops l = makeRenderLoops(SurfaceType.OpaqueColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                                        CompositeType.SrcNoEa,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                                        type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        System.arraycopy(loopcache, 1, loopcache, 0, CACHE_SIZE-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        System.arraycopy(typecache, 1, typecache, 0, CACHE_SIZE-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        loopcache[CACHE_SIZE - 1] = l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        typecache[CACHE_SIZE - 1] = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        return l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    public SurfaceData getReplacement() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        // BufImgSurfaceData objects should never lose their contents,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        // so this method should never be called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        return restoreContents(bufImg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    public synchronized GraphicsConfiguration getDeviceConfiguration() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        if (graphicsConfig == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
            graphicsConfig = BufferedImageGraphicsConfig.getConfig(bufImg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        return graphicsConfig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    public java.awt.Rectangle getBounds() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        return new Rectangle(bufImg.getWidth(), bufImg.getHeight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    protected void checkCustomComposite() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        // BufferedImages always allow Custom Composite objects since
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        // their pixels are immediately retrievable anyway.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
6861
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   415
    private static native void freeNativeICMData(long pData);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * Returns destination Image associated with this SurfaceData.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    public Object getDestination() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        return bufImg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    }
6861
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   423
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   424
    public static final class ICMColorData {
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   425
        private long pData = 0L;
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   426
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   427
        private ICMColorData(long pData) {
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   428
            this.pData = pData;
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   429
        }
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   430
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   431
        public void finalize() {
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   432
            if (pData != 0L) {
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   433
                BufImgSurfaceData.freeNativeICMData(pData);
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   434
                pData = 0L;
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   435
            }
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   436
        }
0c879c7c2ea2 6925710: IndexColorModel.finalize can be made to double free
bae
parents: 5506
diff changeset
   437
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
}