graphics: Refactoring

This commit is contained in:
Hajime Hoshi 2016-07-13 12:40:21 +09:00
parent 1627176d59
commit b733f03489

View File

@ -267,7 +267,14 @@ func (i *imageImpl) restore(context *opengl.Context) error {
} }
return nil return nil
} }
if !i.volatile { if i.volatile {
var err error
i.image, err = graphics.NewImage(i.width, i.height, glFilter(i.filter))
if err != nil {
return err
}
return nil
}
img := image.NewRGBA(image.Rect(0, 0, i.width, i.height)) img := image.NewRGBA(image.Rect(0, 0, i.width, i.height))
if i.pixels != nil { if i.pixels != nil {
for j := 0; j < i.height; j++ { for j := 0; j < i.height; j++ {
@ -305,13 +312,6 @@ func (i *imageImpl) restore(context *opengl.Context) error {
i.baseColor = nil i.baseColor = nil
i.drawImageHistory = nil i.drawImageHistory = nil
return nil return nil
}
var err error
i.image, err = graphics.NewImage(i.width, i.height, glFilter(i.filter))
if err != nil {
return err
}
return nil
} }
func (i *imageImpl) Dispose() error { func (i *imageImpl) Dispose() error {