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

Unified Diff: mojo/services/media/common/cpp/timeline_function.cc

Issue 1952673003: Motown: Rename Ratio and LinearFunction classes (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « mojo/services/media/common/cpp/timeline_function.h ('k') | mojo/services/media/common/cpp/timeline_rate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/media/common/cpp/timeline_function.cc
diff --git a/mojo/services/media/common/cpp/timeline_function.cc b/mojo/services/media/common/cpp/timeline_function.cc
new file mode 100644
index 0000000000000000000000000000000000000000..350fde64a6ef6332591cce5697b1d18ff74029d4
--- /dev/null
+++ b/mojo/services/media/common/cpp/timeline_function.cc
@@ -0,0 +1,32 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <limits>
+#include <utility>
+
+#include "mojo/public/cpp/environment/logging.h"
+#include "mojo/services/media/common/cpp/timeline_function.h"
+
+namespace mojo {
+namespace media {
+
+// static
+int64_t TimelineFunction::Apply(
+ int64_t reference_time,
+ int64_t subject_time,
+ const TimelineRate& rate, // subject_delta / reference_delta
+ int64_t reference_input) {
+ return rate.Scale(reference_input - reference_time) + subject_time;
+}
+
+// static
+TimelineFunction TimelineFunction::Compose(const TimelineFunction& bc,
+ const TimelineFunction& ab,
+ bool exact) {
+ return TimelineFunction(ab.reference_time(), bc.Apply(ab.subject_time()),
+ TimelineRate::Product(ab.rate(), bc.rate(), exact));
+}
+
+} // namespace media
+} // namespace mojo
« no previous file with comments | « mojo/services/media/common/cpp/timeline_function.h ('k') | mojo/services/media/common/cpp/timeline_rate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698