1 /* EGLDisplay eglGetPlatformDisplay ( EGLenum platform, EGLAttrib native_display, const EGLAttrib *attrib_list ) */
2 static jobject
android_eglGetPlatformDisplay(JNIEnv * _env,jobject _this,jint platform,jlong native_display,jlongArray attrib_list_ref,jint offset)3 android_eglGetPlatformDisplay
4 (JNIEnv *_env, jobject _this, jint platform, jlong native_display, jlongArray attrib_list_ref, jint offset) {
5 jint _exception = 0;
6 const char * _exceptionType = NULL;
7 const char * _exceptionMessage = NULL;
8 EGLDisplay _returnValue = (EGLDisplay) 0;
9 jlong *attrib_list_base = (jlong *) 0;
10 jint _remaining;
11 WrappedEGLAttribs attrib_list;
12
13 if (!attrib_list_ref) {
14 _exception = 1;
15 _exceptionType = "java/lang/IllegalArgumentException";
16 _exceptionMessage = "attrib_list == null";
17 goto exit;
18 }
19 if (offset < 0) {
20 _exception = 1;
21 _exceptionType = "java/lang/IllegalArgumentException";
22 _exceptionMessage = "offset < 0";
23 goto exit;
24 }
25 _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
26 attrib_list_base = (jlong *)
27 _env->GetLongArrayElements(attrib_list_ref, (jboolean *)0);
28 attrib_list.init(attrib_list_base + offset, _remaining);
29
30 _returnValue = eglGetPlatformDisplay(
31 (EGLenum)platform,
32 (void *)native_display,
33 attrib_list.attribs
34 );
35
36 exit:
37 if (attrib_list_base) {
38 _env->ReleaseLongArrayElements(attrib_list_ref, (jlong*)attrib_list_base,
39 JNI_ABORT);
40 }
41 if (_exception) {
42 jniThrowException(_env, _exceptionType, _exceptionMessage);
43 return nullptr;
44 }
45 return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue);
46 }
47
48