driver: Refactoring: Remove (UIContext).Draw

This commit is contained in:
Hajime Hoshi 2020-10-15 01:23:27 +09:00
parent 20b4a28801
commit 770661c609
5 changed files with 2 additions and 28 deletions

View File

@ -21,7 +21,6 @@ import (
type UIContext interface {
Update() error
Draw() error
Layout(outsideWidth, outsideHeight float64)
AdjustPosition(x, y float64) (float64, float64)
}

View File

@ -868,9 +868,6 @@ func (u *UserInterface) update() error {
if err := u.context.Update(); err != nil {
return err
}
if err := u.context.Draw(); err != nil {
return err
}
// Update the screen size when the window is resizable.
var w, h int

View File

@ -170,9 +170,6 @@ func (u *UserInterface) update() error {
if err := u.context.Update(); err != nil {
return err
}
if err := u.context.Draw(); err != nil {
return err
}
return nil
}

View File

@ -367,9 +367,6 @@ func (u *UserInterface) update() error {
if err := u.context.Update(); err != nil {
return err
}
if err := u.context.Draw(); err != nil {
return err
}
return nil
}

View File

@ -164,20 +164,6 @@ func (c *uiContext) Update() error {
return nil
}
func (c *uiContext) Draw() error {
if err, ok := c.err.Load().(error); ok && err != nil {
return err
}
if err := buffered.BeginFrame(); err != nil {
return err
}
c.draw()
if err := buffered.EndFrame(); err != nil {
return err
}
return nil
}
func (c *uiContext) update() error {
// TODO: Move the clock usage to the UI driver side.
updateCount := clock.Update(MaxTPS())
@ -199,13 +185,10 @@ func (c *uiContext) update() error {
}
uiDriver().ResetForFrame()
}
return nil
}
func (c *uiContext) draw() {
// c.screen might be nil when updateCount is 0 in the initial state (#1039).
if c.screen == nil {
return
return nil
}
if IsScreenClearedEveryFrame() {
@ -241,6 +224,7 @@ func (c *uiContext) draw() {
op.Filter = FilterLinear
}
c.screen.DrawImage(c.offscreen, op)
return nil
}
func (c *uiContext) AdjustPosition(x, y float64) (float64, float64) {