OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "examples/ui/tile/tile_view.h" | 6 #include "examples/ui/tile/tile_view.h" |
7 #include "mojo/services/geometry/cpp/geometry_util.h" | 7 #include "mojo/services/geometry/cpp/geometry_util.h" |
8 | 8 |
9 namespace examples { | 9 namespace examples { |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 for (auto it = views_.cbegin(); it != views_.cend(); it++) { | 171 for (auto it = views_.cbegin(); it != views_.cend(); it++) { |
172 const ViewData& view_data = *(it->second.get()); | 172 const ViewData& view_data = *(it->second.get()); |
173 const uint32_t scene_resource_id = | 173 const uint32_t scene_resource_id = |
174 kViewResourceIdBase + view_data.key * kViewResourceIdSpacing; | 174 kViewResourceIdBase + view_data.key * kViewResourceIdSpacing; |
175 const uint32_t container_node_id = | 175 const uint32_t container_node_id = |
176 kViewNodeIdBase + view_data.key * kViewNodeIdSpacing; | 176 kViewNodeIdBase + view_data.key * kViewNodeIdSpacing; |
177 const uint32_t scene_node_id = container_node_id + kViewSceneNodeIdOffset; | 177 const uint32_t scene_node_id = container_node_id + kViewSceneNodeIdOffset; |
178 const uint32_t fallback_node_id = | 178 const uint32_t fallback_node_id = |
179 container_node_id + kViewFallbackNodeIdOffset; | 179 container_node_id + kViewFallbackNodeIdOffset; |
180 | 180 |
181 mojo::Rect extent; | 181 mojo::RectF extent; |
182 extent.width = view_data.layout_bounds.width; | 182 extent.width = view_data.layout_bounds.width; |
183 extent.height = view_data.layout_bounds.height; | 183 extent.height = view_data.layout_bounds.height; |
184 | 184 |
185 // Create a container to represent the place where the child view | 185 // Create a container to represent the place where the child view |
186 // will be presented. The children of the container provide | 186 // will be presented. The children of the container provide |
187 // fallback behavior in case the view is not available. | 187 // fallback behavior in case the view is not available. |
188 auto container_node = mojo::gfx::composition::Node::New(); | 188 auto container_node = mojo::gfx::composition::Node::New(); |
189 container_node->content_clip = extent.Clone(); | 189 container_node->content_clip = extent.Clone(); |
190 container_node->content_transform = mojo::Transform::New(); | 190 container_node->content_transform = mojo::Transform::New(); |
191 SetTranslationTransform(container_node->content_transform.get(), | 191 SetTranslationTransform(container_node->content_transform.get(), |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 pending_layout_callback_.Run(info.Pass()); | 242 pending_layout_callback_.Run(info.Pass()); |
243 pending_layout_callback_.reset(); | 243 pending_layout_callback_.reset(); |
244 } | 244 } |
245 | 245 |
246 TileView::ViewData::ViewData(const std::string& url, uint32_t key) | 246 TileView::ViewData::ViewData(const std::string& url, uint32_t key) |
247 : url(url), key(key), layout_pending(false) {} | 247 : url(url), key(key), layout_pending(false) {} |
248 | 248 |
249 TileView::ViewData::~ViewData() {} | 249 TileView::ViewData::~ViewData() {} |
250 | 250 |
251 } // namespace examples | 251 } // namespace examples |
OLD | NEW |