mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Bug fix: Call theImages.add after initializing (#242)
This commit is contained in:
parent
910e1b760c
commit
006f918b8e
11
image.go
11
image.go
@ -203,10 +203,7 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
|
||||
height: height,
|
||||
filter: filter,
|
||||
}
|
||||
eimg, err := theImages.add(image)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var err error
|
||||
image.image, err = graphics.NewImage(width, height, glFilter(filter))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -215,6 +212,10 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
|
||||
if err := image.image.Fill(color.Transparent); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
eimg, err := theImages.add(image)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return eimg, nil
|
||||
}
|
||||
|
||||
@ -270,10 +271,10 @@ func newImageWithScreenFramebuffer(width, height int) (*Image, error) {
|
||||
height: height,
|
||||
screen: true,
|
||||
}
|
||||
runtime.SetFinalizer(img, (*imageImpl).Dispose)
|
||||
eimg, err := theImages.add(img)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
runtime.SetFinalizer(img, (*imageImpl).Dispose)
|
||||
return eimg, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user