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