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 23 * questions. 24 */ 25 26 package sun.java2d.d3d; 27 28 import java.awt.AWTException; 29 import java.awt.BufferCapabilities; 30 import java.awt.BufferCapabilities.FlipContents; 31 import java.awt.Component; 32 import java.awt.Graphics; 33 import java.awt.ImageCapabilities; 34 import java.awt.Transparency; 35 import java.awt.color.ColorSpace; 36 import java.awt.image.ColorModel; 37 import java.awt.image.DataBuffer; 38 import java.awt.image.DirectColorModel; 39 import java.awt.image.VolatileImage; 40 import sun.awt.Win32GraphicsConfig; 41 import sun.awt.image.SunVolatileImage; 42 import sun.awt.image.SurfaceManager; 43 import sun.awt.windows.WComponentPeer; 44 import sun.java2d.Surface; 45 import sun.java2d.SurfaceData; 46 import sun.java2d.pipe.hw.AccelDeviceEventNotifier; 47 import sun.java2d.pipe.hw.AccelTypedVolatileImage; 48 import sun.java2d.pipe.hw.AccelGraphicsConfig; 49 import sun.java2d.pipe.hw.AccelSurface; 50 import sun.java2d.pipe.hw.ContextCapabilities; 51 import static sun.java2d.pipe.hw.AccelSurface.*; 52 import static sun.java2d.d3d.D3DContext.D3DContextCaps.*; 53 import sun.java2d.pipe.hw.AccelDeviceEventListener; 54 55 public class D3DGraphicsConfig 56 extends Win32GraphicsConfig 57 implements AccelGraphicsConfig 58 { 59 private static ImageCapabilities imageCaps = new D3DImageCaps(); 60 61 private BufferCapabilities bufferCaps; 62 private D3DGraphicsDevice device; 63 64 @SuppressWarnings("deprecation") 65 protected D3DGraphicsConfig(D3DGraphicsDevice device) { 66 super(device, 0); 67 this.device = device; 68 } 69 70 public SurfaceData createManagedSurface(int w, int h, int transparency) { 71 return D3DSurfaceData.createData(this, w, h, 72 getColorModel(transparency), 73 null, 297 transparency, type); 298 Surface sd = vi.getDestSurface(); 299 if (!(sd instanceof AccelSurface) || 300 ((AccelSurface)sd).getType() != type) 301 { 302 vi.flush(); 303 vi = null; 304 } 305 306 return vi; 307 } 308 309 /** 310 * {@inheritDoc} 311 * 312 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities 313 */ 314 @Override 315 public ContextCapabilities getContextCapabilities() { 316 return device.getContextCapabilities(); 317 } 318 319 @Override 320 public void addDeviceEventListener(AccelDeviceEventListener l) { 321 AccelDeviceEventNotifier.addListener(l, device.getScreen()); 322 } 323 324 @Override 325 public void removeDeviceEventListener(AccelDeviceEventListener l) { 326 AccelDeviceEventNotifier.removeListener(l); 327 } 328 } | 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 23 * questions. 24 */ 25 26 package sun.java2d.d3d; 27 28 import java.awt.AWTException; 29 import java.awt.BufferCapabilities; 30 import java.awt.Component; 31 import java.awt.Graphics; 32 import java.awt.ImageCapabilities; 33 import java.awt.Transparency; 34 import java.awt.color.ColorSpace; 35 import java.awt.image.ColorModel; 36 import java.awt.image.DataBuffer; 37 import java.awt.image.DirectColorModel; 38 import java.awt.image.VolatileImage; 39 import sun.awt.Win32GraphicsConfig; 40 import sun.awt.image.SunVolatileImage; 41 import sun.awt.image.SurfaceManager; 42 import sun.awt.windows.WComponentPeer; 43 import sun.java2d.Surface; 44 import sun.java2d.SurfaceData; 45 import sun.java2d.pipe.hw.AccelTypedVolatileImage; 46 import sun.java2d.pipe.hw.AccelGraphicsConfig; 47 import sun.java2d.pipe.hw.AccelSurface; 48 import sun.java2d.pipe.hw.ContextCapabilities; 49 import static sun.java2d.pipe.hw.AccelSurface.*; 50 import static sun.java2d.d3d.D3DContext.D3DContextCaps.*; 51 52 public class D3DGraphicsConfig 53 extends Win32GraphicsConfig 54 implements AccelGraphicsConfig 55 { 56 private static ImageCapabilities imageCaps = new D3DImageCaps(); 57 58 private BufferCapabilities bufferCaps; 59 private D3DGraphicsDevice device; 60 61 @SuppressWarnings("deprecation") 62 protected D3DGraphicsConfig(D3DGraphicsDevice device) { 63 super(device, 0); 64 this.device = device; 65 } 66 67 public SurfaceData createManagedSurface(int w, int h, int transparency) { 68 return D3DSurfaceData.createData(this, w, h, 69 getColorModel(transparency), 70 null, 294 transparency, type); 295 Surface sd = vi.getDestSurface(); 296 if (!(sd instanceof AccelSurface) || 297 ((AccelSurface)sd).getType() != type) 298 { 299 vi.flush(); 300 vi = null; 301 } 302 303 return vi; 304 } 305 306 /** 307 * {@inheritDoc} 308 * 309 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities 310 */ 311 @Override 312 public ContextCapabilities getContextCapabilities() { 313 return device.getContextCapabilities(); 314 } 315 } |