X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=jwxyz%2Fjwxyz-android.h;h=1f5ae5220b071ee5fa673b66eca7d797968e4a01;hb=78add6e627ee5f10e1fa6f3852602ea5066eee5a;hp=949531f41cabe5e37d899c1c528d99924d3d8284;hpb=aa75c7476aeaa84cf3abc192b376a8b03c325213;p=xscreensaver diff --git a/jwxyz/jwxyz-android.h b/jwxyz/jwxyz-android.h index 949531f4..1f5ae522 100644 --- a/jwxyz/jwxyz-android.h +++ b/jwxyz/jwxyz-android.h @@ -16,16 +16,39 @@ #include "../hacks/fps.h" #include +/* Native EGL is Android 2.3/API 9. EGL in Java is available from API 1. */ #include +#include #include -/* Keep synchronized with check-configs.pl and jwxyz.java. */ -#define API_XLIB 0 -#define API_GL 1 +/* From utils/visual.c. */ +#define DEFAULT_VISUAL -1 +#define GL_VISUAL -6 + +struct jwxyz_Drawable { + enum { WINDOW, PIXMAP } type; + XRectangle frame; + union { + /* JWXYZ_GL */ + EGLSurface egl_surface; + GLuint texture; /* If this is 0, it's the default framebuffer. */ + + /* JWXYZ_IMAGE */ + void *image_data; + }; + union { + struct { + struct running_hack *rh; + int last_mouse_x, last_mouse_y; + } window; + struct { + int depth; + } pixmap; + }; +}; struct running_hack { struct xscreensaver_function_table *xsft; - jint api; Display *dpy; Window window; fps_state *fpst; @@ -33,72 +56,55 @@ struct running_hack { JNIEnv *jni_env; jobject jobject; + Bool jwxyz_gl_p, egl_p; + + /* JWXYZ_GL */ + EGLContext egl_ctx; + EGLSurface egl_surface; EGLDisplay egl_display; + GLint fb_default; + EGLConfig egl_config; - EGLContext egl_window_ctx, egl_xlib_ctx; + + struct jwxyz_Drawable frontbuffer; + GC copy_gc; + Bool gl_fbo_p, frontbuffer_p; + GLuint fb_pixmap; + Drawable current_drawable; + + /* JWXYZ_IMAGE */ + ANativeWindow *native_window; + Bool ignore_rotation_p; + jwzgles_state *gles_state; + unsigned long frame_count; Bool initted_p; - double next_frame_time; // time_t in milliseconds of when to tick the frame struct event_queue *event_queue; }; -struct jwxyz_Drawable { - enum { WINDOW, PIXMAP } type; - XRectangle frame; - EGLSurface egl_surface; - union { - struct { - struct running_hack *rh; - int last_mouse_x, last_mouse_y; - } window; - struct { - int depth; - } pixmap; - }; -}; - -extern void do_logv(int prio, const char *fmt, va_list args); - -extern void Log(const char *format, ...); // TODO: GCC can verify printf strings. -#define Logv(format, args) (do_logv(ANDROID_LOG_INFO, format, args)) - -extern void prepare_context (struct running_hack *rh); - // Methods of the Java class org.jwz.jwxyz that are implemented in C. JNIEXPORT void JNICALL Java_org_jwz_xscreensaver_jwxyz_nativeInit (JNIEnv *, jobject thiz, - jstring jhack, jint api, + jstring jhack, jobject defaults, - jint w, jint h); + jint w, jint h, + jobject jni_surface); JNIEXPORT void JNICALL Java_org_jwz_xscreensaver_jwxyz_nativeResize (JNIEnv *, jobject thiz, jint w, jint h, jdouble rot); -JNIEXPORT void JNICALL +JNIEXPORT jlong JNICALL Java_org_jwz_xscreensaver_jwxyz_nativeRender (JNIEnv *, jobject thiz); JNIEXPORT void JNICALL Java_org_jwz_xscreensaver_jwxyz_nativeDone (JNIEnv *, jobject thiz); -JNIEXPORT void JNICALL -Java_org_jwz_xscreensaver_jwxyz_allnativeSettings (JNIEnv *, jobject thiz, - jstring jhack, - jstring hackPref, - jint draw, jstring key); - -JNIEXPORT jboolean JNICALL -Java_org_jwz_xscreensaver_jwxyz_ignoreRotation (JNIEnv *, jobject thiz); - -JNIEXPORT jboolean JNICALL -Java_org_jwz_xscreensaver_jwxyz_suppressRotationAnimation (JNIEnv *, - jobject thiz); - JNIEXPORT void JNICALL Java_org_jwz_xscreensaver_jwxyz_sendButtonEvent (JNIEnv *, jobject thiz, int x, int y, jboolean down);