1 /*
2 * Copyright (c) 2007, 2008, 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
62 D3DGraphicsDevice gd = (D3DGraphicsDevice)
63 vImg.getGraphicsConfig().getDevice();
64 accelerationEnabled =
65 (transparency == Transparency.OPAQUE) ||
66 (transparency == Transparency.TRANSLUCENT &&
67 (gd.isCapPresent(CAPS_RT_PLAIN_ALPHA) ||
68 gd.isCapPresent(CAPS_RT_TEXTURE_ALPHA)));
69 }
70
71 protected boolean isAccelerationEnabled() {
72 return accelerationEnabled;
73 }
74 public void setAccelerationEnabled(boolean accelerationEnabled) {
75 this.accelerationEnabled = accelerationEnabled;
76 }
77
78 /**
79 * Create a pbuffer-based SurfaceData object (or init the backbuffer
80 * of an existing window if this is a double buffered GraphicsConfig).
81 */
82 protected SurfaceData initAcceleratedSurface() {
83 SurfaceData sData;
84 Component comp = vImg.getComponent();
85 WComponentPeer peer =
86 (comp != null) ? (WComponentPeer)comp.getPeer() : null;
87
88 try {
89 boolean forceback = false;
90 if (context instanceof Boolean) {
91 forceback = ((Boolean)context).booleanValue();
92 }
93
94 if (forceback) {
95 // peer must be non-null in this case
96 sData = D3DSurfaceData.createData(peer, vImg);
97 } else {
98 D3DGraphicsConfig gc =
99 (D3DGraphicsConfig)vImg.getGraphicsConfig();
100 ColorModel cm = gc.getColorModel(vImg.getTransparency());
101 int type = vImg.getForcedAccelSurfaceType();
|
1 /*
2 * Copyright (c) 2007, 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
62 D3DGraphicsDevice gd = (D3DGraphicsDevice)
63 vImg.getGraphicsConfig().getDevice();
64 accelerationEnabled =
65 (transparency == Transparency.OPAQUE) ||
66 (transparency == Transparency.TRANSLUCENT &&
67 (gd.isCapPresent(CAPS_RT_PLAIN_ALPHA) ||
68 gd.isCapPresent(CAPS_RT_TEXTURE_ALPHA)));
69 }
70
71 protected boolean isAccelerationEnabled() {
72 return accelerationEnabled;
73 }
74 public void setAccelerationEnabled(boolean accelerationEnabled) {
75 this.accelerationEnabled = accelerationEnabled;
76 }
77
78 /**
79 * Create a pbuffer-based SurfaceData object (or init the backbuffer
80 * of an existing window if this is a double buffered GraphicsConfig).
81 */
82 @SuppressWarnings("deprecation")
83 protected SurfaceData initAcceleratedSurface() {
84 SurfaceData sData;
85 Component comp = vImg.getComponent();
86 WComponentPeer peer =
87 (comp != null) ? (WComponentPeer)comp.getPeer() : null;
88
89 try {
90 boolean forceback = false;
91 if (context instanceof Boolean) {
92 forceback = ((Boolean)context).booleanValue();
93 }
94
95 if (forceback) {
96 // peer must be non-null in this case
97 sData = D3DSurfaceData.createData(peer, vImg);
98 } else {
99 D3DGraphicsConfig gc =
100 (D3DGraphicsConfig)vImg.getGraphicsConfig();
101 ColorModel cm = gc.getColorModel(vImg.getTransparency());
102 int type = vImg.getForcedAccelSurfaceType();
|