24 */
25
26 package sun.java2d.opengl;
27
28 import java.awt.Component;
29 import java.awt.GraphicsConfiguration;
30 import java.awt.GraphicsDevice;
31 import java.awt.GraphicsEnvironment;
32 import java.awt.Image;
33 import java.awt.Rectangle;
34 import java.awt.image.ColorModel;
35 import sun.awt.SunToolkit;
36 import sun.awt.windows.WComponentPeer;
37 import sun.java2d.SurfaceData;
38
39 public abstract class WGLSurfaceData extends OGLSurfaceData {
40
41 protected WComponentPeer peer;
42 private WGLGraphicsConfig graphicsConfig;
43
44 private native void initOps(long pConfigInfo, WComponentPeer peer,
45 long hwnd);
46 protected native boolean initPbuffer(long pData, long pConfigInfo,
47 boolean isOpaque,
48 int width, int height);
49
50 protected WGLSurfaceData(WComponentPeer peer, WGLGraphicsConfig gc,
51 ColorModel cm, int type)
52 {
53 super(gc, cm, type);
54 this.peer = peer;
55 this.graphicsConfig = gc;
56
57 long pConfigInfo = gc.getNativeConfigInfo();
58 long hwnd = peer != null ? peer.getHWnd() : 0L;
59
60 initOps(pConfigInfo, peer, hwnd);
61 }
62
63 public GraphicsConfiguration getDeviceConfiguration() {
64 return graphicsConfig;
65 }
66
67 /**
68 * Creates a SurfaceData object representing the primary (front) buffer
69 * of an on-screen Window.
70 */
71 public static WGLWindowSurfaceData createData(WComponentPeer peer) {
72 // the OGL pipeline can render directly to the screen and interfere
73 // with layered windows, which is why we don't allow accelerated
74 // surfaces in this case
75 if (!peer.isAccelCapable() ||
76 !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
77 {
78 return null;
79 }
80 WGLGraphicsConfig gc = getGC(peer);
|
24 */
25
26 package sun.java2d.opengl;
27
28 import java.awt.Component;
29 import java.awt.GraphicsConfiguration;
30 import java.awt.GraphicsDevice;
31 import java.awt.GraphicsEnvironment;
32 import java.awt.Image;
33 import java.awt.Rectangle;
34 import java.awt.image.ColorModel;
35 import sun.awt.SunToolkit;
36 import sun.awt.windows.WComponentPeer;
37 import sun.java2d.SurfaceData;
38
39 public abstract class WGLSurfaceData extends OGLSurfaceData {
40
41 protected WComponentPeer peer;
42 private WGLGraphicsConfig graphicsConfig;
43
44 private native void initOps(OGLGraphicsConfig gc, long pConfigInfo,
45 WComponentPeer peer, long hwnd);
46 protected native boolean initPbuffer(long pData, long pConfigInfo,
47 boolean isOpaque,
48 int width, int height);
49
50 protected WGLSurfaceData(WComponentPeer peer, WGLGraphicsConfig gc,
51 ColorModel cm, int type)
52 {
53 super(gc, cm, type);
54 this.peer = peer;
55 this.graphicsConfig = gc;
56
57 long pConfigInfo = gc.getNativeConfigInfo();
58 long hwnd = peer != null ? peer.getHWnd() : 0L;
59
60 initOps(gc, pConfigInfo, peer, hwnd);
61 }
62
63 public GraphicsConfiguration getDeviceConfiguration() {
64 return graphicsConfig;
65 }
66
67 /**
68 * Creates a SurfaceData object representing the primary (front) buffer
69 * of an on-screen Window.
70 */
71 public static WGLWindowSurfaceData createData(WComponentPeer peer) {
72 // the OGL pipeline can render directly to the screen and interfere
73 // with layered windows, which is why we don't allow accelerated
74 // surfaces in this case
75 if (!peer.isAccelCapable() ||
76 !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
77 {
78 return null;
79 }
80 WGLGraphicsConfig gc = getGC(peer);
|