mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
graphics: Bug fix: Copy variables out of the closures
This commit is contained in:
parent
d2312f1450
commit
fc939fabb8
8
image.go
8
image.go
@ -113,8 +113,8 @@ func (i *Image) Fill(clr color.Color) error {
|
|||||||
i.copyCheck()
|
i.copyCheck()
|
||||||
|
|
||||||
if atomic.LoadInt32(&isImageAvailable) == 0 {
|
if atomic.LoadInt32(&isImageAvailable) == 0 {
|
||||||
enqueueImageOp(func() {
|
|
||||||
r, g, b, a := clr.RGBA()
|
r, g, b, a := clr.RGBA()
|
||||||
|
enqueueImageOp(func() {
|
||||||
i.Fill(color.RGBA64{
|
i.Fill(color.RGBA64{
|
||||||
R: uint16(r),
|
R: uint16(r),
|
||||||
G: uint16(g),
|
G: uint16(g),
|
||||||
@ -189,8 +189,8 @@ func (i *Image) DrawImage(img *Image, options *DrawImageOptions) error {
|
|||||||
i.copyCheck()
|
i.copyCheck()
|
||||||
|
|
||||||
if atomic.LoadInt32(&isImageAvailable) == 0 {
|
if atomic.LoadInt32(&isImageAvailable) == 0 {
|
||||||
enqueueImageOp(func() {
|
|
||||||
op := *options
|
op := *options
|
||||||
|
enqueueImageOp(func() {
|
||||||
i.DrawImage(img, &op)
|
i.DrawImage(img, &op)
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
@ -408,12 +408,12 @@ func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, img *Image, o
|
|||||||
i.copyCheck()
|
i.copyCheck()
|
||||||
|
|
||||||
if atomic.LoadInt32(&isImageAvailable) == 0 {
|
if atomic.LoadInt32(&isImageAvailable) == 0 {
|
||||||
enqueueImageOp(func() {
|
|
||||||
vs := make([]Vertex, len(vertices))
|
vs := make([]Vertex, len(vertices))
|
||||||
copy(vs, vertices)
|
copy(vs, vertices)
|
||||||
is := make([]uint16, len(indices))
|
is := make([]uint16, len(indices))
|
||||||
copy(is, indices)
|
copy(is, indices)
|
||||||
op := *options
|
op := *options
|
||||||
|
enqueueImageOp(func() {
|
||||||
i.DrawTriangles(vs, is, img, &op)
|
i.DrawTriangles(vs, is, img, &op)
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@ -652,9 +652,9 @@ func (i *Image) ReplacePixels(p []byte) error {
|
|||||||
i.copyCheck()
|
i.copyCheck()
|
||||||
|
|
||||||
if atomic.LoadInt32(&isImageAvailable) == 0 {
|
if atomic.LoadInt32(&isImageAvailable) == 0 {
|
||||||
enqueueImageOp(func() {
|
|
||||||
px := make([]byte, len(p))
|
px := make([]byte, len(p))
|
||||||
copy(px, p)
|
copy(px, p)
|
||||||
|
enqueueImageOp(func() {
|
||||||
i.ReplacePixels(px)
|
i.ReplacePixels(px)
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user