app,app/headless: expose Backends from window and headless contexts

This is a refactoring change to prepare for another gpu.Backend
implementations.

Notably, app/loop.go no longer imports gpu/gl.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-15 18:29:14 +01:00
parent f62725ea77
commit 94fdc26cb5
9 changed files with 42 additions and 19 deletions
+6
View File
@@ -12,6 +12,8 @@ import (
"gioui.org/app/internal/glimpl"
"gioui.org/app/internal/srgb"
"gioui.org/gpu"
"gioui.org/gpu/gl"
)
type Context struct {
@@ -119,6 +121,10 @@ func (c *Context) Functions() *glimpl.Functions {
return c.c
}
func (c *Context) Backend() (gpu.Backend, error) {
return gl.NewBackend(c.c)
}
func (c *Context) ReleaseSurface() {
if c.eglSurf == nilEGLSurface {
return