• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* EGLImage eglCreateImage ( EGLDisplay dpy, EGLContext context, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list ) */
2 static jobject
android_eglCreateImage(JNIEnv * _env,jobject _this,jobject dpy,jobject context,jint target,jlong buffer,jlongArray attrib_list_ref,jint offset)3 android_eglCreateImage
4   (JNIEnv *_env, jobject _this, jobject dpy, jobject context, jint target, jlong buffer, jlongArray attrib_list_ref, jint offset) {
5     jint _exception = 0;
6     const char * _exceptionType = NULL;
7     const char * _exceptionMessage = NULL;
8     EGLImage _returnValue = (EGLImage) 0;
9     EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
10     EGLContext context_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, context);
11     jlong *attrib_list_base = (jlong *) 0;
12     jint _remaining;
13     WrappedEGLAttribs attrib_list;
14 
15     if (!attrib_list_ref) {
16         _exception = 1;
17         _exceptionType = "java/lang/IllegalArgumentException";
18         _exceptionMessage = "attrib_list == null";
19         goto exit;
20     }
21     if (offset < 0) {
22         _exception = 1;
23         _exceptionType = "java/lang/IllegalArgumentException";
24         _exceptionMessage = "offset < 0";
25         goto exit;
26     }
27     _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
28     attrib_list_base = (jlong *)
29         _env->GetLongArrayElements(attrib_list_ref, (jboolean *)0);
30     attrib_list.init(attrib_list_base + offset, _remaining);
31 
32     _returnValue = eglCreateImage(
33         (EGLDisplay)dpy_native,
34         (EGLContext)context_native,
35         (EGLenum)target,
36         (EGLClientBuffer)buffer,
37         attrib_list.attribs
38     );
39 
40 exit:
41     if (attrib_list_base) {
42         _env->ReleaseLongArrayElements(attrib_list_ref, (jlong*)attrib_list_base,
43             JNI_ABORT);
44     }
45     if (_exception) {
46         jniThrowException(_env, _exceptionType, _exceptionMessage);
47         return nullptr;
48     }
49     return toEGLHandle(_env, eglimageClass, eglimageConstructor, _returnValue);
50 }
51