Track bounds changes for our underlying sprite in such a way that we dirty
things properly if they do. Simply stealing our target sprite's _bounds will not result in the necessary calls to addDirtyRegion() if they change due to calls to setLocation() on our (now unmanaged) target sprite. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@89 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -8,6 +8,7 @@ import java.awt.Color;
|
|||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.Transparency;
|
import java.awt.Transparency;
|
||||||
|
|
||||||
import com.threerings.media.sprite.Sprite;
|
import com.threerings.media.sprite.Sprite;
|
||||||
@@ -35,7 +36,7 @@ public class GleamAnimation extends Animation
|
|||||||
public GleamAnimation (SpriteManager spmgr, Sprite sprite, Color color,
|
public GleamAnimation (SpriteManager spmgr, Sprite sprite, Color color,
|
||||||
int upmillis, int downmillis, boolean fadeIn)
|
int upmillis, int downmillis, boolean fadeIn)
|
||||||
{
|
{
|
||||||
super(sprite.getBounds());
|
super(new Rectangle(sprite.getBounds()));
|
||||||
_spmgr = spmgr;
|
_spmgr = spmgr;
|
||||||
_sprite = sprite;
|
_sprite = sprite;
|
||||||
_color = color;
|
_color = color;
|
||||||
@@ -62,6 +63,14 @@ public class GleamAnimation extends Animation
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the sprite is moved or changed size while we're gleaming it,
|
||||||
|
// track those changes
|
||||||
|
if (!_bounds.equals(_sprite.getBounds())) {
|
||||||
|
Rectangle obounds = new Rectangle(_bounds);
|
||||||
|
_bounds.setBounds(_sprite.getBounds());
|
||||||
|
invalidateAfterChange(obounds);
|
||||||
|
}
|
||||||
|
|
||||||
if (_alpha != alpha) {
|
if (_alpha != alpha) {
|
||||||
_alpha = alpha;
|
_alpha = alpha;
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|||||||
Reference in New Issue
Block a user