mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
shareable: Avoid defer for performance
This commit is contained in:
parent
907302c440
commit
ffbdda9a25
@ -281,7 +281,7 @@ func (i *Image) region() (x, y, width, height int) {
|
||||
// 11: Color Y
|
||||
func (i *Image) DrawTriangles(img *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode driver.CompositeMode, filter driver.Filter, address driver.Address) {
|
||||
backendsM.Lock()
|
||||
defer backendsM.Unlock()
|
||||
// Do not use defer for performance.
|
||||
|
||||
if img.disposed {
|
||||
panic("shareable: the drawing source image must not be disposed (DrawTriangles)")
|
||||
@ -321,6 +321,8 @@ func (i *Image) DrawTriangles(img *Image, vertices []float32, indices []uint16,
|
||||
if !img.isShared() && img.shareable() {
|
||||
imagesToMakeShared[img] = struct{}{}
|
||||
}
|
||||
|
||||
backendsM.Unlock()
|
||||
}
|
||||
|
||||
func (i *Image) Fill(clr color.RGBA) {
|
||||
|
Loading…
Reference in New Issue
Block a user