src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java
author serb
Fri, 13 Sep 2019 17:35:12 -0700
changeset 58324 0aba35254e00
parent 53673 e04d39094915
permissions -rw-r--r--
8229896: Delete an unused code in the BufferedContext Reviewed-by: prr, jdv
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
     2
 * Copyright (c) 2004, 2019, 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: 1730
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: 1730
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: 1730
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1730
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1730
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.java2d.opengl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.AWTException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.BufferCapabilities;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    30
import java.awt.Color;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.Component;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.Graphics;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    33
import java.awt.Graphics2D;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.awt.ImageCapabilities;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.awt.Transparency;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.awt.color.ColorSpace;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.awt.image.ColorModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.awt.image.DataBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.awt.image.DirectColorModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.awt.image.VolatileImage;
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
    41
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import sun.awt.Win32GraphicsConfig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import sun.awt.Win32GraphicsDevice;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import sun.awt.image.SunVolatileImage;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    45
import sun.awt.image.SurfaceManager;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import sun.awt.windows.WComponentPeer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import sun.java2d.Disposer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import sun.java2d.DisposerRecord;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    49
import sun.java2d.SunGraphics2D;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    50
import sun.java2d.Surface;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import sun.java2d.SurfaceData;
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
    52
import sun.java2d.opengl.OGLContext.OGLContextCaps;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    53
import sun.java2d.pipe.hw.AccelSurface;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    54
import sun.java2d.pipe.hw.AccelTypedVolatileImage;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    55
import sun.java2d.pipe.hw.ContextCapabilities;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    56
import sun.java2d.windows.GDIWindowSurfaceData;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
    58
import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_DOUBLEBUFFERED;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
    59
import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_EXT_FBOBJECT;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
    60
import static sun.java2d.opengl.WGLSurfaceData.FBOBJECT;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
    61
import static sun.java2d.opengl.WGLSurfaceData.TEXTURE;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
    62
import static sun.java2d.opengl.WGLSurfaceData.WGLVSyncOffScreenSurfaceData;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
    63
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
    64
public final class WGLGraphicsConfig
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    extends Win32GraphicsConfig
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    implements OGLGraphicsConfig
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    protected static boolean wglAvailable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    private static ImageCapabilities imageCaps = new WGLImageCaps();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    private BufferCapabilities bufferCaps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    private long pConfigInfo;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    73
    private ContextCapabilities oglCaps;
58324
0aba35254e00 8229896: Delete an unused code in the BufferedContext
serb
parents: 53673
diff changeset
    74
    private final OGLContext context;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    private Object disposerReferent = new Object();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    public static native int getDefaultPixFmt(int screennum);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    private static native boolean initWGL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    private static native long getWGLConfigInfo(int screennum, int visualnum);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    private static native int getOGLCapabilities(long configInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        wglAvailable = initWGL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
28234
f694f2576719 8067092: Suppress windows-specific deprecation warnings in the java.desktop module
darcy
parents: 25859
diff changeset
    86
    @SuppressWarnings("deprecation")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    protected WGLGraphicsConfig(Win32GraphicsDevice device, int visualnum,
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    88
                                long configInfo, ContextCapabilities oglCaps)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        super(device, visualnum);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        this.pConfigInfo = configInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        this.oglCaps = oglCaps;
58324
0aba35254e00 8229896: Delete an unused code in the BufferedContext
serb
parents: 53673
diff changeset
    93
        context = new OGLContext(OGLRenderQueue.getInstance());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        // add a record to the Disposer so that we destroy the native
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        // WGLGraphicsConfigInfo data when this object goes away
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        Disposer.addRecord(disposerReferent,
41398
1f7d85a74c12 8155753: Removing a monitor in the OS dispaly configuration causes assertion fails under Windows if D3D is on
ssadetsky
parents: 35983
diff changeset
    98
                           new WGLGCDisposerRecord(pConfigInfo));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
   101
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    public Object getProxyKey() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
   106
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    public SurfaceData createManagedSurface(int w, int h, int transparency) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        return WGLSurfaceData.createData(this, w, h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                                         getColorModel(transparency),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                                         null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                                         OGLSurfaceData.TEXTURE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    public static WGLGraphicsConfig getConfig(Win32GraphicsDevice device,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                                              int pixfmt)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        if (!wglAvailable) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        long cfginfo = 0;
52248
2e330da7cbf4 8211300: Convert C-style array declarations in JDK client code
tvaleev
parents: 47216
diff changeset
   122
        final String[] ids = new String[1];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        OGLRenderQueue rq = OGLRenderQueue.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        rq.lock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            // getWGLConfigInfo() creates and destroys temporary
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            // surfaces/contexts, so we should first invalidate the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            // Java-level context and flush the queue...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            OGLContext.invalidateCurrentContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            WGLGetConfigInfo action =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                new WGLGetConfigInfo(device.getScreen(), pixfmt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            rq.flushAndInvokeNow(action);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            cfginfo = action.getConfigInfo();
1730
2482c2865beb 6755274: 6u10b33 2d tests fails on sles10x64 with jvm crash
tdv
parents: 888
diff changeset
   134
            if (cfginfo != 0L) {
2482c2865beb 6755274: 6u10b33 2d tests fails on sles10x64 with jvm crash
tdv
parents: 888
diff changeset
   135
                OGLContext.setScratchSurface(cfginfo);
2482c2865beb 6755274: 6u10b33 2d tests fails on sles10x64 with jvm crash
tdv
parents: 888
diff changeset
   136
                rq.flushAndInvokeNow(new Runnable() {
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
   137
                    @Override
1730
2482c2865beb 6755274: 6u10b33 2d tests fails on sles10x64 with jvm crash
tdv
parents: 888
diff changeset
   138
                    public void run() {
2482c2865beb 6755274: 6u10b33 2d tests fails on sles10x64 with jvm crash
tdv
parents: 888
diff changeset
   139
                        ids[0] = OGLContext.getOGLIdString();
2482c2865beb 6755274: 6u10b33 2d tests fails on sles10x64 with jvm crash
tdv
parents: 888
diff changeset
   140
                    }
2482c2865beb 6755274: 6u10b33 2d tests fails on sles10x64 with jvm crash
tdv
parents: 888
diff changeset
   141
                });
2482c2865beb 6755274: 6u10b33 2d tests fails on sles10x64 with jvm crash
tdv
parents: 888
diff changeset
   142
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            rq.unlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        if (cfginfo == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        int oglCaps = getOGLCapabilities(cfginfo);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   151
        ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   153
        return new WGLGraphicsConfig(device, pixfmt, cfginfo, caps);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * This is a small helper class that allows us to execute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * getWGLConfigInfo() on the queue flushing thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    private static class WGLGetConfigInfo implements Runnable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        private int screen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        private int pixfmt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        private long cfginfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        private WGLGetConfigInfo(int screen, int pixfmt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            this.screen = screen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            this.pixfmt = pixfmt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
   168
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            cfginfo = getWGLConfigInfo(screen, pixfmt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        public long getConfigInfo() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            return cfginfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    public static boolean isWGLAvailable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        return wglAvailable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * Returns true if the provided capability bit is present for this config.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * See OGLContext.java for a list of supported capabilities.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     */
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   185
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    public final boolean isCapPresent(int cap) {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   187
        return ((oglCaps.getCaps() & cap) != 0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   190
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    public final long getNativeConfigInfo() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        return pConfigInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   195
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    public final OGLContext getContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        return context;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    private static class WGLGCDisposerRecord implements DisposerRecord {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        private long pCfgInfo;
41398
1f7d85a74c12 8155753: Removing a monitor in the OS dispaly configuration causes assertion fails under Windows if D3D is on
ssadetsky
parents: 35983
diff changeset
   202
        public WGLGCDisposerRecord(long pCfgInfo) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            this.pCfgInfo = pCfgInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        }
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
   205
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        public void dispose() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            if (pCfgInfo != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                OGLRenderQueue.disposeGraphicsConfig(pCfgInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                pCfgInfo = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    public synchronized void displayChanged() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        super.displayChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        // the context could hold a reference to a WGLSurfaceData, which in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        // turn has a reference back to this WGLGraphicsConfig, so in order
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        // for this instance to be disposed we need to break the connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        OGLRenderQueue rq = OGLRenderQueue.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        rq.lock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            OGLContext.invalidateCurrentContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            rq.unlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    public ColorModel getColorModel(int transparency) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        switch (transparency) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        case Transparency.OPAQUE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            // REMIND: once the ColorModel spec is changed, this should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            //         an opaque premultiplied DCM...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        case Transparency.BITMASK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        case Transparency.TRANSLUCENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            return new DirectColorModel(cs, 32,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                                        0xff0000, 0xff00, 0xff, 0xff000000,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                                        true, DataBuffer.TYPE_INT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    public String toString() {
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
   250
        return ("WGLGraphicsConfig[dev="+getDevice()+",pixfmt="+visual+"]");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * The following methods are invoked from WComponentPeer.java rather
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * than having the Win32-dependent implementations hardcoded in that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * class.  This way the appropriate actions are taken based on the peer's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * GraphicsConfig, whether it is a Win32GraphicsConfig or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * WGLGraphicsConfig.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * Creates a new SurfaceData that will be associated with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * WComponentPeer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    public SurfaceData createSurfaceData(WComponentPeer peer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                                         int numBackBuffers)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   269
        SurfaceData sd = WGLSurfaceData.createData(peer);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   270
        if (sd == null) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   271
            sd = GDIWindowSurfaceData.createData(peer);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   272
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   273
        return sd;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * The following methods correspond to the multibuffering methods in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * WComponentPeer.java...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * Checks that the requested configuration is natively supported; if not,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * an AWTException is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    public void assertOperationSupported(Component target,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                                         int numBuffers,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                                         BufferCapabilities caps)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        throws AWTException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        if (numBuffers > 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            throw new AWTException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
                "Only double or single buffering is supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        BufferCapabilities configCaps = getBufferCapabilities();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        if (!configCaps.isPageFlipping()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            throw new AWTException("Page flipping is not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            throw new AWTException("FlipContents.PRIOR is not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * Creates a WGL-based backbuffer for the given peer and returns the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * image wrapper.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    public VolatileImage createBackBuffer(WComponentPeer peer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        Component target = (Component)peer.getTarget();
35983
569084822dc1 8148127: IllegalArgumentException thrown by JCK test api/java_awt/Component/FlipBufferStrategy/indexTGF_General in opengl pipeline
psadhukhan
parents: 31661
diff changeset
   311
        // it is possible for the component to have size 0x0, adjust it to
569084822dc1 8148127: IllegalArgumentException thrown by JCK test api/java_awt/Component/FlipBufferStrategy/indexTGF_General in opengl pipeline
psadhukhan
parents: 31661
diff changeset
   312
        // be at least 1x1 to avoid IAE
569084822dc1 8148127: IllegalArgumentException thrown by JCK test api/java_awt/Component/FlipBufferStrategy/indexTGF_General in opengl pipeline
psadhukhan
parents: 31661
diff changeset
   313
        int w = Math.max(1, target.getWidth());
569084822dc1 8148127: IllegalArgumentException thrown by JCK test api/java_awt/Component/FlipBufferStrategy/indexTGF_General in opengl pipeline
psadhukhan
parents: 31661
diff changeset
   314
        int h = Math.max(1, target.getHeight());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        return new SunVolatileImage(target,
35983
569084822dc1 8148127: IllegalArgumentException thrown by JCK test api/java_awt/Component/FlipBufferStrategy/indexTGF_General in opengl pipeline
psadhukhan
parents: 31661
diff changeset
   316
                                    w, h,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                                    Boolean.TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * Performs the native WGL flip operation for the given target Component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    public void flip(WComponentPeer peer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                     Component target, VolatileImage backBuffer,
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   326
                     int x1, int y1, int x2, int y2,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                     BufferCapabilities.FlipContents flipAction)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        if (flipAction == BufferCapabilities.FlipContents.COPIED) {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   330
            SurfaceManager vsm = SurfaceManager.getManager(backBuffer);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   331
            SurfaceData sd = vsm.getPrimarySurfaceData();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   332
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   333
            if (sd instanceof WGLVSyncOffScreenSurfaceData) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   334
                WGLVSyncOffScreenSurfaceData vsd =
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   335
                    (WGLVSyncOffScreenSurfaceData)sd;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   336
                SurfaceData bbsd = vsd.getFlipSurface();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   337
                Graphics2D bbg =
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   338
                    new SunGraphics2D(bbsd, Color.black, Color.white, null);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   339
                try {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   340
                    bbg.drawImage(backBuffer, 0, 0, null);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   341
                } finally {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   342
                    bbg.dispose();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   343
                }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   344
            } else {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   345
                Graphics g = peer.getGraphics();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   346
                try {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   347
                    g.drawImage(backBuffer,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   348
                                x1, y1, x2, y2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   349
                                x1, y1, x2, y2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   350
                                null);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   351
                } finally {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   352
                    g.dispose();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   353
                }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   354
                return;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        } else if (flipAction == BufferCapabilities.FlipContents.PRIOR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
            // not supported by WGL...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        OGLSurfaceData.swapBuffers(peer.getData());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
            Graphics g = backBuffer.getGraphics();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
                g.setColor(target.getBackground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                g.fillRect(0, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                           backBuffer.getWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
                           backBuffer.getHeight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                g.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    private static class WGLBufferCaps extends BufferCapabilities {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        public WGLBufferCaps(boolean dblBuf) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            super(imageCaps, imageCaps,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                  dblBuf ? FlipContents.UNDEFINED : null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    public BufferCapabilities getBufferCapabilities() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        if (bufferCaps == null) {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   386
            boolean dblBuf = isCapPresent(CAPS_DOUBLEBUFFERED);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            bufferCaps = new WGLBufferCaps(dblBuf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        return bufferCaps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    private static class WGLImageCaps extends ImageCapabilities {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        private WGLImageCaps() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            super(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        }
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 52248
diff changeset
   396
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        public boolean isTrueVolatile() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    public ImageCapabilities getImageCapabilities() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        return imageCaps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    }
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   406
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   407
    @Override
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   408
    public VolatileImage
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   409
        createCompatibleVolatileImage(int width, int height,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   410
                                      int transparency, int type)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   411
    {
31661
a5cb86f2253b 7188942: Remove support of pbuffers in OGL Java2d pipeline
serb
parents: 28234
diff changeset
   412
        if ((type != FBOBJECT && type != TEXTURE)
a5cb86f2253b 7188942: Remove support of pbuffers in OGL Java2d pipeline
serb
parents: 28234
diff changeset
   413
                || transparency == Transparency.BITMASK
a5cb86f2253b 7188942: Remove support of pbuffers in OGL Java2d pipeline
serb
parents: 28234
diff changeset
   414
                || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   415
            return null;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   416
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   417
        SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   418
                                                          transparency, type);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   419
        Surface sd = vi.getDestSurface();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   420
        if (!(sd instanceof AccelSurface) ||
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   421
            ((AccelSurface)sd).getType() != type)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   422
        {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   423
            vi.flush();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   424
            vi = null;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   425
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   426
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   427
        return vi;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   428
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   429
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   430
    @Override
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   431
    public ContextCapabilities getContextCapabilities() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   432
        return oglCaps;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   433
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
}