Fixed bug where last render time was being used where last scroll time was
needed. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1279 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: AnimatedPanel.java,v 1.20 2002/04/15 17:46:41 mdb Exp $
|
// $Id: AnimatedPanel.java,v 1.21 2002/04/18 22:38:24 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.animation;
|
package com.threerings.media.animation;
|
||||||
|
|
||||||
@@ -233,12 +233,12 @@ public class AnimatedPanel extends JComponent
|
|||||||
|
|
||||||
// track how long it was since we were last painted
|
// track how long it was since we were last painted
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
// if (_last != 0) {
|
// if (_paint != 0) {
|
||||||
// int delta = (int)(now-_last);
|
// int delta = (int)(now-_paint);
|
||||||
// _histo.addValue(delta);
|
// _histo.addValue(delta);
|
||||||
|
|
||||||
// // dump the histogram every ten seconds
|
// // dump the histogram every ten seconds
|
||||||
// if (_last % (10*1000) < 50) {
|
// if (_paint % (10*1000) < 50) {
|
||||||
// Log.info("Render histogram.");
|
// Log.info("Render histogram.");
|
||||||
// Log.info(StringUtil.toMatrixString(_histo.getBuckets(), 10, 3));
|
// Log.info(StringUtil.toMatrixString(_histo.getBuckets(), 10, 3));
|
||||||
// }
|
// }
|
||||||
@@ -256,7 +256,7 @@ public class AnimatedPanel extends JComponent
|
|||||||
dx = _scrollx;
|
dx = _scrollx;
|
||||||
dy = _scrolly;
|
dy = _scrolly;
|
||||||
|
|
||||||
Log.info("Scrolling rest [dx=" + dx + ", dy=" + dy + "].");
|
// Log.info("Scrolling rest [dx=" + dx + ", dy=" + dy + "].");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// otherwise figure out how many milliseconds have gone by
|
// otherwise figure out how many milliseconds have gone by
|
||||||
@@ -306,20 +306,22 @@ public class AnimatedPanel extends JComponent
|
|||||||
// let our derived classes do whatever they need to do to
|
// let our derived classes do whatever they need to do to
|
||||||
// prepare to be scrolled
|
// prepare to be scrolled
|
||||||
viewWillScroll(dx, dy, now, invalidRects);
|
viewWillScroll(dx, dy, now, invalidRects);
|
||||||
}
|
|
||||||
|
|
||||||
// subtract our scrolled deltas from the time remaining
|
// keep track of the last time we scrolled
|
||||||
_scrollx -= dx;
|
_last = now;
|
||||||
_scrolly -= dy;
|
|
||||||
if (_scrollx == 0 && _scrolly == 0) {
|
// subtract our scrolled deltas from the distance remaining
|
||||||
_ttime = 0;
|
_scrollx -= dx;
|
||||||
viewFinishedScrolling();
|
_scrolly -= dy;
|
||||||
|
|
||||||
|
// if we've reached our desired position, finish the job
|
||||||
|
if (_scrollx == 0 && _scrolly == 0) {
|
||||||
|
_ttime = 0;
|
||||||
|
viewFinishedScrolling();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep track of the last time we rendered
|
|
||||||
_last = now;
|
|
||||||
|
|
||||||
// if we didn't scroll and have no invalid rects, there's no need
|
// if we didn't scroll and have no invalid rects, there's no need
|
||||||
// to repaint anything
|
// to repaint anything
|
||||||
if (invalidRects.size() == 0 && dx == 0 && dy == 0) {
|
if (invalidRects.size() == 0 && dx == 0 && dy == 0) {
|
||||||
@@ -437,7 +439,7 @@ public class AnimatedPanel extends JComponent
|
|||||||
*/
|
*/
|
||||||
protected void viewFinishedScrolling ()
|
protected void viewFinishedScrolling ()
|
||||||
{
|
{
|
||||||
Log.info("viewFinishedScrolling");
|
// Log.info("viewFinishedScrolling");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user