mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +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
|
// 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) {
|
func (i *Image) DrawTriangles(img *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode driver.CompositeMode, filter driver.Filter, address driver.Address) {
|
||||||
backendsM.Lock()
|
backendsM.Lock()
|
||||||
defer backendsM.Unlock()
|
// Do not use defer for performance.
|
||||||
|
|
||||||
if img.disposed {
|
if img.disposed {
|
||||||
panic("shareable: the drawing source image must not be disposed (DrawTriangles)")
|
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() {
|
if !img.isShared() && img.shareable() {
|
||||||
imagesToMakeShared[img] = struct{}{}
|
imagesToMakeShared[img] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backendsM.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Image) Fill(clr color.RGBA) {
|
func (i *Image) Fill(clr color.RGBA) {
|
||||||
|
Loading…
Reference in New Issue
Block a user