From d870cb763cc0c6c995037b7db2285e1d365f09a7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 11 Aug 2011 06:19:25 +0200 Subject: NEWT/Android: Add missing native code --- src/newt/native/AndroidWindow.c | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/newt/native/AndroidWindow.c (limited to 'src/newt/native/AndroidWindow.c') diff --git a/src/newt/native/AndroidWindow.c b/src/newt/native/AndroidWindow.c new file mode 100644 index 000000000..4359c22bb --- /dev/null +++ b/src/newt/native/AndroidWindow.c @@ -0,0 +1,47 @@ + +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "jogamp_newt_driver_android_AndroidWindow.h" + +#include +#include + +#define VERBOSE_ON 1 + +#ifdef VERBOSE_ON + #define DBG_PRINT(...) fprintf(stdout, __VA_ARGS__) +#else + #define DBG_PRINT(...) +#endif + + +JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_android_AndroidWindow_getSurfaceHandle + (JNIEnv *env, jclass clazz, jobject surface) +{ + ANativeWindow * anw = ANativeWindow_fromSurface(env, surface); + return (jlong) (intptr_t) anw; +} + +JNIEXPORT void JNICALL Java_jogamp_newt_driver_android_AndroidWindow_setSurfaceVisualID + (JNIEnv *env, jclass clazz, jlong surfaceHandle, jint nativeVisualID) +{ + ANativeWindow * anw = (ANativeWindow *) (intptr_t) surfaceHandle; + ANativeWindow_setBuffersGeometry(anw, 0, 0, nativeVisualID); +} + +JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_android_AndroidWindow_initIDs + (JNIEnv *env, jclass clazz) +{ + DBG_PRINT( "initIDs ok\n" ); + return JNI_TRUE; +} + -- cgit v1.2.3