mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
buffered, shareable: Bug fix: Check source images correctly
This commit is contained in:
parent
f8956941b7
commit
ab95c9014d
@ -269,21 +269,16 @@ func (i *Image) drawImage(src *Image, bounds image.Rectangle, g mipmap.GeoM, col
|
|||||||
//
|
//
|
||||||
// Copying vertices and indices is the caller's responsibility.
|
// Copying vertices and indices is the caller's responsibility.
|
||||||
func (i *Image) DrawTriangles(src *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode driver.CompositeMode, filter driver.Filter, address driver.Address, sourceRegion driver.Region, shader *Shader, uniforms []interface{}, textures []*Image) {
|
func (i *Image) DrawTriangles(src *Image, vertices []float32, indices []uint16, colorm *affine.ColorM, mode driver.CompositeMode, filter driver.Filter, address driver.Address, sourceRegion driver.Region, shader *Shader, uniforms []interface{}, textures []*Image) {
|
||||||
var srcs []*Image
|
|
||||||
if src != nil {
|
if src != nil {
|
||||||
srcs = append(srcs, src)
|
|
||||||
}
|
|
||||||
for _, u := range uniforms {
|
|
||||||
if src, ok := u.(*Image); ok {
|
|
||||||
srcs = append(srcs, src)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, src := range srcs {
|
|
||||||
if i == src {
|
if i == src {
|
||||||
panic("buffered: Image.DrawTriangles: src must be different from the receiver")
|
panic("buffered: Image.DrawTriangles: src must be different from the receiver")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, src := range textures {
|
||||||
|
if i == src {
|
||||||
|
panic("buffered: Image.DrawTriangles: source images must be different from the receiver")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if maybeCanAddDelayedCommand() {
|
if maybeCanAddDelayedCommand() {
|
||||||
if tryAddDelayedCommand(func() error {
|
if tryAddDelayedCommand(func() error {
|
||||||
@ -295,7 +290,10 @@ func (i *Image) DrawTriangles(src *Image, vertices []float32, indices []uint16,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, src := range srcs {
|
if src != nil {
|
||||||
|
src.resolvePendingPixels(true)
|
||||||
|
}
|
||||||
|
for _, src := range textures {
|
||||||
src.resolvePendingPixels(true)
|
src.resolvePendingPixels(true)
|
||||||
}
|
}
|
||||||
i.resolvePendingPixels(false)
|
i.resolvePendingPixels(false)
|
||||||
|
@ -373,10 +373,8 @@ func (i *Image) DrawTriangles(img *Image, vertices []float32, indices []uint16,
|
|||||||
if img != nil {
|
if img != nil {
|
||||||
makeSharedIfNeeded(img)
|
makeSharedIfNeeded(img)
|
||||||
}
|
}
|
||||||
for _, u := range uniforms {
|
for _, src := range textures {
|
||||||
if src, ok := u.(*Image); ok {
|
makeSharedIfNeeded(src)
|
||||||
makeSharedIfNeeded(src)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
backendsM.Unlock()
|
backendsM.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user