mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1029559 - The framerate front should have a means of clamping the generated values (relanded), r=pbrosset
This commit is contained in:
parent
bd62408979
commit
a2f15d81b9
@ -121,11 +121,13 @@ let FramerateFront = exports.FramerateFront = protocol.FrontClass(FramerateActor
|
||||
* the elapsed time on each refresh driver tick.
|
||||
* @param number interval
|
||||
* The maximum amount of time to wait between calculations.
|
||||
* @param number clamp
|
||||
* The maximum allowed framerate value.
|
||||
* @return array
|
||||
* A collection of { delta, value } objects representing the
|
||||
* framerate value at every delta time.
|
||||
*/
|
||||
plotFPS: function(ticks, interval = 100) {
|
||||
plotFPS: function(ticks, interval = 100, clamp = 60) {
|
||||
let timeline = [];
|
||||
let totalTicks = ticks.length;
|
||||
|
||||
@ -149,7 +151,7 @@ let FramerateFront = exports.FramerateFront = protocol.FrontClass(FramerateActor
|
||||
continue;
|
||||
}
|
||||
|
||||
let framerate = 1000 / (elapsedTime / frameCount);
|
||||
let framerate = Math.min(1000 / (elapsedTime / frameCount), clamp);
|
||||
timeline.push({ delta: prevTime, value: framerate });
|
||||
timeline.push({ delta: currTime, value: framerate });
|
||||
|
||||
|
@ -86,10 +86,10 @@ window.onload = function() {
|
||||
|
||||
is(currFramerateStart, currFramerateEnd,
|
||||
"The start and end framerate values should be equal.");
|
||||
isnot(currFramerateStart, prevFramerateValue,
|
||||
"There should be different framerate values for each bucket.");
|
||||
|
||||
is(typeof currFramerateStart, "number", "All values should be numbers.");
|
||||
ok(currFramerateStart <= 60, "All values were correctly clamped.")
|
||||
|
||||
prevFramerateValue = currFramerateStart;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user