mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Bug fix: Make an image stale when another stale image is drawn to this (#257)
This commit is contained in:
parent
58f59f3832
commit
749a751369
@ -106,7 +106,6 @@ func newScreenImageImpl(width, height int) (*imageImpl, error) {
|
||||
}
|
||||
|
||||
func (i *imageImpl) Fill(clr color.Color) error {
|
||||
// TODO: Need to clone clr value
|
||||
i.m.Lock()
|
||||
defer i.m.Unlock()
|
||||
if i.disposed {
|
||||
@ -163,7 +162,11 @@ func (i *imageImpl) DrawImage(image *Image, options *DrawImageOptions) error {
|
||||
geom := options.GeoM
|
||||
colorm := options.ColorM
|
||||
mode := opengl.CompositeMode(options.CompositeMode)
|
||||
i.pixels.AppendDrawImageHistory(image.impl.image, vertices, &geom, &colorm, mode)
|
||||
if image.impl.pixels.IsStale() {
|
||||
i.pixels.MakeStale()
|
||||
} else {
|
||||
i.pixels.AppendDrawImageHistory(image.impl.image, vertices, &geom, &colorm, mode)
|
||||
}
|
||||
if err := i.image.DrawImage(image.impl.image, vertices, &geom, &colorm, mode); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ type Pixels struct {
|
||||
stale bool
|
||||
}
|
||||
|
||||
func (p *Pixels) IsStale() bool {
|
||||
return p.stale
|
||||
}
|
||||
|
||||
func (p *Pixels) MakeStale() {
|
||||
p.basePixels = nil
|
||||
p.baseColor = nil
|
||||
|
Loading…
Reference in New Issue
Block a user