From db693cac03de91a20f1964cd8aa3965252027b50 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 30 Sep 2011 15:58:43 +0200 Subject: NEWT/Android: More ANativeWindow coop; Note: surface's format _is_ the nativeVisualID of EGL. More ANativeWindow (ANW) coop: - add acquire/release for ANW - validate ANW format - Add fixCaps: 'format -> GLCaps' validation Test: - Constructor: Start w/ surface format RGB_565 (default) - createNative: Filter EGLConfig w/ surface format - Move surfaceHandle fetching from surfaceCreated -> surfaceChanged, where the format is available. - surfaceChanged: use fixedCaps validation --- src/newt/native/AndroidWindow.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/newt/native/AndroidWindow.c') diff --git a/src/newt/native/AndroidWindow.c b/src/newt/native/AndroidWindow.c index 5eca96fc2..d75bc27d7 100644 --- a/src/newt/native/AndroidWindow.c +++ b/src/newt/native/AndroidWindow.c @@ -30,6 +30,13 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_android_AndroidWindow_getSurface return (jlong) (intptr_t) anw; } +JNIEXPORT jint JNICALL Java_jogamp_newt_driver_android_AndroidWindow_getSurfaceVisualID + (JNIEnv *env, jclass clazz, jlong surfaceHandle) +{ + ANativeWindow * anw = (ANativeWindow *) (intptr_t) surfaceHandle; + return (jint) ANativeWindow_getFormat(anw); +} + JNIEXPORT void JNICALL Java_jogamp_newt_driver_android_AndroidWindow_setSurfaceVisualID (JNIEnv *env, jclass clazz, jlong surfaceHandle, jint nativeVisualID) { @@ -37,6 +44,20 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_android_AndroidWindow_setSurfaceV ANativeWindow_setBuffersGeometry(anw, 0, 0, nativeVisualID); } +JNIEXPORT void JNICALL Java_jogamp_newt_driver_android_AndroidWindow_acquire + (JNIEnv *env, jclass clazz, jlong surfaceHandle) +{ + ANativeWindow * anw = (ANativeWindow *) (intptr_t) surfaceHandle; + ANativeWindow_acquire(anw); +} + +JNIEXPORT void JNICALL Java_jogamp_newt_driver_android_AndroidWindow_release + (JNIEnv *env, jclass clazz, jlong surfaceHandle) +{ + ANativeWindow * anw = (ANativeWindow *) (intptr_t) surfaceHandle; + ANativeWindow_release(anw); +} + JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_android_AndroidWindow_initIDs (JNIEnv *env, jclass clazz) { -- cgit v1.2.3