166a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer // C function EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) 266a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer 366a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer private static native EGLSurface _eglCreateWindowSurface( 466a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer EGLDisplay dpy, 566a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer EGLConfig config, 666a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer Object win, 766a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer int[] attrib_list, 866a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer int offset 966a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer ); 1066a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer 1166a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer private static native EGLSurface _eglCreateWindowSurfaceTexture( 1266a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer EGLDisplay dpy, 1366a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer EGLConfig config, 1466a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer Object win, 1566a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer int[] attrib_list, 1666a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer int offset 1766a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer ); 1866a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer 1966a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer public static EGLSurface eglCreateWindowSurface(EGLDisplay dpy, 2066a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer EGLConfig config, 2166a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer Object win, 2266a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer int[] attrib_list, 2366a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer int offset 2466a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer ){ 2566a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer Surface sur = null; 2666a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer if (win instanceof SurfaceView) { 2766a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer SurfaceView surfaceView = (SurfaceView)win; 2866a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer sur = surfaceView.getHolder().getSurface(); 2966a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer } else if (win instanceof SurfaceHolder) { 3066a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer SurfaceHolder holder = (SurfaceHolder)win; 3166a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer sur = holder.getSurface(); 3262a0a2a8ca389ae936c56f3a93a2e0a88ba7451eThomas Tafertshofer } else if (win instanceof Surface) { 3362a0a2a8ca389ae936c56f3a93a2e0a88ba7451eThomas Tafertshofer sur = (Surface) win; 3466a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer } 3566a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer 3666a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer EGLSurface surface; 3766a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer if (sur != null) { 3866a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer surface = _eglCreateWindowSurface(dpy, config, sur, attrib_list, offset); 3966a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer } else if (win instanceof SurfaceTexture) { 4066a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer surface = _eglCreateWindowSurfaceTexture(dpy, config, 4166a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer win, attrib_list, offset); 4266a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer } else { 4366a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer throw new java.lang.UnsupportedOperationException( 4466a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer "eglCreateWindowSurface() can only be called with an instance of " + 4562a0a2a8ca389ae936c56f3a93a2e0a88ba7451eThomas Tafertshofer "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " + 4666a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer "this will be fixed later."); 4766a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer } 4866a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer 4966a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer return surface; 5066a42db8cbfba902f72f0ace5ac448ef4bfd3951Thomas Tafertshofer } 51