| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 DCHECK(started); | 60 DCHECK(started); |
| 61 | 61 |
| 62 cc::LayerTreeSettings settings; | 62 cc::LayerTreeSettings settings; |
| 63 tree_ = cc::LayerTreeHost::CreateThreaded( | 63 tree_ = cc::LayerTreeHost::CreateThreaded( |
| 64 this, NULL, settings, compositor_thread_.message_loop_proxy()); | 64 this, NULL, settings, compositor_thread_.message_loop_proxy()); |
| 65 SetupScene(); | 65 SetupScene(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 CompositorHost::~CompositorHost() {} | 68 CompositorHost::~CompositorHost() {} |
| 69 | 69 |
| 70 void CompositorHost::DidCreateContext(gfx::Size viewport_size) { | 70 void CompositorHost::SetSize(gfx::Size viewport_size) { |
| 71 tree_->SetViewportSize(viewport_size); | 71 tree_->SetViewportSize(viewport_size); |
| 72 } |
| 73 |
| 74 void CompositorHost::DidCreateContext() { |
| 72 tree_->SetLayerTreeHostClientReady(); | 75 tree_->SetLayerTreeHostClientReady(); |
| 73 tree_->InitializeOutputSurfaceIfNeeded(); | 76 tree_->InitializeOutputSurfaceIfNeeded(); |
| 74 } | 77 } |
| 75 | 78 |
| 76 void CompositorHost::SetupScene() { | 79 void CompositorHost::SetupScene() { |
| 77 scoped_refptr<cc::Layer> root_layer = cc::SolidColorLayer::Create(); | 80 scoped_refptr<cc::Layer> root_layer = cc::SolidColorLayer::Create(); |
| 78 root_layer->SetBounds(gfx::Size(500, 500)); | 81 root_layer->SetBounds(gfx::Size(500, 500)); |
| 79 root_layer->SetBackgroundColor(SK_ColorBLUE); | 82 root_layer->SetBackgroundColor(SK_ColorBLUE); |
| 80 root_layer->SetIsDrawable(true); | 83 root_layer->SetIsDrawable(true); |
| 81 tree_->SetRootLayer(root_layer); | 84 tree_->SetRootLayer(root_layer); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void CompositorHost::DidCommit() {} | 123 void CompositorHost::DidCommit() {} |
| 121 void CompositorHost::DidCommitAndDrawFrame() {} | 124 void CompositorHost::DidCommitAndDrawFrame() {} |
| 122 void CompositorHost::DidCompleteSwapBuffers() {} | 125 void CompositorHost::DidCompleteSwapBuffers() {} |
| 123 | 126 |
| 124 scoped_refptr<cc::ContextProvider> CompositorHost::OffscreenContextProvider() { | 127 scoped_refptr<cc::ContextProvider> CompositorHost::OffscreenContextProvider() { |
| 125 return NULL; | 128 return NULL; |
| 126 } | 129 } |
| 127 | 130 |
| 128 } // namespace examples | 131 } // namespace examples |
| 129 } // namespace mojo | 132 } // namespace mojo |
| OLD | NEW |