summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-12-17 21:53:48 +0100
committerSven Gothel <[email protected]>2011-12-17 21:53:48 +0100
commit8e0f3ad54b5aa8ef4d71e0b85f84a34be4987b5e (patch)
tree5ac1839053c5d5458e48d4646f1b19499fd752ec /src/nativewindow/classes/jogamp
parent47dc069104723f3d2e8d9ebdd700182e067163d0 (diff)
New Interface 'OffscreenLayerOption', impl. by JAWTWindow (impl) and NewtCanvasAWT/GLCanvas (delegation) ; Fix GLCanvas OffscreenLayerSurface usage.
JAWTWindow.destroy(): - No more getGraphicsConfiguration().getScreen().getDevice().close() call, since the configuration (hence the device) is passed @ creation and owned by the caller. New Interface 'OffscreenLayerOption', impl. by JAWTWindow (impl) and NewtCanvasAWT/GLCanvas (delegation) - Abstract offscreenLayer option to be delegated by using classes - Allow offscreen testing of GLCanvas as well (like NewtCanvasAWT) Fix GLCanvas OffscreenLayerSurface usage - common 'createDrawableAndContext()' for context and drawable instance creation - addNotify() calls createDrawableAndContext() after super.addNotify() to be able to lock the surface (JAWTWindow) and hence to determine offscreen usage. - reshape(...) issues recreation 'dispose(true)' in case of using an offscreen layer - dispose() explicitly destroys the JAWTWindow NewtCanvasAWT: - explicitly close the device of the JAWTWindow (as GLCanvas does) Tests: com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01GLCanvasAWT com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer02NewtCanvasAWT
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
index 938760801..6d2860374 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
@@ -48,6 +48,7 @@ import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.OffscreenLayerOption;
import javax.media.nativewindow.OffscreenLayerSurface;
import javax.media.nativewindow.SurfaceUpdatedListener;
import javax.media.nativewindow.awt.AWTGraphicsConfiguration;
@@ -59,7 +60,7 @@ import javax.media.nativewindow.util.RectangleImmutable;
import jogamp.nativewindow.SurfaceUpdatedHelper;
-public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface {
+public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, OffscreenLayerOption {
protected static final boolean DEBUG = JAWTUtil.DEBUG;
// user properties
@@ -102,22 +103,18 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface
this.isApplet = false;
}
- /**
- * Request an JAWT offscreen layer if supported.
- * Shall be called before {@link #lockSurface()}.
- *
- * @see #getShallUseOffscreenLayer()
- * @see #isOffscreenLayerSurfaceEnabled()
- */
public void setShallUseOffscreenLayer(boolean v) {
shallUseOffscreenLayer = v;
}
- /** Returns the property set by {@link #setShallUseOffscreenLayer(boolean)}. */
public final boolean getShallUseOffscreenLayer() {
return shallUseOffscreenLayer;
}
+ public final boolean isOffscreenLayerSurfaceEnabled() {
+ return isOffscreenLayerSurface;
+ }
+
protected synchronized void invalidate() {
invalidateNative();
jawt = null;
@@ -167,14 +164,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface
/**
* {@inheritDoc}
- * @see #setShallUseOffscreenLayer(boolean)
- */
- public final boolean isOffscreenLayerSurfaceEnabled() {
- return isOffscreenLayerSurface;
- }
-
- /**
- * {@inheritDoc}
*/
public final void attachSurfaceLayer(final long layerHandle) throws NativeWindowException {
if( !isOffscreenLayerSurfaceEnabled() ) {
@@ -356,7 +345,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface
public synchronized void destroy() {
invalidate();
- getGraphicsConfiguration().getScreen().getDevice().close();
component = null; // don't dispose the AWT component, since we are merely an immutable uplink
}
@@ -454,14 +442,15 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface
return component.hasFocus();
}
- @Override
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("JAWT-Window["+
"windowHandle 0x"+Long.toHexString(getWindowHandle())+
", surfaceHandle 0x"+Long.toHexString(getSurfaceHandle())+
- ", bounds "+bounds+", insets "+insets);
+ ", bounds "+bounds+", insets "+insets+
+ ", shallUseOffscreenLayer "+shallUseOffscreenLayer+", isOffscreenLayerSurface "+isOffscreenLayerSurface);
if(null!=component) {
sb.append(", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+
", visible "+component.isVisible());