mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
restorable: Add NewImage
This commit is contained in:
parent
9c079917f1
commit
438afdac5b
@ -34,7 +34,7 @@ type imageImpl struct {
|
||||
width int
|
||||
height int
|
||||
filter Filter
|
||||
restorable restorable.Image
|
||||
restorable *restorable.Image
|
||||
volatile bool
|
||||
screen bool
|
||||
m sync.Mutex
|
||||
@ -50,6 +50,7 @@ func newImageImpl(width, height int, filter Filter, volatile bool) (*imageImpl,
|
||||
width: width,
|
||||
height: height,
|
||||
filter: filter,
|
||||
restorable: restorable.NewImage(),
|
||||
volatile: volatile,
|
||||
}
|
||||
runtime.SetFinalizer(i, (*imageImpl).Dispose)
|
||||
@ -83,6 +84,7 @@ func newImageImplFromImage(source image.Image, filter Filter) (*imageImpl, error
|
||||
width: w,
|
||||
height: h,
|
||||
filter: filter,
|
||||
restorable: restorable.NewImage(),
|
||||
}
|
||||
i.restorable.ReplacePixels(p)
|
||||
runtime.SetFinalizer(i, (*imageImpl).Dispose)
|
||||
@ -98,6 +100,7 @@ func newScreenImageImpl(width, height int) (*imageImpl, error) {
|
||||
image: img,
|
||||
width: width,
|
||||
height: height,
|
||||
restorable: restorable.NewImage(),
|
||||
volatile: true,
|
||||
screen: true,
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ type Image struct {
|
||||
stale bool
|
||||
}
|
||||
|
||||
func NewImage() *Image {
|
||||
return &Image{}
|
||||
}
|
||||
|
||||
func (p *Image) IsStale() bool {
|
||||
return p.stale
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user