Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: tracing/tracing/base/math.html

Issue 1336373002: Port rendering_stats' implementation to javascript (Closed) Base URL: https://github.com/catapult-project/catapult@master
Patch Set: Address Dan's reviews Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tracing/tracing/base/math.html
diff --git a/tracing/tracing/base/math.html b/tracing/tracing/base/math.html
index b6f7fd58d061b7d66cec3b548ae5e8cf8c769dd3..1ce443704f84769cad45db14e54c4bb5a291611e 100644
--- a/tracing/tracing/base/math.html
+++ b/tracing/tracing/base/math.html
@@ -11,6 +11,12 @@ found in the LICENSE file.
'use strict';
tr.exportTo('tr.b', function() {
+ function round(number, opt_ndigits) {
+ opt_ndigits = opt_ndigits || 1;
+ var k = Math.pow(10, opt_ndigits);
+ return Math.round(number * k) / k;
+ }
+
function clamp(x, lo, hi) {
return Math.min(Math.max(x, lo), hi);
}
@@ -104,6 +110,7 @@ tr.exportTo('tr.b', function() {
}
return {
+ round: round,
clamp: clamp,
lerp: lerp,
normalize: normalize,

Powered by Google App Engine
This is Rietveld 408576698