Properly dirty ourselves if we are relocated.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3208 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-11-11 23:51:40 +00:00
parent c8a66a4414
commit 512663e482
@@ -1,5 +1,5 @@
//
// $Id: Animation.java,v 1.14 2004/09/10 22:16:54 eric Exp $
// $Id: Animation.java,v 1.15 2004/11/11 23:51:40 mdb Exp $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -62,6 +62,30 @@ public abstract class Animation extends AbstractMedia
_finished = false;
}
// documentation inherited
public void setLocation (int x, int y)
{
// start with our current bounds
Rectangle dirty = new Rectangle(_bounds);
// move ourselves
super.setLocation(x, y);
// grow the dirty rectangle to incorporate our new bounds and pass
// the dirty region to our region manager
if (_mgr != null) {
// if our new bounds intersect our old bounds, grow a single
// dirty rectangle to incorporate them both
if (_bounds.intersects(dirty)) {
dirty.add(_bounds);
} else {
// otherwise invalidate our new bounds separately
_mgr.getRegionManager().invalidateRegion(_bounds);
}
_mgr.getRegionManager().addDirtyRegion(dirty);
}
}
// documentation inherited
protected void willStart (long tickStamp)
{