diff options
author | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-07 09:36:49 +0000 |
---|---|---|
committer | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-07 09:36:49 +0000 |
commit | e197af305cff172d061e6fa30cb41a353c43d703 (patch) | |
tree | a47d1a89ac03b444133902e947217ccdb3a92dac /mojo/examples/compositor_app | |
parent | 3efc08f261c871a255d87bd126e390427333f4c7 (diff) | |
download | chromium_src-e197af305cff172d061e6fa30cb41a353c43d703.zip chromium_src-e197af305cff172d061e6fa30cb41a353c43d703.tar.gz chromium_src-e197af305cff172d061e6fa30cb41a353c43d703.tar.bz2 |
Make LayerTreeHostClient::Animate take TimeTicks instead of double
This makes LayerTreeHostClient::Animate take a TimeTicks instead of a
double, moving the conversion to double from the caller of Animate to
wherever doubles are actually needed.
This avoids precision loss caused by converting from TimeTicks to
double and back again when TimeTicks are actually needed (as in
LayerTreeHostClientForTesting::Animate) fixing the suspected cause
of flakiness in LayerTreeHostAnimationTestFrozenAnimationTickTime.
R=danakj,jamesr
TBR=sky
BUG=341517
Review URL: https://codereview.chromium.org/153633006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/compositor_app')
-rw-r--r-- | mojo/examples/compositor_app/compositor_host.cc | 5 | ||||
-rw-r--r-- | mojo/examples/compositor_app/compositor_host.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/mojo/examples/compositor_app/compositor_host.cc b/mojo/examples/compositor_app/compositor_host.cc index 0760910..8f5e47c 100644 --- a/mojo/examples/compositor_app/compositor_host.cc +++ b/mojo/examples/compositor_app/compositor_host.cc @@ -54,10 +54,11 @@ void CompositorHost::SetupScene() { void CompositorHost::WillBeginMainFrame(int frame_id) {} void CompositorHost::DidBeginMainFrame() {} -void CompositorHost::Animate(double frame_begin_time) { +void CompositorHost::Animate(base::TimeTicks frame_begin_time) { // TODO(jamesr): Should use cc's animation system. static const double kDegreesPerSecond = 70.0; - double child_rotation_degrees = kDegreesPerSecond * frame_begin_time; + double time_in_seconds = (frame_begin_time - base::TimeTicks()).InSecondsF(); + double child_rotation_degrees = kDegreesPerSecond * time_in_seconds; gfx::Transform child_transform; child_transform.Translate(200, 200); child_transform.Rotate(child_rotation_degrees); diff --git a/mojo/examples/compositor_app/compositor_host.h b/mojo/examples/compositor_app/compositor_host.h index a7a96ea..97f5b14 100644 --- a/mojo/examples/compositor_app/compositor_host.h +++ b/mojo/examples/compositor_app/compositor_host.h @@ -31,7 +31,7 @@ class CompositorHost : public cc::LayerTreeHostClient { // cc::LayerTreeHostClient implementation. virtual void WillBeginMainFrame(int frame_id) OVERRIDE; virtual void DidBeginMainFrame() OVERRIDE; - virtual void Animate(double frame_begin_time) OVERRIDE; + virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE; virtual void Layout() OVERRIDE; virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, float page_scale) OVERRIDE; |