mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
image: Cache size
This commit is contained in:
parent
e366e1c6f3
commit
95316a1de5
7
image.go
7
image.go
@ -30,11 +30,16 @@ type Image struct {
|
|||||||
framebuffer *graphics.Framebuffer
|
framebuffer *graphics.Framebuffer
|
||||||
texture *graphics.Texture
|
texture *graphics.Texture
|
||||||
pixels []uint8
|
pixels []uint8
|
||||||
|
width int
|
||||||
|
height int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size returns the size of the image.
|
// Size returns the size of the image.
|
||||||
func (i *Image) Size() (width, height int) {
|
func (i *Image) Size() (width, height int) {
|
||||||
return i.framebuffer.Size()
|
if i.width == 0 {
|
||||||
|
i.width, i.height = i.framebuffer.Size()
|
||||||
|
}
|
||||||
|
return i.width, i.height
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear resets the pixels of the image into 0.
|
// Clear resets the pixels of the image into 0.
|
||||||
|
Loading…
Reference in New Issue
Block a user