internal/ui: remove unnecessary mutex

Now (*context).updateFrame and (*context).adjustPosition are not called
in parallel even though the goroutines might be different.
This commit is contained in:
Hajime Hoshi 2022-10-14 01:47:49 +09:00
parent 1ff4918390
commit 03621e22c6

View File

@ -53,8 +53,6 @@ type context struct {
// The following members must be protected by the mutex m.
outsideWidth float64
outsideHeight float64
m sync.Mutex
}
func newContext(game Game) *context {
@ -175,9 +173,6 @@ func (c *context) drawGame(graphicsDriver graphicsdriver.Graphics) {
}
func (c *context) layoutGame(outsideWidth, outsideHeight float64, deviceScaleFactor float64) (int, int) {
c.m.Lock()
defer c.m.Unlock()
c.outsideWidth = outsideWidth
c.outsideHeight = outsideHeight
@ -230,9 +225,6 @@ func (c *context) adjustPosition(x, y float64, deviceScaleFactor float64) (float
}
func (c *context) screenScaleAndOffsets() (float64, float64, float64) {
c.m.Lock()
defer c.m.Unlock()
if c.screen == nil {
return 0, 0, 0
}