• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* EGLSurface eglCreatePlatformWindowSurface ( EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list ) */
2 static jobject
android_eglCreatePlatformWindowSurface(JNIEnv * _env,jobject _this,jobject dpy,jobject config,jobject native_window_buf,jlongArray attrib_list_ref,jint offset)3 android_eglCreatePlatformWindowSurface
4   (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject native_window_buf, jlongArray attrib_list_ref, jint offset) {
5     jint _exception = 0;
6     const char * _exceptionType = NULL;
7     const char * _exceptionMessage = NULL;
8     jarray _array = (jarray) 0;
9     jint _bufferOffset = (jint) 0;
10     EGLSurface _returnValue = (EGLSurface) 0;
11     EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
12     EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
13     jint _native_windowRemaining;
14     void *native_window = (void *) 0;
15     jlong *attrib_list_base = (jlong *) 0;
16     jint _attrib_listRemaining;
17     WrappedEGLAttribs attrib_list;
18 
19     if (!native_window_buf) {
20         _exception = 1;
21         _exceptionType = "java/lang/IllegalArgumentException";
22         _exceptionMessage = "native_window == null";
23         goto exit;
24     }
25     native_window = (void *)getPointer(_env, native_window_buf, (jarray*)&_array, &_native_windowRemaining, &_bufferOffset);
26     if (!attrib_list_ref) {
27         _exception = 1;
28         _exceptionType = "java/lang/IllegalArgumentException";
29         _exceptionMessage = "attrib_list == null";
30         goto exit;
31     }
32     if (offset < 0) {
33         _exception = 1;
34         _exceptionType = "java/lang/IllegalArgumentException";
35         _exceptionMessage = "offset < 0";
36         goto exit;
37     }
38     _attrib_listRemaining = _env->GetArrayLength(attrib_list_ref) - offset;
39     attrib_list_base = (jlong *)
40         _env->GetLongArrayElements(attrib_list_ref, (jboolean *)0);
41     attrib_list.init(attrib_list_base + offset, _attrib_listRemaining);
42 
43     if (native_window == NULL) {
44         char * _native_windowBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
45         native_window = (void *) (_native_windowBase + _bufferOffset);
46     }
47     _returnValue = eglCreatePlatformWindowSurface(
48         (EGLDisplay)dpy_native,
49         (EGLConfig)config_native,
50         (void *)native_window,
51         attrib_list.attribs
52     );
53 
54 exit:
55     if (attrib_list_base) {
56         _env->ReleaseLongArrayElements(attrib_list_ref, (jlong*)attrib_list_base,
57             JNI_ABORT);
58     }
59     if (_array) {
60         releasePointer(_env, _array, native_window, _exception ? JNI_FALSE : JNI_TRUE);
61     }
62     if (_exception) {
63         jniThrowException(_env, _exceptionType, _exceptionMessage);
64         return nullptr;
65     }
66     return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
67 }
68 
69