forked from joejulian/gio
app: (linux,android) merge EGLNative* types and functions
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -7,20 +7,6 @@ package app
|
||||
*/
|
||||
import "C"
|
||||
|
||||
type (
|
||||
_EGLNativeDisplayType = C.EGLNativeDisplayType
|
||||
_EGLNativeWindowType = C.EGLNativeWindowType
|
||||
)
|
||||
|
||||
func eglGetDisplay(disp _EGLNativeDisplayType) _EGLDisplay {
|
||||
return C.eglGetDisplay(disp)
|
||||
}
|
||||
|
||||
func eglCreateWindowSurface(disp _EGLDisplay, conf _EGLConfig, win _EGLNativeWindowType, attribs []_EGLint) _EGLSurface {
|
||||
eglSurf := C.eglCreateWindowSurface(disp, conf, win, &attribs[0])
|
||||
return eglSurf
|
||||
}
|
||||
|
||||
func (w *window) eglDestroy() {
|
||||
}
|
||||
|
||||
|
||||
+17
-5
@@ -4,6 +4,7 @@ package app
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lEGL
|
||||
#cgo CFLAGS: -DMESA_EGL_NO_X11_HEADERS
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
@@ -13,11 +14,13 @@ package app
|
||||
import "C"
|
||||
|
||||
type (
|
||||
_EGLint = C.EGLint
|
||||
_EGLDisplay = C.EGLDisplay
|
||||
_EGLConfig = C.EGLConfig
|
||||
_EGLContext = C.EGLContext
|
||||
_EGLSurface = C.EGLSurface
|
||||
_EGLint = C.EGLint
|
||||
_EGLDisplay = C.EGLDisplay
|
||||
_EGLConfig = C.EGLConfig
|
||||
_EGLContext = C.EGLContext
|
||||
_EGLSurface = C.EGLSurface
|
||||
_EGLNativeDisplayType = C.EGLNativeDisplayType
|
||||
_EGLNativeWindowType = C.EGLNativeWindowType
|
||||
)
|
||||
|
||||
func eglChooseConfig(disp _EGLDisplay, attribs []_EGLint) (_EGLConfig, bool) {
|
||||
@@ -81,3 +84,12 @@ func eglTerminate(disp _EGLDisplay) bool {
|
||||
func eglQueryString(disp _EGLDisplay, name _EGLint) string {
|
||||
return C.GoString(C.eglQueryString(disp, name))
|
||||
}
|
||||
|
||||
func eglGetDisplay(disp _EGLNativeDisplayType) _EGLDisplay {
|
||||
return C.eglGetDisplay(disp)
|
||||
}
|
||||
|
||||
func eglCreateWindowSurface(disp _EGLDisplay, conf _EGLConfig, win _EGLNativeWindowType, attribs []_EGLint) _EGLSurface {
|
||||
eglSurf := C.eglCreateWindowSurface(disp, conf, win, &attribs[0])
|
||||
return eglSurf
|
||||
}
|
||||
|
||||
+4
-18
@@ -7,23 +7,18 @@ package app
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lwayland-egl
|
||||
#cgo CFLAGS: -DWL_EGL_PLATFORM
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-egl.h>
|
||||
#include <EGL/egl.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
type (
|
||||
_EGLNativeDisplayType = C.EGLNativeDisplayType
|
||||
_EGLNativeWindowType = C.EGLNativeWindowType
|
||||
)
|
||||
|
||||
var eglWindows struct {
|
||||
mu sync.Mutex
|
||||
windows map[*C.struct_wl_surface]*C.struct_wl_egl_window
|
||||
@@ -43,7 +38,7 @@ func (w *window) eglDestroy() {
|
||||
}
|
||||
|
||||
func (w *window) eglDisplay() _EGLNativeDisplayType {
|
||||
return w.display()
|
||||
return _EGLNativeDisplayType(w.display())
|
||||
}
|
||||
|
||||
func (w *window) eglWindow(visID int) (_EGLNativeWindowType, int, int, error) {
|
||||
@@ -65,14 +60,5 @@ func (w *window) eglWindow(visID int) (_EGLNativeWindowType, int, int, error) {
|
||||
eglWindows.windows[surf] = eglWin
|
||||
}
|
||||
C.wl_egl_window_resize(eglWin, C.int(width), C.int(height), 0, 0)
|
||||
return eglWin, width, height, nil
|
||||
}
|
||||
|
||||
func eglGetDisplay(disp _EGLNativeDisplayType) _EGLDisplay {
|
||||
return C.eglGetDisplay(disp)
|
||||
}
|
||||
|
||||
func eglCreateWindowSurface(disp _EGLDisplay, conf _EGLConfig, win _EGLNativeWindowType, attribs []_EGLint) _EGLSurface {
|
||||
eglSurf := C.eglCreateWindowSurface(disp, conf, win, &attribs[0])
|
||||
return eglSurf
|
||||
return _EGLNativeWindowType(uintptr(unsafe.Pointer(eglWin))), width, height, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user