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

Side by Side Diff: services/gfx/compositor/graph/scene_def.cc

Issue 1774373002: Mozart: Implement hit testing. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-4
Patch Set: 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
OLDNEW
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 "services/gfx/compositor/graph/scene_def.h" 5 #include "services/gfx/compositor/graph/scene_def.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 217
218 scoped_refptr<const NodeDef> SceneDef::CreateNode( 218 scoped_refptr<const NodeDef> SceneDef::CreateNode(
219 uint32_t node_id, 219 uint32_t node_id,
220 mojo::gfx::composition::NodePtr node_decl, 220 mojo::gfx::composition::NodePtr node_decl,
221 std::ostream& err) { 221 std::ostream& err) {
222 DCHECK(node_decl); 222 DCHECK(node_decl);
223 223
224 mojo::TransformPtr content_transform = node_decl->content_transform.Pass(); 224 mojo::TransformPtr content_transform = node_decl->content_transform.Pass();
225 mojo::RectPtr content_clip = node_decl->content_clip.Pass(); 225 mojo::RectPtr content_clip = node_decl->content_clip.Pass();
226 mojo::gfx::composition::HitTestBehaviorPtr hit_test_behavior =
227 node_decl->hit_test_behavior.Pass();
226 const mojo::gfx::composition::Node::Combinator combinator = 228 const mojo::gfx::composition::Node::Combinator combinator =
227 node_decl->combinator; 229 node_decl->combinator;
228 const std::vector<uint32_t>& child_node_ids = 230 const std::vector<uint32_t>& child_node_ids =
229 node_decl->child_node_ids.storage(); 231 node_decl->child_node_ids.storage();
230 232
231 if (!node_decl->op) { 233 if (!node_decl->op) {
232 return new NodeDef(node_id, content_transform.Pass(), content_clip.Pass(), 234 return new NodeDef(node_id, content_transform.Pass(), content_clip.Pass(),
233 combinator, child_node_ids); 235 hit_test_behavior.Pass(), combinator, child_node_ids);
234 } 236 }
235 237
236 if (node_decl->op->is_rect()) { 238 if (node_decl->op->is_rect()) {
237 auto& rect_node_decl = node_decl->op->get_rect(); 239 auto& rect_node_decl = node_decl->op->get_rect();
238 DCHECK(rect_node_decl->content_rect); 240 DCHECK(rect_node_decl->content_rect);
239 DCHECK(rect_node_decl->color); 241 DCHECK(rect_node_decl->color);
240 242
241 const mojo::Rect& content_rect = *rect_node_decl->content_rect; 243 const mojo::Rect& content_rect = *rect_node_decl->content_rect;
242 const mojo::gfx::composition::Color& color = *rect_node_decl->color; 244 const mojo::gfx::composition::Color& color = *rect_node_decl->color;
243 return new RectNodeDef(node_id, content_transform.Pass(), 245 return new RectNodeDef(node_id, content_transform.Pass(),
244 content_clip.Pass(), combinator, child_node_ids, 246 content_clip.Pass(), hit_test_behavior.Pass(),
245 content_rect, color); 247 combinator, child_node_ids, content_rect, color);
246 } 248 }
247 249
248 if (node_decl->op->is_image()) { 250 if (node_decl->op->is_image()) {
249 auto& image_node_decl = node_decl->op->get_image(); 251 auto& image_node_decl = node_decl->op->get_image();
250 DCHECK(image_node_decl->content_rect); 252 DCHECK(image_node_decl->content_rect);
251 253
252 const mojo::Rect& content_rect = *image_node_decl->content_rect; 254 const mojo::Rect& content_rect = *image_node_decl->content_rect;
253 mojo::RectPtr image_rect = image_node_decl->image_rect.Pass(); 255 mojo::RectPtr image_rect = image_node_decl->image_rect.Pass();
254 const uint32 image_resource_id = image_node_decl->image_resource_id; 256 const uint32 image_resource_id = image_node_decl->image_resource_id;
255 mojo::gfx::composition::BlendPtr blend = image_node_decl->blend.Pass(); 257 mojo::gfx::composition::BlendPtr blend = image_node_decl->blend.Pass();
256 return new ImageNodeDef(node_id, content_transform.Pass(), 258 return new ImageNodeDef(node_id, content_transform.Pass(),
257 content_clip.Pass(), combinator, child_node_ids, 259 content_clip.Pass(), hit_test_behavior.Pass(),
258 content_rect, image_rect.Pass(), image_resource_id, 260 combinator, child_node_ids, content_rect,
259 blend.Pass()); 261 image_rect.Pass(), image_resource_id, blend.Pass());
260 } 262 }
261 263
262 if (node_decl->op->is_scene()) { 264 if (node_decl->op->is_scene()) {
263 auto& scene_node_decl = node_decl->op->get_scene(); 265 auto& scene_node_decl = node_decl->op->get_scene();
264 266
265 const uint32_t scene_resource_id = scene_node_decl->scene_resource_id; 267 const uint32_t scene_resource_id = scene_node_decl->scene_resource_id;
266 const uint32_t scene_version = scene_node_decl->scene_version; 268 const uint32_t scene_version = scene_node_decl->scene_version;
267 return new SceneNodeDef(node_id, content_transform.Pass(), 269 return new SceneNodeDef(node_id, content_transform.Pass(),
268 content_clip.Pass(), combinator, child_node_ids, 270 content_clip.Pass(), hit_test_behavior.Pass(),
269 scene_resource_id, scene_version); 271 combinator, child_node_ids, scene_resource_id,
272 scene_version);
270 } 273 }
271 274
272 if (node_decl->op->is_layer()) { 275 if (node_decl->op->is_layer()) {
273 auto& layer_node_decl = node_decl->op->get_layer(); 276 auto& layer_node_decl = node_decl->op->get_layer();
274 DCHECK(layer_node_decl->layer_size); 277 DCHECK(layer_node_decl->layer_size);
275 278
276 const mojo::Size& layer_size = *layer_node_decl->layer_size; 279 const mojo::Size& layer_size = *layer_node_decl->layer_size;
277 mojo::gfx::composition::BlendPtr blend = layer_node_decl->blend.Pass(); 280 mojo::gfx::composition::BlendPtr blend = layer_node_decl->blend.Pass();
278 return new LayerNodeDef(node_id, content_transform.Pass(), 281 return new LayerNodeDef(node_id, content_transform.Pass(),
279 content_clip.Pass(), combinator, child_node_ids, 282 content_clip.Pass(), hit_test_behavior.Pass(),
280 layer_size, blend.Pass()); 283 combinator, child_node_ids, layer_size,
284 blend.Pass());
281 } 285 }
282 286
283 err << "Unsupported node op type: node_id=" << node_id 287 err << "Unsupported node op type: node_id=" << node_id
284 << ", node_op=" << node_decl->op; 288 << ", node_op=" << node_decl->op;
285 return nullptr; 289 return nullptr;
286 } 290 }
287 291
288 const NodeDef* SceneDef::FindNode(uint32_t node_id) const { 292 const NodeDef* SceneDef::FindNode(uint32_t node_id) const {
289 auto it = nodes_.find(node_id); 293 auto it = nodes_.find(node_id);
290 return it != nodes_.end() ? it->second.get() : nullptr; 294 return it != nodes_.end() ? it->second.get() : nullptr;
(...skipping 19 matching lines...) Expand all
310 314
311 SceneDef::Publication::Publication( 315 SceneDef::Publication::Publication(
312 mojo::gfx::composition::SceneMetadataPtr metadata) 316 mojo::gfx::composition::SceneMetadataPtr metadata)
313 : metadata(metadata.Pass()) { 317 : metadata(metadata.Pass()) {
314 DCHECK(this->metadata); 318 DCHECK(this->metadata);
315 } 319 }
316 320
317 SceneDef::Publication::~Publication() {} 321 SceneDef::Publication::~Publication() {}
318 322
319 } // namespace compositor 323 } // namespace compositor
OLDNEW
« no previous file with comments | « services/gfx/compositor/graph/scene_content.cc ('k') | services/gfx/compositor/graph/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698