mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 19:58:54 +01:00
buffered: Refactoring
This commit is contained in:
parent
52a5ed0ad4
commit
68d58d7452
@ -222,15 +222,17 @@ func (i *Image) DrawImage(src *Image, bounds image.Rectangle, a, b, c, d, tx, ty
|
|||||||
delayedCommandsM.Lock()
|
delayedCommandsM.Lock()
|
||||||
if needsToDelayCommands {
|
if needsToDelayCommands {
|
||||||
delayedCommands = append(delayedCommands, func() {
|
delayedCommands = append(delayedCommands, func() {
|
||||||
src.resolvePendingPixels(true)
|
i.drawImage(src, bounds, g, colorm, mode, filter)
|
||||||
i.resolvePendingPixels(false)
|
|
||||||
i.img.DrawImage(src.img, bounds, g, colorm, mode, filter)
|
|
||||||
})
|
})
|
||||||
delayedCommandsM.Unlock()
|
delayedCommandsM.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
delayedCommandsM.Unlock()
|
delayedCommandsM.Unlock()
|
||||||
|
|
||||||
|
i.drawImage(src, bounds, g, colorm, mode, filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Image) drawImage(src *Image, bounds image.Rectangle, g *mipmap.GeoM, colorm *affine.ColorM, mode driver.CompositeMode, filter driver.Filter) {
|
||||||
src.resolvePendingPixels(true)
|
src.resolvePendingPixels(true)
|
||||||
i.resolvePendingPixels(false)
|
i.resolvePendingPixels(false)
|
||||||
i.img.DrawImage(src.img, bounds, g, colorm, mode, filter)
|
i.img.DrawImage(src.img, bounds, g, colorm, mode, filter)
|
||||||
@ -244,15 +246,16 @@ func (i *Image) DrawTriangles(src *Image, vertices []float32, indices []uint16,
|
|||||||
delayedCommandsM.Lock()
|
delayedCommandsM.Lock()
|
||||||
if needsToDelayCommands {
|
if needsToDelayCommands {
|
||||||
delayedCommands = append(delayedCommands, func() {
|
delayedCommands = append(delayedCommands, func() {
|
||||||
src.resolvePendingPixels(true)
|
i.drawTriangles(src, vertices, indices, colorm, mode, filter, address)
|
||||||
i.resolvePendingPixels(false)
|
|
||||||
i.img.DrawTriangles(src.img, vertices, indices, colorm, mode, filter, address)
|
|
||||||
})
|
})
|
||||||
delayedCommandsM.Unlock()
|
delayedCommandsM.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
delayedCommandsM.Unlock()
|
delayedCommandsM.Unlock()
|
||||||
|
i.drawTriangles(src, vertices, indices, colorm, mode, filter, address)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *Image) drawTriangles(src *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode driver.CompositeMode, filter driver.Filter, address driver.Address) {
|
||||||
src.resolvePendingPixels(true)
|
src.resolvePendingPixels(true)
|
||||||
i.resolvePendingPixels(false)
|
i.resolvePendingPixels(false)
|
||||||
i.img.DrawTriangles(src.img, vertices, indices, colorm, mode, filter, address)
|
i.img.DrawTriangles(src.img, vertices, indices, colorm, mode, filter, address)
|
||||||
|
Loading…
Reference in New Issue
Block a user