mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08: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 {
|
func (i *imageImpl) Fill(clr color.Color) error {
|
||||||
// TODO: Need to clone clr value
|
|
||||||
i.m.Lock()
|
i.m.Lock()
|
||||||
defer i.m.Unlock()
|
defer i.m.Unlock()
|
||||||
if i.disposed {
|
if i.disposed {
|
||||||
@ -163,7 +162,11 @@ func (i *imageImpl) DrawImage(image *Image, options *DrawImageOptions) error {
|
|||||||
geom := options.GeoM
|
geom := options.GeoM
|
||||||
colorm := options.ColorM
|
colorm := options.ColorM
|
||||||
mode := opengl.CompositeMode(options.CompositeMode)
|
mode := opengl.CompositeMode(options.CompositeMode)
|
||||||
|
if image.impl.pixels.IsStale() {
|
||||||
|
i.pixels.MakeStale()
|
||||||
|
} else {
|
||||||
i.pixels.AppendDrawImageHistory(image.impl.image, vertices, &geom, &colorm, mode)
|
i.pixels.AppendDrawImageHistory(image.impl.image, vertices, &geom, &colorm, mode)
|
||||||
|
}
|
||||||
if err := i.image.DrawImage(image.impl.image, vertices, &geom, &colorm, mode); err != nil {
|
if err := i.image.DrawImage(image.impl.image, vertices, &geom, &colorm, mode); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,10 @@ type Pixels struct {
|
|||||||
stale bool
|
stale bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Pixels) IsStale() bool {
|
||||||
|
return p.stale
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Pixels) MakeStale() {
|
func (p *Pixels) MakeStale() {
|
||||||
p.basePixels = nil
|
p.basePixels = nil
|
||||||
p.baseColor = nil
|
p.baseColor = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user