jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java
author chegar
Sun, 17 Aug 2014 15:54:13 +0100
changeset 25859 3317bb8137f4
parent 5506 jdk/src/windows/classes/sun/java2d/opengl/WGLSurfaceData.java@202f599c92aa
child 30948 0a0972d3b58d
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2451
diff changeset
     2
 * Copyright (c) 2004, 2009, 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: 2451
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: 2451
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: 2451
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2451
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2451
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.Component;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.GraphicsConfiguration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.GraphicsDevice;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.GraphicsEnvironment;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.Image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.awt.Rectangle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.awt.image.ColorModel;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    35
import sun.awt.SunToolkit;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.awt.windows.WComponentPeer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import sun.java2d.SurfaceData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
public abstract class WGLSurfaceData extends OGLSurfaceData {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    protected WComponentPeer peer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private WGLGraphicsConfig graphicsConfig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    44
    private native void initOps(long pConfigInfo, WComponentPeer peer,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    45
                                long hwnd);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    protected native boolean initPbuffer(long pData, long pConfigInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
                                         boolean isOpaque,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
                                         int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    protected WGLSurfaceData(WComponentPeer peer, WGLGraphicsConfig gc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
                             ColorModel cm, int type)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        super(gc, cm, type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        this.peer = peer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        this.graphicsConfig = gc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        long pConfigInfo = gc.getNativeConfigInfo();
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    58
        long hwnd = peer != null ? peer.getHWnd() : 0L;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    60
        initOps(pConfigInfo, peer, hwnd);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    public GraphicsConfiguration getDeviceConfiguration() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        return graphicsConfig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Creates a SurfaceData object representing the primary (front) buffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * of an on-screen Window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public static WGLWindowSurfaceData createData(WComponentPeer peer) {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    72
        // the OGL pipeline can render directly to the screen and interfere
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    73
        // with layered windows, which is why we don't allow accelerated
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    74
        // surfaces in this case
2451
597df8e1d786 6633275: Need to support shaped/translucent windows
art
parents: 888
diff changeset
    75
        if (!peer.isAccelCapable() ||
597df8e1d786 6633275: Need to support shaped/translucent windows
art
parents: 888
diff changeset
    76
            !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    77
        {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    78
            return null;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    79
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        WGLGraphicsConfig gc = getGC(peer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        return new WGLWindowSurfaceData(peer, gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * Creates a SurfaceData object representing the back buffer of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * double-buffered on-screen Window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public static WGLOffScreenSurfaceData createData(WComponentPeer peer,
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    89
                                                     Image image,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    90
                                                     int type)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    92
        // the OGL pipeline can render directly to the screen and interfere
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    93
        // with layered windows, which is why we don't allow accelerated
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    94
        // surfaces in this case
2451
597df8e1d786 6633275: Need to support shaped/translucent windows
art
parents: 888
diff changeset
    95
        if (!peer.isAccelCapable() ||
597df8e1d786 6633275: Need to support shaped/translucent windows
art
parents: 888
diff changeset
    96
            !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    97
        {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    98
            return null;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    99
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        WGLGraphicsConfig gc = getGC(peer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        Rectangle r = peer.getBounds();
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   102
        if (type == FLIP_BACKBUFFER) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   103
            return new WGLOffScreenSurfaceData(peer, gc, r.width, r.height,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   104
                                               image, peer.getColorModel(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   105
                                               type);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   106
        } else {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   107
            return new WGLVSyncOffScreenSurfaceData(peer, gc, r.width, r.height,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   108
                                                    image, peer.getColorModel(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   109
                                                    type);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   110
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * Creates a SurfaceData object representing an off-screen buffer (either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * a Pbuffer or Texture).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    public static WGLOffScreenSurfaceData createData(WGLGraphicsConfig gc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                                                     int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                                                     ColorModel cm,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                                                     Image image, int type)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        return new WGLOffScreenSurfaceData(null, gc, width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                                           image, cm, type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    public static WGLGraphicsConfig getGC(WComponentPeer peer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        if (peer != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            return (WGLGraphicsConfig)peer.getGraphicsConfiguration();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            // REMIND: this should rarely (never?) happen, but what if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            //         default config is not WGL?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            GraphicsEnvironment env =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                GraphicsEnvironment.getLocalGraphicsEnvironment();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            GraphicsDevice gd = env.getDefaultScreenDevice();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            return (WGLGraphicsConfig)gd.getDefaultConfiguration();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    public static class WGLWindowSurfaceData extends WGLSurfaceData {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        public WGLWindowSurfaceData(WComponentPeer peer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                                    WGLGraphicsConfig gc)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            super(peer, gc, peer.getColorModel(), WINDOW);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        public SurfaceData getReplacement() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            return peer.getSurfaceData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        public Rectangle getBounds() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            Rectangle r = peer.getBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            r.x = r.y = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            return r;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
         * Returns destination Component associated with this SurfaceData.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        public Object getDestination() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            return peer.getTarget();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   165
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   166
     * A surface which implements a v-synced flip back-buffer with COPIED
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   167
     * FlipContents.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   168
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   169
     * This surface serves as a back-buffer to the outside world, while
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   170
     * it is actually an offscreen surface. When the BufferStrategy this surface
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   171
     * belongs to is showed, it is first copied to the real private
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   172
     * FLIP_BACKBUFFER, which is then flipped.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   173
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   174
    public static class WGLVSyncOffScreenSurfaceData extends
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   175
        WGLOffScreenSurfaceData
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   176
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   177
        private WGLOffScreenSurfaceData flipSurface;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   178
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   179
        public WGLVSyncOffScreenSurfaceData(WComponentPeer peer,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   180
                                            WGLGraphicsConfig gc,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   181
                                            int width, int height,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   182
                                            Image image, ColorModel cm,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   183
                                            int type)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   184
        {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   185
            super(peer, gc, width, height, image, cm, type);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   186
            flipSurface = WGLSurfaceData.createData(peer, image, FLIP_BACKBUFFER);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   187
        }
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
        public SurfaceData getFlipSurface() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   190
            return flipSurface;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   191
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   192
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   193
        @Override
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   194
        public void flush() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   195
            flipSurface.flush();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   196
            super.flush();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   197
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   198
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   199
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   200
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    public static class WGLOffScreenSurfaceData extends WGLSurfaceData {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        private Image offscreenImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        private int width, height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        public WGLOffScreenSurfaceData(WComponentPeer peer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                                       WGLGraphicsConfig gc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                                       int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                                       Image image, ColorModel cm,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                                       int type)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            super(peer, gc, cm, type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            this.width = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            this.height = height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            offscreenImage = image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            initSurface(width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        public SurfaceData getReplacement() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            return restoreContents(offscreenImage);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        public Rectangle getBounds() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            if (type == FLIP_BACKBUFFER) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                Rectangle r = peer.getBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                r.x = r.y = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                return r;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
                return new Rectangle(width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
         * Returns destination Image associated with this SurfaceData.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        public Object getDestination() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            return offscreenImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    }
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   242
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   243
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   244
     * Updates the layered window with the contents of the surface.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   245
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   246
     * @param psdops pointer to the native ogl sd structure
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   247
     * @param pData pointer to the AwtWindow peer data
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   248
     * @param w width of the window
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   249
     * @param h height of the window
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   250
     * @see sun.awt.windows.TranslucentWindowPainter
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   251
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   252
    public static native boolean updateWindowAccelImpl(long psdops,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   253
                                                       WComponentPeer peer,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   254
                                                       int w, int h);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
}