mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
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:
parent
1ff4918390
commit
03621e22c6
@ -53,8 +53,6 @@ type context struct {
|
|||||||
// The following members must be protected by the mutex m.
|
// The following members must be protected by the mutex m.
|
||||||
outsideWidth float64
|
outsideWidth float64
|
||||||
outsideHeight float64
|
outsideHeight float64
|
||||||
|
|
||||||
m sync.Mutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newContext(game Game) *context {
|
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) {
|
func (c *context) layoutGame(outsideWidth, outsideHeight float64, deviceScaleFactor float64) (int, int) {
|
||||||
c.m.Lock()
|
|
||||||
defer c.m.Unlock()
|
|
||||||
|
|
||||||
c.outsideWidth = outsideWidth
|
c.outsideWidth = outsideWidth
|
||||||
c.outsideHeight = outsideHeight
|
c.outsideHeight = outsideHeight
|
||||||
|
|
||||||
@ -230,9 +225,6 @@ func (c *context) adjustPosition(x, y float64, deviceScaleFactor float64) (float
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *context) screenScaleAndOffsets() (float64, float64, float64) {
|
func (c *context) screenScaleAndOffsets() (float64, float64, float64) {
|
||||||
c.m.Lock()
|
|
||||||
defer c.m.Unlock()
|
|
||||||
|
|
||||||
if c.screen == nil {
|
if c.screen == nil {
|
||||||
return 0, 0, 0
|
return 0, 0, 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user