make sure to paint the first frame when starting an animation.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1705 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2002-09-17 22:06:26 +00:00
parent 6a64d45eed
commit bed0c21515
@@ -1,5 +1,5 @@
// //
// $Id: MultiFrameAnimation.java,v 1.2 2002/09/17 21:58:12 ray Exp $ // $Id: MultiFrameAnimation.java,v 1.3 2002/09/17 22:06:26 ray Exp $
package com.threerings.media.animation; package com.threerings.media.animation;
@@ -61,8 +61,8 @@ public class MultiFrameAnimation extends Animation
{ {
super.reset(); super.reset();
// reset ourselves to frame zero // reset ourselves to a frame number that indicates that we're starting
setFrameIndex(0); setFrameIndex(-1);
// reset our frame sequencer // reset our frame sequencer
_seeker.init(_frames); _seeker.init(_frames);
@@ -90,14 +90,15 @@ public class MultiFrameAnimation extends Animation
protected void setFrameIndex (int fidx) protected void setFrameIndex (int fidx)
{ {
_fidx = fidx; _fidx = fidx;
_bounds.width = _frames.getWidth(_fidx); int frame = Math.max(0, _fidx);
_bounds.height = _frames.getHeight(_fidx); _bounds.width = _frames.getWidth(frame);
_bounds.height = _frames.getHeight(frame);
} }
// documentation inherited // documentation inherited
public void paint (Graphics2D gfx) public void paint (Graphics2D gfx)
{ {
_frames.paintFrame(gfx, _fidx, _bounds.x, _bounds.y); _frames.paintFrame(gfx, Math.max(0, _fidx), _bounds.x, _bounds.y);
} }
// documentation inherited // documentation inherited