mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
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:
@@ -22,7 +22,7 @@ type glContext interface {
|
|||||||
|
|
||||||
type glBackend struct {
|
type glBackend struct {
|
||||||
glContext
|
glContext
|
||||||
srgb *srgb.SRGBFBO
|
srgb *srgb.FBO
|
||||||
}
|
}
|
||||||
|
|
||||||
func newContext(width, height int) (backend, error) {
|
func newContext(width, height int) (backend, error) {
|
||||||
@@ -39,7 +39,7 @@ func newContext(width, height int) (backend, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer glctx.ReleaseCurrent()
|
defer glctx.ReleaseCurrent()
|
||||||
fbo, err := srgb.NewSRGBFBO(glctx.Functions())
|
fbo, err := srgb.New(glctx.Functions())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glctx.Release()
|
glctx.Release()
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ type Context struct {
|
|||||||
width, height int
|
width, height int
|
||||||
refreshFBO bool
|
refreshFBO bool
|
||||||
// For sRGB emulation.
|
// For sRGB emulation.
|
||||||
srgbFBO *srgb.SRGBFBO
|
srgbFBO *srgb.FBO
|
||||||
}
|
}
|
||||||
|
|
||||||
type eglContext struct {
|
type eglContext struct {
|
||||||
@@ -167,7 +167,7 @@ func (c *Context) MakeCurrent() error {
|
|||||||
}
|
}
|
||||||
if c.srgbFBO == nil {
|
if c.srgbFBO == nil {
|
||||||
var err error
|
var err error
|
||||||
c.srgbFBO, err = srgb.NewSRGBFBO(c.c)
|
c.srgbFBO, err = srgb.New(c.c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import (
|
|||||||
"gioui.org/internal/unsafe"
|
"gioui.org/internal/unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SRGBFBO implements an intermediate sRGB FBO
|
// FBO implements an intermediate sRGB FBO
|
||||||
// for gamma-correct rendering on platforms without
|
// for gamma-correct rendering on platforms without
|
||||||
// sRGB enabled native framebuffers.
|
// sRGB enabled native framebuffers.
|
||||||
type SRGBFBO struct {
|
type FBO struct {
|
||||||
c *glimpl.Functions
|
c *glimpl.Functions
|
||||||
width, height int
|
width, height int
|
||||||
frameBuffer gl.Framebuffer
|
frameBuffer gl.Framebuffer
|
||||||
@@ -27,7 +27,7 @@ type SRGBFBO struct {
|
|||||||
es3 bool
|
es3 bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSRGBFBO(f *glimpl.Functions) (*SRGBFBO, error) {
|
func New(f *glimpl.Functions) (*FBO, error) {
|
||||||
var es3 bool
|
var es3 bool
|
||||||
glVer := f.GetString(gl.VERSION)
|
glVer := f.GetString(gl.VERSION)
|
||||||
ver, err := gl.ParseGLVersion(glVer)
|
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")
|
return nil, fmt.Errorf("no support for OpenGL ES 3 nor EXT_sRGB")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s := &SRGBFBO{
|
s := &FBO{
|
||||||
c: f,
|
c: f,
|
||||||
es3: es3,
|
es3: es3,
|
||||||
frameBuffer: f.CreateFramebuffer(),
|
frameBuffer: f.CreateFramebuffer(),
|
||||||
@@ -57,7 +57,7 @@ func NewSRGBFBO(f *glimpl.Functions) (*SRGBFBO, error) {
|
|||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SRGBFBO) Blit() {
|
func (s *FBO) Blit() {
|
||||||
if !s.blitted {
|
if !s.blitted {
|
||||||
prog, err := gl.CreateProgram(s.c, blitVSrc, blitFSrc, []string{"pos", "uv"})
|
prog, err := gl.CreateProgram(s.c, blitVSrc, blitFSrc, []string{"pos", "uv"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -98,11 +98,11 @@ func (s *SRGBFBO) Blit() {
|
|||||||
s.c.BindFramebuffer(gl.FRAMEBUFFER, gl.Framebuffer{})
|
s.c.BindFramebuffer(gl.FRAMEBUFFER, gl.Framebuffer{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SRGBFBO) AfterPresent() {
|
func (s *FBO) AfterPresent() {
|
||||||
s.c.BindFramebuffer(gl.FRAMEBUFFER, s.frameBuffer)
|
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
|
s.width, s.height = w, h
|
||||||
if w == 0 || h == 0 {
|
if w == 0 || h == 0 {
|
||||||
return nil
|
return nil
|
||||||
@@ -143,7 +143,7 @@ func (s *SRGBFBO) Refresh(w, h int) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SRGBFBO) Release() {
|
func (s *FBO) Release() {
|
||||||
s.c.DeleteFramebuffer(s.frameBuffer)
|
s.c.DeleteFramebuffer(s.frameBuffer)
|
||||||
s.c.DeleteTexture(s.colorTex)
|
s.c.DeleteTexture(s.colorTex)
|
||||||
s.c.DeleteRenderbuffer(s.depthBuffer)
|
s.c.DeleteRenderbuffer(s.depthBuffer)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type context struct {
|
|||||||
ctx js.Value
|
ctx js.Value
|
||||||
cnv js.Value
|
cnv js.Value
|
||||||
f *glimpl.Functions
|
f *glimpl.Functions
|
||||||
srgbFBO *srgb.SRGBFBO
|
srgbFBO *srgb.FBO
|
||||||
}
|
}
|
||||||
|
|
||||||
func newContext(w *window) (*context, error) {
|
func newContext(w *window) (*context, error) {
|
||||||
@@ -78,7 +78,7 @@ func (c *context) Unlock() {}
|
|||||||
func (c *context) MakeCurrent() error {
|
func (c *context) MakeCurrent() error {
|
||||||
if c.srgbFBO == nil {
|
if c.srgbFBO == nil {
|
||||||
var err error
|
var err error
|
||||||
c.srgbFBO, err = srgb.NewSRGBFBO(c.f)
|
c.srgbFBO, err = srgb.New(c.f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Release()
|
c.Release()
|
||||||
c.srgbFBO = nil
|
c.srgbFBO = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user