app/internal/srgb: rename NewSRGBFBO to New and SRGBFBO to FBO

The srgb package was recently created to contain just the sRGB
emulation, but the names weren't shortened accordingly.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-15 19:45:59 +01:00
parent b34216c124
commit 05485a79a6
4 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
}
+8 -8
View File
@@ -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)
+2 -2
View File
@@ -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