Author: toshok
Date: 2007-09-26 15:55:20 -0400 (Wed, 26 Sep 2007)
New Revision: 86436
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/clock.cpp
Log:
2007-09-26 Chris Toshok <[EMAIL PROTECTED]>
* clock.cpp (TimeManager::Tick): a few changes. first and
foremost, fix the signs on the FPS_ADJUSTMENTS. oops. also, add
a buffer of 50ms on either side of the timeout before we consider
the Tick either slow or fast. Increase the number of out-of-line
ticks we need and decrease the fps adjustment.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-09-26 19:21:55 UTC (rev 86435)
+++ trunk/moon/src/ChangeLog 2007-09-26 19:55:20 UTC (rev 86436)
@@ -1,3 +1,11 @@
+2007-09-26 Chris Toshok <[EMAIL PROTECTED]>
+
+ * clock.cpp (TimeManager::Tick): a few changes. first and
+ foremost, fix the signs on the FPS_ADJUSTMENTS. oops. also, add
+ a buffer of 50ms on either side of the timeout before we consider
+ the Tick either slow or fast. Increase the number of out-of-line
+ ticks we need and decrease the fps adjustment.
+
2007-09-26 Jeffrey Stedfast <[EMAIL PROTECTED]>
* text.cpp (OnCollectionChanged): Needs to call Invalidate().
Modified: trunk/moon/src/clock.cpp
===================================================================
--- trunk/moon/src/clock.cpp 2007-09-26 19:21:55 UTC (rev 86435)
+++ trunk/moon/src/clock.cpp 2007-09-26 19:55:20 UTC (rev 86436)
@@ -220,13 +220,16 @@
ENDTICKTIMER (tick, "TimeManager::Tick");
TimeSpan post_tick = get_now();
- if (post_tick - pre_tick > (TimeSpan)(current_timeout * 10000))
+ /* we only count strikes for higher/lower fps if the frame
+ took more than 50ms over our timeour, or less than 50ms
+ under our timeout. */
+ if (post_tick - pre_tick > (TimeSpan)(current_timeout * 10000) + 50000)
strikes ++;
- else
+ else if (post_tick - pre_tick < (TimeSpan)(current_timeout * 10000) -
50000)
strikes --;
-#define STRIKE_COUNT 5
-#define FPS_ADJUSTMENT 4
+#define STRIKE_COUNT 20
+#define FPS_ADJUSTMENT 3
if (strikes > STRIKE_COUNT || strikes < -STRIKE_COUNT) {
int new_timeout = current_timeout;
@@ -235,14 +238,14 @@
/* it took us longer than our current_timeout to run
through
the clock update/render loop. we need to scale back
our
timeout (lower fps) */
- new_timeout = FPS_TO_DELAY (DELAY_TO_FPS
(current_timeout) + FPS_ADJUSTMENT);
+ new_timeout = FPS_TO_DELAY (DELAY_TO_FPS
(current_timeout) - FPS_ADJUSTMENT);
}
else if (strikes < -STRIKE_COUNT) {
/* it took us less time than our
current_timeout to run through the clock
update/render loop. let's make the timeout
less (higher fps). */
- new_timeout = FPS_TO_DELAY (DELAY_TO_FPS
(current_timeout) - FPS_ADJUSTMENT);
+ new_timeout = FPS_TO_DELAY (DELAY_TO_FPS
(current_timeout) + FPS_ADJUSTMENT);
}
strikes = 0;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches