1 /*
2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
56 * - the GraphicsConfig supports the FBO extension OR
57 * - the GraphicsConfig has a stored alpha channel
58 */
59 int transparency = vImg.getTransparency();
60 WGLGraphicsConfig gc = (WGLGraphicsConfig)vImg.getGraphicsConfig();
61 accelerationEnabled =
62 (transparency == Transparency.OPAQUE) ||
63 ((transparency == Transparency.TRANSLUCENT) &&
64 (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
65 gc.isCapPresent(CAPS_STORED_ALPHA)));
66 }
67
68 protected boolean isAccelerationEnabled() {
69 return accelerationEnabled;
70 }
71
72 /**
73 * Create a pbuffer-based SurfaceData object (or init the backbuffer
74 * of an existing window if this is a double buffered GraphicsConfig).
75 */
76 protected SurfaceData initAcceleratedSurface() {
77 SurfaceData sData;
78 Component comp = vImg.getComponent();
79 WComponentPeer peer =
80 (comp != null) ? (WComponentPeer)comp.getPeer() : null;
81
82 try {
83 boolean createVSynced = false;
84 boolean forceback = false;
85 if (context instanceof Boolean) {
86 forceback = ((Boolean)context).booleanValue();
87 if (forceback) {
88 BufferCapabilities caps = peer.getBackBufferCaps();
89 if (caps instanceof ExtendedBufferCapabilities) {
90 ExtendedBufferCapabilities ebc =
91 (ExtendedBufferCapabilities)caps;
92 if (ebc.getVSync() == VSYNC_ON &&
93 ebc.getFlipContents() == COPIED)
94 {
95 createVSynced = true;
|
1 /*
2 * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
56 * - the GraphicsConfig supports the FBO extension OR
57 * - the GraphicsConfig has a stored alpha channel
58 */
59 int transparency = vImg.getTransparency();
60 WGLGraphicsConfig gc = (WGLGraphicsConfig)vImg.getGraphicsConfig();
61 accelerationEnabled =
62 (transparency == Transparency.OPAQUE) ||
63 ((transparency == Transparency.TRANSLUCENT) &&
64 (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
65 gc.isCapPresent(CAPS_STORED_ALPHA)));
66 }
67
68 protected boolean isAccelerationEnabled() {
69 return accelerationEnabled;
70 }
71
72 /**
73 * Create a pbuffer-based SurfaceData object (or init the backbuffer
74 * of an existing window if this is a double buffered GraphicsConfig).
75 */
76 @SuppressWarnings("deprecation")
77 protected SurfaceData initAcceleratedSurface() {
78 SurfaceData sData;
79 Component comp = vImg.getComponent();
80 WComponentPeer peer =
81 (comp != null) ? (WComponentPeer)comp.getPeer() : null;
82
83 try {
84 boolean createVSynced = false;
85 boolean forceback = false;
86 if (context instanceof Boolean) {
87 forceback = ((Boolean)context).booleanValue();
88 if (forceback) {
89 BufferCapabilities caps = peer.getBackBufferCaps();
90 if (caps instanceof ExtendedBufferCapabilities) {
91 ExtendedBufferCapabilities ebc =
92 (ExtendedBufferCapabilities)caps;
93 if (ebc.getVSync() == VSYNC_ON &&
94 ebc.getFlipContents() == COPIED)
95 {
96 createVSynced = true;
|