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

Side by Side Diff: examples/ui/png_viewer/png_viewer.cc

Issue 1782733002: Mozart: The great RectF-ication. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-9
Patch Set: rebase Created 4 years, 9 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
« no previous file with comments | « examples/ui/pdf_viewer/pdf_viewer.cc ('k') | examples/ui/shapes/shapes_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « examples/ui/pdf_viewer/pdf_viewer.cc ('k') | examples/ui/shapes/shapes_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698