| OLD | NEW |
| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 void CompositorHost::DidBeginMainFrame() {} | 94 void CompositorHost::DidBeginMainFrame() {} |
| 95 | 95 |
| 96 void CompositorHost::Animate(double frame_begin_time) { | 96 void CompositorHost::Animate(double frame_begin_time) { |
| 97 // TODO(jamesr): Should use cc's animation system. | 97 // TODO(jamesr): Should use cc's animation system. |
| 98 static const double kDegreesPerSecond = 70.0; | 98 static const double kDegreesPerSecond = 70.0; |
| 99 double child_rotation_degrees = kDegreesPerSecond * frame_begin_time; | 99 double child_rotation_degrees = kDegreesPerSecond * frame_begin_time; |
| 100 gfx::Transform child_transform; | 100 gfx::Transform child_transform; |
| 101 child_transform.Translate(200, 200); | 101 child_transform.Translate(200, 200); |
| 102 child_transform.Rotate(child_rotation_degrees); | 102 child_transform.Rotate(child_rotation_degrees); |
| 103 child_layer_->SetTransform(child_transform); | 103 child_layer_->SetTransform(child_transform); |
| 104 tree_->SetNeedsUpdateLayers(); | 104 tree_->SetNeedsAnimate(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void CompositorHost::Layout() {} | 107 void CompositorHost::Layout() {} |
| 108 void CompositorHost::ApplyScrollAndScale(gfx::Vector2d scroll_delta, | 108 void CompositorHost::ApplyScrollAndScale(gfx::Vector2d scroll_delta, |
| 109 float page_scale) {} | 109 float page_scale) {} |
| 110 | 110 |
| 111 scoped_ptr<cc::OutputSurface> CompositorHost::CreateOutputSurface( | 111 scoped_ptr<cc::OutputSurface> CompositorHost::CreateOutputSurface( |
| 112 bool fallback) { | 112 bool fallback) { |
| 113 return make_scoped_ptr( | 113 return make_scoped_ptr( |
| 114 new cc::OutputSurface(new MojoContextProvider(gles2_client_impl_))); | 114 new cc::OutputSurface(new MojoContextProvider(gles2_client_impl_))); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void CompositorHost::DidInitializeOutputSurface(bool success) {} | 117 void CompositorHost::DidInitializeOutputSurface(bool success) {} |
| 118 | 118 |
| 119 void CompositorHost::WillCommit() {} | 119 void CompositorHost::WillCommit() {} |
| 120 void CompositorHost::DidCommit() {} | 120 void CompositorHost::DidCommit() {} |
| 121 void CompositorHost::DidCommitAndDrawFrame() {} | 121 void CompositorHost::DidCommitAndDrawFrame() {} |
| 122 void CompositorHost::DidCompleteSwapBuffers() {} | 122 void CompositorHost::DidCompleteSwapBuffers() {} |
| 123 | 123 |
| 124 scoped_refptr<cc::ContextProvider> CompositorHost::OffscreenContextProvider() { | 124 scoped_refptr<cc::ContextProvider> CompositorHost::OffscreenContextProvider() { |
| 125 return NULL; | 125 return NULL; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace examples | 128 } // namespace examples |
| 129 } // namespace mojo | 129 } // namespace mojo |
| OLD | NEW |