diff --git a/app/headless/headless_gl.go b/app/headless/headless_gl.go index 92654c37..450a0f4f 100644 --- a/app/headless/headless_gl.go +++ b/app/headless/headless_gl.go @@ -22,7 +22,7 @@ type glContext interface { type glBackend struct { glContext - srgb *srgb.SRGBFBO + srgb *srgb.FBO } func newContext(width, height int) (backend, error) { @@ -39,7 +39,7 @@ func newContext(width, height int) (backend, error) { return nil, err } defer glctx.ReleaseCurrent() - fbo, err := srgb.NewSRGBFBO(glctx.Functions()) + fbo, err := srgb.New(glctx.Functions()) if err != nil { glctx.Release() return nil, err diff --git a/app/internal/egl/egl.go b/app/internal/egl/egl.go index 4a34390e..1cca7332 100644 --- a/app/internal/egl/egl.go +++ b/app/internal/egl/egl.go @@ -24,7 +24,7 @@ type Context struct { width, height int refreshFBO bool // For sRGB emulation. - srgbFBO *srgb.SRGBFBO + srgbFBO *srgb.FBO } type eglContext struct { @@ -167,7 +167,7 @@ func (c *Context) MakeCurrent() error { } if c.srgbFBO == nil { var err error - c.srgbFBO, err = srgb.NewSRGBFBO(c.c) + c.srgbFBO, err = srgb.New(c.c) if err != nil { return err } diff --git a/app/internal/srgb/srgb.go b/app/internal/srgb/srgb.go index 9071beef..6153a19a 100644 --- a/app/internal/srgb/srgb.go +++ b/app/internal/srgb/srgb.go @@ -12,10 +12,10 @@ import ( "gioui.org/internal/unsafe" ) -// SRGBFBO implements an intermediate sRGB FBO +// FBO implements an intermediate sRGB FBO // for gamma-correct rendering on platforms without // sRGB enabled native framebuffers. -type SRGBFBO struct { +type FBO struct { c *glimpl.Functions width, height int frameBuffer gl.Framebuffer @@ -27,7 +27,7 @@ type SRGBFBO struct { es3 bool } -func NewSRGBFBO(f *glimpl.Functions) (*SRGBFBO, error) { +func New(f *glimpl.Functions) (*FBO, error) { var es3 bool glVer := f.GetString(gl.VERSION) ver, err := gl.ParseGLVersion(glVer) @@ -42,7 +42,7 @@ func NewSRGBFBO(f *glimpl.Functions) (*SRGBFBO, error) { return nil, fmt.Errorf("no support for OpenGL ES 3 nor EXT_sRGB") } } - s := &SRGBFBO{ + s := &FBO{ c: f, es3: es3, frameBuffer: f.CreateFramebuffer(), @@ -57,7 +57,7 @@ func NewSRGBFBO(f *glimpl.Functions) (*SRGBFBO, error) { return s, nil } -func (s *SRGBFBO) Blit() { +func (s *FBO) Blit() { if !s.blitted { prog, err := gl.CreateProgram(s.c, blitVSrc, blitFSrc, []string{"pos", "uv"}) if err != nil { @@ -98,11 +98,11 @@ func (s *SRGBFBO) Blit() { s.c.BindFramebuffer(gl.FRAMEBUFFER, gl.Framebuffer{}) } -func (s *SRGBFBO) AfterPresent() { +func (s *FBO) AfterPresent() { s.c.BindFramebuffer(gl.FRAMEBUFFER, s.frameBuffer) } -func (s *SRGBFBO) Refresh(w, h int) error { +func (s *FBO) Refresh(w, h int) error { s.width, s.height = w, h if w == 0 || h == 0 { return nil @@ -143,7 +143,7 @@ func (s *SRGBFBO) Refresh(w, h int) error { return nil } -func (s *SRGBFBO) Release() { +func (s *FBO) Release() { s.c.DeleteFramebuffer(s.frameBuffer) s.c.DeleteTexture(s.colorTex) s.c.DeleteRenderbuffer(s.depthBuffer) diff --git a/app/internal/window/gl_js.go b/app/internal/window/gl_js.go index 64f691a8..c18d79e1 100644 --- a/app/internal/window/gl_js.go +++ b/app/internal/window/gl_js.go @@ -16,7 +16,7 @@ type context struct { ctx js.Value cnv js.Value f *glimpl.Functions - srgbFBO *srgb.SRGBFBO + srgbFBO *srgb.FBO } func newContext(w *window) (*context, error) { @@ -78,7 +78,7 @@ func (c *context) Unlock() {} func (c *context) MakeCurrent() error { if c.srgbFBO == nil { var err error - c.srgbFBO, err = srgb.NewSRGBFBO(c.f) + c.srgbFBO, err = srgb.New(c.f) if err != nil { c.Release() c.srgbFBO = nil