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

Side by Side Diff: mojo/examples/compositor_app/compositor_host.cc

Issue 429743003: Rename Animate as Begin(Main)Frame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a typo that made tests fail. Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/examples/compositor_app/compositor_host.h" 5 #include "mojo/examples/compositor_app/compositor_host.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "cc/layers/solid_color_layer.h" 8 #include "cc/layers/solid_color_layer.h"
9 #include "cc/output/context_provider.h" 9 #include "cc/output/context_provider.h"
10 #include "cc/output/output_surface.h" 10 #include "cc/output/output_surface.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 child_layer_->SetIsDrawable(true); 51 child_layer_->SetIsDrawable(true);
52 gfx::Transform child_transform; 52 gfx::Transform child_transform;
53 child_transform.Translate(200, 200); 53 child_transform.Translate(200, 200);
54 child_layer_->SetTransform(child_transform); 54 child_layer_->SetTransform(child_transform);
55 root_layer->AddChild(child_layer_); 55 root_layer->AddChild(child_layer_);
56 } 56 }
57 57
58 void CompositorHost::WillBeginMainFrame(int frame_id) {} 58 void CompositorHost::WillBeginMainFrame(int frame_id) {}
59 void CompositorHost::DidBeginMainFrame() {} 59 void CompositorHost::DidBeginMainFrame() {}
60 60
61 void CompositorHost::Animate(base::TimeTicks frame_begin_time) { 61 void CompositorHost::BeginMainFrame(const cc::BeginFrameArgs& args) {
62 // TODO(jamesr): Should use cc's animation system. 62 // TODO(jamesr): Should use cc's animation system.
63 static const double kDegreesPerSecond = 70.0; 63 static const double kDegreesPerSecond = 70.0;
64 double time_in_seconds = (frame_begin_time - base::TimeTicks()).InSecondsF(); 64 double time_in_seconds = (args.frame_time - base::TimeTicks()).InSecondsF();
65 double child_rotation_degrees = kDegreesPerSecond * time_in_seconds; 65 double child_rotation_degrees = kDegreesPerSecond * time_in_seconds;
66 gfx::Transform child_transform; 66 gfx::Transform child_transform;
67 child_transform.Translate(200, 200); 67 child_transform.Translate(200, 200);
68 child_transform.Rotate(child_rotation_degrees); 68 child_transform.Rotate(child_rotation_degrees);
69 child_layer_->SetTransform(child_transform); 69 child_layer_->SetTransform(child_transform);
70 tree_->SetNeedsAnimate(); 70 tree_->SetNeedsAnimate();
71 } 71 }
72 72
73 void CompositorHost::Layout() {} 73 void CompositorHost::Layout() {}
74 void CompositorHost::ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, 74 void CompositorHost::ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
75 float page_scale) {} 75 float page_scale) {}
76 76
77 scoped_ptr<cc::OutputSurface> CompositorHost::CreateOutputSurface( 77 scoped_ptr<cc::OutputSurface> CompositorHost::CreateOutputSurface(
78 bool fallback) { 78 bool fallback) {
79 return make_scoped_ptr( 79 return make_scoped_ptr(
80 new cc::OutputSurface( 80 new cc::OutputSurface(
81 new ContextProviderMojo(command_buffer_handle_.Pass()))); 81 new ContextProviderMojo(command_buffer_handle_.Pass())));
82 } 82 }
83 83
84 void CompositorHost::DidInitializeOutputSurface() { 84 void CompositorHost::DidInitializeOutputSurface() {
85 } 85 }
86 86
87 void CompositorHost::WillCommit() {} 87 void CompositorHost::WillCommit() {}
88 void CompositorHost::DidCommit() {} 88 void CompositorHost::DidCommit() {}
89 void CompositorHost::DidCommitAndDrawFrame() {} 89 void CompositorHost::DidCommitAndDrawFrame() {}
90 void CompositorHost::DidCompleteSwapBuffers() {} 90 void CompositorHost::DidCompleteSwapBuffers() {}
91 91
92 } // namespace examples 92 } // namespace examples
93 } // namespace mojo 93 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698