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
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 protected D3DGraphicsConfig(D3DGraphicsDevice device) {
65 super(device, 0);
66 this.device = device;
67 }
68
69 public SurfaceData createManagedSurface(int w, int h, int transparency) {
70 return D3DSurfaceData.createData(this, w, h,
71 getColorModel(transparency),
72 null,
73 D3DSurfaceData.TEXTURE);
74 }
75
76 @Override
77 public synchronized void displayChanged() {
78 super.displayChanged();
79 // the context could hold a reference to a D3DSurfaceData, which in
80 // turn has a reference back to this D3DGraphicsConfig, so in order
81 // for this instance to be disposed we need to break the connection
82 D3DRenderQueue rq = D3DRenderQueue.getInstance();
83 rq.lock();
|
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
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,
74 D3DSurfaceData.TEXTURE);
75 }
76
77 @Override
78 public synchronized void displayChanged() {
79 super.displayChanged();
80 // the context could hold a reference to a D3DSurfaceData, which in
81 // turn has a reference back to this D3DGraphicsConfig, so in order
82 // for this instance to be disposed we need to break the connection
83 D3DRenderQueue rq = D3DRenderQueue.getInstance();
84 rq.lock();
|