summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-02 10:18:22 -0700
committerSven Gothel <[email protected]>2009-10-02 10:18:22 -0700
commit9fd3c095ce2117c3cb67169c97531cac78ab04c4 (patch)
treedd65dac2d4b406b7e47e92afee880d7e56cbebc5 /src/newt
parentcd45d13bbd0ff1da3dac678a6461b5fdce2783c1 (diff)
NativeWindowFactory:
- If property 'nativewindow.ws.name' is set, use it as the custom windowing type returned by getNativeWindowType(true) NEWT: - Using NativeWindowFactory's property 'nativewindow.ws.name' as a package name for custom NEWT windowing imlementations, ie: -Dnativewindow.ws.name=com.sun.javafx.newt.intel.gdl -Dnativewindow.ws.name=com.sun.javafx.newt.broadcom.egl This allows far more flexibility to add custom impl. - Add Intel-GDL, define property 'useIntelGDL' to build the native part. Intel GDL is impl in the package 'com.sun.javafx.newt.intel.gdl' JOGL: - All impl. of 'createGLDrawable(..)', which were actually creating onscreen drawable only, were renamed to 'createOnscreenDrawable(..)'. - GLDrawableFactoryImpl impl. 'createGLDrawable(..)' now and dispatches to the actual create* methods in respect to the Capabilities, ie onscreen, pbuffer and offscreen. - GLDrawableFactory: - If using a native ES profile -> EGLDrawableFactory - If existing native OS factory -> Use that .. - Else -> Use EGLDrawableFactory, if available
Diffstat (limited to 'src/newt')
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Display.java30
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/NewtFactory.java13
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Screen.java30
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Window.java30
-rw-r--r--src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java104
-rw-r--r--src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java68
-rw-r--r--src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java135
-rw-r--r--src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Display.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java)13
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Screen.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java)9
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Window.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java)17
-rwxr-xr-xsrc/newt/native/BroadcomEGL.c16
-rw-r--r--src/newt/native/IntelGDL.c344
12 files changed, 733 insertions, 76 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/Display.java b/src/newt/classes/com/sun/javafx/newt/Display.java
index 38d0021ce..0be8aedbc 100755
--- a/src/newt/classes/com/sun/javafx/newt/Display.java
+++ b/src/newt/classes/com/sun/javafx/newt/Display.java
@@ -43,21 +43,21 @@ public abstract class Display implements Runnable {
private static Class getDisplayClass(String type)
throws ClassNotFoundException
{
- Class displayClass = null;
- if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay");
- } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.windows.WindowsDisplay");
- } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.macosx.MacDisplay");
- } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.x11.X11Display");
- } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.awt.AWTDisplay");
- } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLDisplay");
- } else {
- throw new RuntimeException("Unknown display type \"" + type + "\"");
+ Class displayClass = NewtFactory.getCustomClass(type, "Display");
+ if(null==displayClass) {
+ if (NativeWindowFactory.TYPE_EGL.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay");
+ } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.windows.WindowsDisplay");
+ } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.macosx.MacDisplay");
+ } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.x11.X11Display");
+ } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.awt.AWTDisplay");
+ } else {
+ throw new RuntimeException("Unknown display type \"" + type + "\"");
+ }
}
return displayClass;
}
diff --git a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
index 2f719110d..c4180eb46 100755
--- a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
+++ b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
@@ -39,8 +39,6 @@ import java.util.Iterator;
import com.sun.nativewindow.impl.jvm.JVMUtil;
public abstract class NewtFactory {
- public static final String TYPE_BROADCOM_EGL = "BroadcomEGL";
-
// Work-around for initialization order problems on Mac OS X
// between native Newt and (apparently) Fmod
static {
@@ -48,6 +46,17 @@ public abstract class NewtFactory {
Window.init(NativeWindowFactory.getNativeWindowType(true));
}
+ static Class getCustomClass(String packageName, String classBaseName) {
+ Class clazz = null;
+ if(packageName!=null || classBaseName!=null) {
+ String clazzName = packageName + "." + classBaseName ;
+ try {
+ clazz = Class.forName(clazzName);
+ } catch (Throwable t) {}
+ }
+ return clazz;
+ }
+
/**
* Create a Display entity, incl native creation
*/
diff --git a/src/newt/classes/com/sun/javafx/newt/Screen.java b/src/newt/classes/com/sun/javafx/newt/Screen.java
index 57ed34211..e347a69c2 100755
--- a/src/newt/classes/com/sun/javafx/newt/Screen.java
+++ b/src/newt/classes/com/sun/javafx/newt/Screen.java
@@ -43,21 +43,21 @@ public abstract class Screen {
private static Class getScreenClass(String type)
throws ClassNotFoundException
{
- Class screenClass = null;
- if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDScreen");
- } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.windows.WindowsScreen");
- } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.macosx.MacScreen");
- } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.x11.X11Screen");
- } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.awt.AWTScreen");
- } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLScreen");
- } else {
- throw new RuntimeException("Unknown window type \"" + type + "\"");
+ Class screenClass = NewtFactory.getCustomClass(type, "Screen");
+ if(null==screenClass) {
+ if (NativeWindowFactory.TYPE_EGL.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDScreen");
+ } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.windows.WindowsScreen");
+ } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.macosx.MacScreen");
+ } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.x11.X11Screen");
+ } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.awt.AWTScreen");
+ } else {
+ throw new RuntimeException("Unknown window type \"" + type + "\"");
+ }
}
return screenClass;
}
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java
index 2b82cb887..8b78943d4 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/Window.java
@@ -66,21 +66,21 @@ public abstract class Window implements NativeWindow
private static Class getWindowClass(String type)
throws ClassNotFoundException
{
- Class windowClass = null;
- if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDWindow");
- } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.windows.WindowsWindow");
- } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.macosx.MacWindow");
- } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.x11.X11Window");
- } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.awt.AWTWindow");
- } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLWindow");
- } else {
- throw new NativeWindowException("Unknown window type \"" + type + "\"");
+ Class windowClass = NewtFactory.getCustomClass(type, "Window");
+ if(null==windowClass) {
+ if (NativeWindowFactory.TYPE_EGL.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDWindow");
+ } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.windows.WindowsWindow");
+ } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.macosx.MacWindow");
+ } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.x11.X11Window");
+ } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.awt.AWTWindow");
+ } else {
+ throw new NativeWindowException("Unknown window type \"" + type + "\"");
+ }
}
return windowClass;
}
diff --git a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java
new file mode 100644
index 000000000..b1f0ac6d2
--- /dev/null
+++ b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ */
+
+package com.sun.javafx.newt.intel.gdl;
+
+import com.sun.javafx.newt.impl.*;
+import javax.media.nativewindow.*;
+
+public class Display extends com.sun.javafx.newt.Display {
+ static int initCounter = 0;
+
+ static {
+ NativeLibLoader.loadNEWT();
+
+ if (!Screen.initIDs()) {
+ throw new NativeWindowException("Failed to initialize GDL Screen jmethodIDs");
+ }
+ if (!Window.initIDs()) {
+ throw new NativeWindowException("Failed to initialize GDL Window jmethodIDs");
+ }
+ }
+
+ public static void initSingleton() {
+ // just exist to ensure static init has been run
+ }
+
+
+ public Display() {
+ }
+
+ protected void createNative() {
+ synchronized(Display.class) {
+ if(0==initCounter) {
+ displayHandle = CreateDisplay();
+ if(0==displayHandle) {
+ throw new NativeWindowException("Couldn't initialize GDL Display");
+ }
+ }
+ initCounter++;
+ }
+ aDevice = new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT, displayHandle);
+ }
+
+ protected void closeNative() {
+ if(0==displayHandle) {
+ throw new NativeWindowException("displayHandle null; initCnt "+initCounter);
+ }
+ synchronized(Display.class) {
+ if(initCounter>0) {
+ initCounter--;
+ if(0==initCounter) {
+ DestroyDisplay(displayHandle);
+ }
+ }
+ }
+ }
+
+ protected void dispatchMessages() {
+ if(0!=displayHandle) {
+ DispatchMessages(displayHandle, focusedWindow);
+ }
+ }
+
+ protected void setFocus(Window focus) {
+ focusedWindow = focus;
+ }
+
+ private long displayHandle = 0;
+ private Window focusedWindow = null;
+ private native long CreateDisplay();
+ private native void DestroyDisplay(long displayHandle);
+ private native void DispatchMessages(long displayHandle, Window focusedWindow);
+}
+
diff --git a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java
new file mode 100644
index 000000000..83d9074e2
--- /dev/null
+++ b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ */
+
+package com.sun.javafx.newt.intel.gdl;
+
+import com.sun.javafx.newt.impl.*;
+import javax.media.nativewindow.*;
+
+public class Screen extends com.sun.javafx.newt.Screen {
+
+ static {
+ Display.initSingleton();
+ }
+
+ public Screen() {
+ }
+
+ protected void createNative(int index) {
+ AbstractGraphicsDevice adevice = getDisplay().getGraphicsDevice();
+ GetScreenInfo(adevice.getHandle(), index);
+ aScreen = new DefaultGraphicsScreen(adevice, index);
+ }
+
+ protected void closeNative() { }
+
+ //----------------------------------------------------------------------
+ // Internals only
+ //
+
+ protected static native boolean initIDs();
+ private native void GetScreenInfo(long displayHandle, int screen_idx);
+
+ // called by GetScreenInfo() ..
+ private void screenCreated(int width, int height) {
+ setScreenSize(width, height);
+ }
+}
+
diff --git a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java
new file mode 100644
index 000000000..2c68a2054
--- /dev/null
+++ b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ */
+
+package com.sun.javafx.newt.intel.gdl;
+
+import javax.media.nativewindow.*;
+
+public class Window extends com.sun.javafx.newt.Window {
+ static {
+ Display.initSingleton();
+ }
+
+ public Window() {
+ }
+
+ static long nextWindowHandle = 1;
+
+ protected void createNative(long parentWindowHandle, Capabilities caps) {
+ if(0!=parentWindowHandle) {
+ throw new NativeWindowException("GDL Window does not support window parenting");
+ }
+ AbstractGraphicsScreen aScreen = screen.getGraphicsScreen();
+ AbstractGraphicsDevice aDevice = screen.getDisplay().getGraphicsDevice();
+
+ config = GraphicsConfigurationFactory.getFactory(aDevice).chooseGraphicsConfiguration(caps, null, aScreen);
+ if (config == null) {
+ throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
+ }
+
+ synchronized(Window.class) {
+ windowHandle = nextWindowHandle++;
+ }
+ }
+
+ protected void closeNative() {
+ if(0!=surfaceHandle) {
+ synchronized(Window.class) {
+ CloseSurface(getDisplayHandle(), surfaceHandle);
+ }
+ surfaceHandle = 0;
+ ((Display)screen.getDisplay()).setFocus(null);
+ }
+ }
+
+ public void setVisible(boolean visible) {
+ if(this.visible!=visible) {
+ this.visible=visible;
+ if(visible && 0==surfaceHandle) {
+ synchronized(Window.class) {
+ AbstractGraphicsDevice aDevice = screen.getDisplay().getGraphicsDevice();
+ surfaceHandle = CreateSurface(aDevice.getHandle(), width, height);
+ }
+ if (surfaceHandle == 0) {
+ throw new NativeWindowException("Error creating window");
+ }
+ ((Display)screen.getDisplay()).setFocus(this);
+ }
+ }
+ }
+
+ public void setSize(int width, int height) {
+ if(0!=surfaceHandle) {
+ System.err.println("setSize "+width+"x"+height+" n/a in IntelGDL _after_ surface established");
+ } else {
+ Screen screen = (Screen) getScreen();
+ if(width>screen.getWidth() || height>screen.getHeight()) {
+ width=screen.getWidth();
+ height=screen.getHeight();
+ }
+ this.width = width;
+ this.height = height;
+ }
+ }
+
+ public void setPosition(int x, int y) {
+ // n/a in IntelGDL
+ System.err.println("setPosition n/a in IntelGDL");
+ }
+
+ public boolean setFullscreen(boolean fullscreen) {
+ // n/a in IntelGDL
+ System.err.println("setFullscreen n/a in IntelGDL");
+ return false;
+ }
+
+ public void requestFocus() {
+ ((Display)screen.getDisplay()).setFocus(this);
+ }
+
+ //----------------------------------------------------------------------
+ // Internals only
+ //
+
+ protected static native boolean initIDs();
+ private native long CreateSurface(long displayHandle, int width, int height);
+ private native void CloseSurface(long displayHandle, long surfaceHandle);
+
+
+ private void updateSize(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ private long surfaceHandle;
+}
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Display.java
index dbe126c91..debe9e9b9 100644
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Display.java
@@ -31,21 +31,20 @@
*
*/
-package com.sun.javafx.newt.opengl.broadcom;
+package com.sun.javafx.newt.opengl.broadcom.egl;
-import com.sun.javafx.newt.*;
import com.sun.javafx.newt.impl.*;
import com.sun.opengl.impl.egl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
-public class BCEGLDisplay extends Display {
+public class Display extends com.sun.javafx.newt.Display {
static {
NativeLibLoader.loadNEWT();
- if (!BCEGLWindow.initIDs()) {
- throw new NativeWindowException("Failed to initialize BCEGLWindow jmethodIDs");
+ if (!Window.initIDs()) {
+ throw new NativeWindowException("Failed to initialize BCEGL Window jmethodIDs");
}
}
@@ -54,11 +53,11 @@ public class BCEGLDisplay extends Display {
}
- public BCEGLDisplay() {
+ public Display() {
}
protected void createNative() {
- long handle = CreateDisplay(BCEGLScreen.fixedWidth, BCEGLScreen.fixedHeight);
+ long handle = CreateDisplay(Screen.fixedWidth, Screen.fixedHeight);
if (handle == EGL.EGL_NO_DISPLAY) {
throw new NativeWindowException("BC EGL CreateDisplay failed");
}
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Screen.java
index 165081cde..28f7211c3 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Screen.java
@@ -31,20 +31,19 @@
*
*/
-package com.sun.javafx.newt.opengl.broadcom;
+package com.sun.javafx.newt.opengl.broadcom.egl;
-import com.sun.javafx.newt.*;
import com.sun.javafx.newt.impl.*;
import javax.media.nativewindow.*;
-public class BCEGLScreen extends Screen {
+public class Screen extends com.sun.javafx.newt.Screen {
static {
- BCEGLDisplay.initSingleton();
+ Display.initSingleton();
}
- public BCEGLScreen() {
+ public Screen() {
}
protected void createNative(int index) {
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Window.java
index e3d7c2042..7d087416c 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Window.java
@@ -31,9 +31,8 @@
*
*/
-package com.sun.javafx.newt.opengl.broadcom;
+package com.sun.javafx.newt.opengl.broadcom.egl;
-import com.sun.javafx.newt.*;
import com.sun.javafx.newt.impl.*;
import com.sun.opengl.impl.egl.*;
import javax.media.nativewindow.*;
@@ -41,12 +40,12 @@ import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import javax.media.nativewindow.NativeWindowException;
-public class BCEGLWindow extends Window {
+public class Window extends com.sun.javafx.newt.Window {
static {
- BCEGLDisplay.initSingleton();
+ Display.initSingleton();
}
- public BCEGLWindow() {
+ public Window() {
}
protected void createNative(long parentWindowHandle, Capabilities caps) {
@@ -88,10 +87,10 @@ public class BCEGLWindow extends Window {
void setSizeImpl(int width, int height) {
if(0!=windowHandle) {
// n/a in BroadcomEGL
- System.err.println("BCEGLWindow.setSizeImpl n/a in BroadcomEGL with realized window");
+ System.err.println("BCEGL Window.setSizeImpl n/a in BroadcomEGL with realized window");
} else {
if(DEBUG_IMPLEMENTATION) {
- Exception e = new Exception("BCEGLWindow.setSizeImpl() "+this.width+"x"+this.height+" -> "+width+"x"+height);
+ Exception e = new Exception("BCEGL Window.setSizeImpl() "+this.width+"x"+this.height+" -> "+width+"x"+height);
e.printStackTrace();
}
this.width = width;
@@ -130,7 +129,7 @@ public class BCEGLWindow extends Window {
private long realizeWindow(boolean chromaKey, int width, int height) {
if(DEBUG_IMPLEMENTATION) {
- System.out.println("BCEGLWindow.realizeWindow() with: chroma "+chromaKey+", "+width+"x"+height+", "+config);
+ System.out.println("BCEGL Window.realizeWindow() with: chroma "+chromaKey+", "+width+"x"+height+", "+config);
}
long handle = CreateWindow(getDisplayHandle(), chromaKey, width, height);
if (0 == handle) {
@@ -149,7 +148,7 @@ public class BCEGLWindow extends Window {
throw new NativeWindowException("Error creating EGLGraphicsConfiguration from id: "+cfgID+", "+this);
}
if(DEBUG_IMPLEMENTATION) {
- System.out.println("BCEGLWindow.windowCreated(): 0x"+Integer.toHexString(cfgID)+", "+width+"x"+height+", "+config);
+ System.out.println("BCEGL Window.windowCreated(): 0x"+Integer.toHexString(cfgID)+", "+width+"x"+height+", "+config);
}
}
diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c
index d529de667..55688f9d1 100755
--- a/src/newt/native/BroadcomEGL.c
+++ b/src/newt/native/BroadcomEGL.c
@@ -41,7 +41,7 @@
#include <stdio.h>
#include <string.h>
-#include "com_sun_javafx_newt_opengl_broadcom_BCEGLWindow.h"
+#include "com_sun_javafx_newt_opengl_broadcom_egl_Window.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -72,7 +72,7 @@ static jmethodID windowCreatedID = NULL;
* Display
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_DispatchMessages
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_DispatchMessages
(JNIEnv *env, jobject obj)
{
// FIXME: n/a
@@ -80,7 +80,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_Dis
(void) obj;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_CreateDisplay
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_CreateDisplay
(JNIEnv *env, jobject obj, jint width, jint height)
{
(void) env;
@@ -94,7 +94,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_Cr
return (jlong) (intptr_t) dpy;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_DestroyDisplay
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_DestroyDisplay
(JNIEnv *env, jobject obj, jlong display)
{
EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
@@ -111,7 +111,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLDisplay_Des
* Window
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_initIDs
(JNIEnv *env, jclass clazz)
{
windowCreatedID = (*env)->GetMethodID(env, clazz, "windowCreated", "(III)V");
@@ -123,7 +123,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_
return JNI_TRUE;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_CreateWindow
(JNIEnv *env, jobject obj, jlong display, jboolean chromaKey, jint width, jint height)
{
EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
@@ -167,7 +167,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_Cre
return (jlong) (intptr_t) window;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_CloseWindow
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_CloseWindow
(JNIEnv *env, jobject obj, jlong display, jlong window)
{
EGLDisplay dpy = (EGLDisplay) (intptr_t) display;
@@ -180,7 +180,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_Clos
DBG_PRINT( "[CloseWindow] X\n");
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_BCEGLWindow_SwapWindow
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_SwapWindow
(JNIEnv *env, jobject obj, jlong display, jlong window)
{
EGLDisplay dpy = (EGLDisplay) (intptr_t) display;
diff --git a/src/newt/native/IntelGDL.c b/src/newt/native/IntelGDL.c
new file mode 100644
index 000000000..44eccbc79
--- /dev/null
+++ b/src/newt/native/IntelGDL.c
@@ -0,0 +1,344 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ */
+
+#include <inttypes.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "com_sun_javafx_newt_intel_gdl_Display.h"
+#include "com_sun_javafx_newt_intel_gdl_Screen.h"
+#include "com_sun_javafx_newt_intel_gdl_Window.h"
+
+#include "EventListener.h"
+#include "MouseEvent.h"
+#include "KeyEvent.h"
+
+#include <gdl.h>
+#include <gdl_version.h>
+
+#define VERBOSE_ON 1
+
+#ifdef VERBOSE_ON
+ #define DBG_PRINT(...) fprintf(stdout, "*** INTEL-GDL: " __VA_ARGS__)
+#else
+ #define DBG_PRINT(...)
+#endif
+
+static jmethodID screenCreatedID = NULL;
+static jmethodID updateSizeID = NULL;
+
+#define NUM_PLANES 5
+static jobject newtWindows[NUM_PLANES] = { NULL, NULL, NULL, NULL, NULL } ;
+static gdl_plane_id_t planes[NUM_PLANES] = { GDL_PLANE_ID_UPP_A, GDL_PLANE_ID_UPP_B, GDL_PLANE_ID_UPP_C, GDL_PLANE_ID_UPP_D, GDL_PLANE_ID_UPP_E };
+
+static int getWindowIdx(jobject win) {
+ int i;
+ for(i=0; i<NUM_PLANES && newtWindows[i]!=win; i++) ;
+ return (i<NUM_PLANES)?i:-1;
+}
+static int getPlaneIdx(gdl_plane_id_t plane) {
+ int i;
+ for(i=0; i<NUM_PLANES && planes[i]!=plane; i++) ;
+ return (i<NUM_PLANES)?i:-1;
+}
+
+static jobject getNewtWindow(gdl_plane_id_t plane) {
+ int idx = getPlaneIdx(plane);
+ if(idx>0) {
+ return newtWindows[idx];
+ }
+ return NULL;
+}
+static gdl_plane_id_t getPlane(jobject win) {
+ int idx = getWindowIdx(win);
+ if(idx>0) {
+ return planes[idx];
+ }
+ return GDL_PLANE_ID_UNDEFINED;
+}
+
+static gdl_plane_id_t allocPlane(JNIEnv *env, jobject newtWindow) {
+ int i = getWindowIdx(NULL);
+ if (i<NUM_PLANES) {
+ newtWindows[i] = (*env)->NewGlobalRef(env, newtWindow);
+ return planes[i];
+ }
+ return GDL_PLANE_ID_UNDEFINED;
+}
+static void freePlane(JNIEnv *env, gdl_plane_id_t plane) {
+ int i = getPlaneIdx(plane);
+ if (i<NUM_PLANES) {
+ if(NULL!=newtWindows[i]) {
+ (*env)->DeleteGlobalRef(env, newtWindows[i]);
+ newtWindows[i] = NULL;;
+ }
+ }
+}
+
+static void JNI_ThrowNew(JNIEnv *env, const char *throwable, const char* message) {
+ jclass throwableClass = (*env)->FindClass(env, throwable);
+ if (throwableClass == NULL) {
+ (*env)->FatalError(env, "Failed to load throwable class");
+ }
+
+ if ((*env)->ThrowNew(env, throwableClass, message) != 0) {
+ (*env)->FatalError(env, "Failed to throw throwable");
+ }
+}
+
+
+/**
+ * Display
+ */
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DispatchMessages
+ (JNIEnv *env, jobject obj, jlong displayHandle, jobject focusedWindow)
+{
+ // FIXME: n/a
+ (void) env;
+ (void) obj;
+ (void) displayHandle;
+ /**
+ gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
+ jobject newtWin = getNewtWindow(plane);
+ if(NULL!=newtWin) {
+ // here we can dispatch messages .. etc
+ } */
+}
+
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_CreateDisplay
+ (JNIEnv *env, jobject obj)
+{
+ gdl_ret_t retval;
+ gdl_driver_info_t * p_driver_info = NULL;
+
+ (void) env;
+ (void) obj;
+
+ DBG_PRINT("[CreateDisplay]\n");
+
+ retval = gdl_init(0);
+ if (retval != GDL_SUCCESS) {
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_init");
+ return (jlong)0;
+ }
+
+ p_driver_info = calloc(sizeof(gdl_driver_info_t), 1);
+ retval = gdl_get_driver_info(p_driver_info);
+ if (retval != GDL_SUCCESS) {
+ free(p_driver_info);
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_get_driver_info");
+ return (jlong)0;
+ }
+ DBG_PRINT("[gdl_get_driver_info: major %d minor %d vers %d build %d flags %x name %s size %d avail %d]\n",
+ p_driver_info->header_version_major, p_driver_info->header_version_minor,
+ p_driver_info->gdl_version, p_driver_info->build_tag, p_driver_info->flags,
+ p_driver_info->name, p_driver_info->mem_size, p_driver_info->mem_avail);
+
+
+ return (jlong) (intptr_t) p_driver_info;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DestroyDisplay
+ (JNIEnv *env, jobject obj, jlong displayHandle)
+{
+ gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
+ (void) env;
+ (void) obj;
+
+ if(NULL!=p_driver_info) {
+ gdl_close();
+ free(p_driver_info);
+ }
+
+ DBG_PRINT("[DestroyDisplay] X\n");
+}
+
+/**
+ * Screen
+ */
+
+JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_initIDs
+ (JNIEnv *env, jclass clazz)
+{
+ screenCreatedID = (*env)->GetMethodID(env, clazz, "screenCreated", "(II)V");
+ if (screenCreatedID == NULL) {
+ DBG_PRINT("initIDs failed\n" );
+ return JNI_FALSE;
+ }
+ DBG_PRINT("initIDs ok\n" );
+ return JNI_TRUE;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_GetScreenInfo
+ (JNIEnv *env, jobject obj, jlong displayHandle, jint idx)
+{
+ gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
+ gdl_display_info_t display_info;
+ gdl_display_id_t id;
+ gdl_ret_t retval;
+
+ switch(idx) {
+ case 1:
+ id = GDL_DISPLAY_ID_1;
+ break;
+ default:
+ id = GDL_DISPLAY_ID_0;
+ }
+
+ retval = gdl_get_display_info(id, &display_info);
+ if (retval != GDL_SUCCESS) {
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_get_display_info");
+ return;
+ }
+
+ DBG_PRINT("[gdl_get_display_info: width %d height %d]\n",
+ display_info.tvmode.width, display_info.tvmode.height);
+
+ (*env)->CallVoidMethod(env, obj, screenCreatedID, (jint)display_info.tvmode.width, (jint)display_info.tvmode.height);
+}
+
+/**
+ * Window
+ */
+
+JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_initIDs
+ (JNIEnv *env, jclass clazz)
+{
+ updateSizeID = (*env)->GetMethodID(env, clazz, "updateSize", "(II)V");
+ if (updateSizeID == NULL) {
+ DBG_PRINT("initIDs failed\n" );
+ return JNI_FALSE;
+ }
+ DBG_PRINT("initIDs ok\n" );
+ return JNI_TRUE;
+}
+
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CreateSurface
+ (JNIEnv *env, jobject obj, jlong displayHandle, jint width, jint height) {
+
+ gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
+ gdl_ret_t retval;
+ gdl_pixel_format_t pixelFormat = GDL_PF_ARGB_32;
+ gdl_color_space_t colorSpace = GDL_COLOR_SPACE_RGB;
+ gdl_rectangle_t srcRect, dstRect;
+
+ (void) env;
+ (void) obj;
+
+ gdl_plane_id_t plane = allocPlane(env, obj);
+ if(plane == GDL_PLANE_ID_UNDEFINED) {
+ DBG_PRINT("CreateSurface failed, couldn't alloc plane\n" );
+ return 0;
+ }
+
+ DBG_PRINT("[CreateSurface: width %d height %d plane %d]\n", width, height, plane);
+
+ srcRect.origin.x = 0;
+ srcRect.origin.y = 0;
+ srcRect.width = width;
+ srcRect.height = height;
+
+ dstRect.origin.x = 0;
+ dstRect.origin.y = 0;
+ dstRect.width = width;
+ dstRect.height = height;
+
+ retval = gdl_plane_reset(plane);
+ if (retval != GDL_SUCCESS) {
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_plane_reset");
+ freePlane(env, plane);
+ return (jlong)0;
+ }
+
+ retval = gdl_plane_config_begin(plane);
+ if (retval != GDL_SUCCESS) {
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_plane_config_begin");
+ freePlane(env, plane);
+ return (jlong)0;
+ }
+
+ retval = gdl_plane_set_attr(GDL_PLANE_SRC_COLOR_SPACE, &colorSpace);
+ if (retval != GDL_SUCCESS) {
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_plane_set_attr color space");
+ freePlane(env, plane);
+ return (jlong)0;
+ }
+
+ retval = gdl_plane_set_attr(GDL_PLANE_PIXEL_FORMAT, &pixelFormat);
+ if (retval != GDL_SUCCESS) {
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_plane_set_attr pixel format");
+ freePlane(env, plane);
+ return (jlong)0;
+ }
+
+ retval = gdl_plane_set_attr(GDL_PLANE_DST_RECT, &dstRect);
+ if (retval != GDL_SUCCESS) {
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_plane_set_attr dstRect");
+ freePlane(env, plane);
+ return (jlong)0;
+ }
+
+ retval = gdl_plane_set_attr(GDL_PLANE_SRC_RECT, &srcRect);
+ if (retval != GDL_SUCCESS) {
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_plane_set_attr srcRect");
+ freePlane(env, plane);
+ return (jlong)0;
+ }
+
+ retval = gdl_plane_config_end(GDL_FALSE);
+ if (retval != GDL_SUCCESS) {
+ JNI_ThrowNew(env, "java/lang/IllegalStateException", "gdl_plane_config_end");
+ freePlane(env, plane);
+ return (jlong)0;
+ }
+
+ (*env)->CallVoidMethod(env, obj, updateSizeID, (jint)width, (jint)height);
+
+ DBG_PRINT("[CreateSurface] returning plane %d\n", plane);
+
+ return (jlong) (intptr_t) plane;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CloseSurface
+ (JNIEnv *env, jobject obj, jlong display, jlong surface)
+{
+ gdl_plane_id_t plane = (gdl_plane_id_t) (intptr_t) surface ;
+ freePlane(env, plane);
+
+ DBG_PRINT("[CloseSurface] plane %d\n", plane);
+}
+
+