diff --git a/graphics.go b/graphics.go index 79997f27dfd43249a14e4ab483005471250936b5..9468d1667ade1053b7f207103e63a7d4b822b02f 100644 --- a/graphics.go +++ b/graphics.go @@ -20,6 +20,13 @@ func NewSprite(pic Picture) *Sprite { // SetPicture changes the Sprite's Picture. The new Picture may have a different size, everything // works. func (s *Sprite) SetPicture(pic Picture) { + oldPic := s.d.Picture + s.d.Picture = pic + + if oldPic.Bounds() == pic.Bounds() { + return + } + var ( bounds = pic.Bounds() center = bounds.Center() @@ -41,7 +48,6 @@ func (s *Sprite) SetPicture(pic Picture) { } s.d.Dirty() - s.d.Picture = pic } // Picture returns the current Sprite's Picture.