| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "mojo/application/application_runner_chromium.h" | 10 #include "mojo/application/application_runner_chromium.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 size_.height = layout_params->constraints->max_height; | 46 size_.height = layout_params->constraints->max_height; |
| 47 | 47 |
| 48 auto info = mojo::ui::ViewLayoutResult::New(); | 48 auto info = mojo::ui::ViewLayoutResult::New(); |
| 49 info->size = size_.Clone(); | 49 info->size = size_.Clone(); |
| 50 callback.Run(info.Pass()); | 50 callback.Run(info.Pass()); |
| 51 | 51 |
| 52 UpdateScene(); | 52 UpdateScene(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void UpdateScene() { | 55 void UpdateScene() { |
| 56 mojo::Rect bounds; | 56 mojo::RectF bounds; |
| 57 bounds.width = size_.width; | 57 bounds.width = size_.width; |
| 58 bounds.height = size_.height; | 58 bounds.height = size_.height; |
| 59 | 59 |
| 60 auto update = mojo::gfx::composition::SceneUpdate::New(); | 60 auto update = mojo::gfx::composition::SceneUpdate::New(); |
| 61 mojo::gfx::composition::ResourcePtr content_resource = | 61 mojo::gfx::composition::ResourcePtr content_resource = |
| 62 ganesh_renderer()->DrawCanvas( | 62 ganesh_renderer()->DrawCanvas( |
| 63 size_, base::Bind(&PNGView::DrawContent, base::Unretained(this))); | 63 size_, base::Bind(&PNGView::DrawContent, base::Unretained(this))); |
| 64 DCHECK(content_resource); | 64 DCHECK(content_resource); |
| 65 update->resources.insert(kContentImageResourceId, content_resource.Pass()); | 65 update->resources.insert(kContentImageResourceId, content_resource.Pass()); |
| 66 | 66 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 private: | 147 private: |
| 148 DISALLOW_COPY_AND_ASSIGN(PNGContentViewerApp); | 148 DISALLOW_COPY_AND_ASSIGN(PNGContentViewerApp); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace examples | 151 } // namespace examples |
| 152 | 152 |
| 153 MojoResult MojoMain(MojoHandle application_request) { | 153 MojoResult MojoMain(MojoHandle application_request) { |
| 154 mojo::ApplicationRunnerChromium runner(new examples::PNGContentViewerApp()); | 154 mojo::ApplicationRunnerChromium runner(new examples::PNGContentViewerApp()); |
| 155 return runner.Run(application_request); | 155 return runner.Run(application_request); |
| 156 } | 156 } |
| OLD | NEW |