mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
graphics: Use 1x1 image for empty images
This change leaves some empty images for DrawTriangles.
This commit is contained in:
parent
b210339786
commit
fc42af208d
@ -26,7 +26,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
emptyImage, _ = ebiten.NewImage(16, 16, ebiten.FilterDefault)
|
emptyImage, _ = ebiten.NewImage(1, 1, ebiten.FilterDefault)
|
||||||
_ = emptyImage.Fill(color.White)
|
_ = emptyImage.Fill(color.White)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
image.go
9
image.go
@ -81,13 +81,8 @@ func (i *Image) Clear() error {
|
|||||||
var emptyImage *Image
|
var emptyImage *Image
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
const w, h = 16, 16
|
emptyImage, _ = NewImage(1, 1, FilterDefault)
|
||||||
emptyImage, _ = NewImage(w, h, FilterDefault)
|
emptyImage.ReplacePixels([]byte{0xff, 0xff, 0xff, 0xff})
|
||||||
pix := make([]byte, 4*w*h)
|
|
||||||
for i := range pix {
|
|
||||||
pix[i] = 0xff
|
|
||||||
}
|
|
||||||
emptyImage.ReplacePixels(pix)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill fills the image with a solid color.
|
// Fill fills the image with a solid color.
|
||||||
|
@ -33,6 +33,7 @@ func init() {
|
|||||||
for i := range pix {
|
for i := range pix {
|
||||||
pix[i] = 0xff
|
pix[i] = 0xff
|
||||||
}
|
}
|
||||||
|
// (*Image).Fill uses emptyImage, then Fill cannot be called here.
|
||||||
emptyImage.ReplacePixels(pix)
|
emptyImage.ReplacePixels(pix)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user