mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 18:02:02 +01:00
graphics: Skip clearing if possible
This commit is contained in:
parent
aa96822ce5
commit
b2ed6ef027
@ -112,6 +112,9 @@ func (i *imageImpl) Fill(clr color.Color) error {
|
||||
if i.disposed {
|
||||
return errors.New("ebiten: image is already disposed")
|
||||
}
|
||||
if clr == color.Transparent && i.pixels.isCleared() {
|
||||
return nil
|
||||
}
|
||||
i.pixels.fill(clr)
|
||||
return i.image.Fill(clr)
|
||||
}
|
||||
@ -125,6 +128,9 @@ func (i *imageImpl) clearIfVolatile() error {
|
||||
if !i.volatile {
|
||||
return nil
|
||||
}
|
||||
if i.pixels.isCleared() {
|
||||
return nil
|
||||
}
|
||||
i.pixels.clear()
|
||||
return i.image.Fill(color.Transparent)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user