OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef SERVICES_GFX_COMPOSITOR_GRAPH_SCENE_CONTENT_H_ | 5 #ifndef SERVICES_GFX_COMPOSITOR_GRAPH_SCENE_CONTENT_H_ |
6 #define SERVICES_GFX_COMPOSITOR_GRAPH_SCENE_CONTENT_H_ | 6 #define SERVICES_GFX_COMPOSITOR_GRAPH_SCENE_CONTENT_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "mojo/services/gfx/composition/interfaces/hit_tests.mojom.h" |
14 #include "mojo/services/gfx/composition/interfaces/scenes.mojom.h" | 15 #include "mojo/services/gfx/composition/interfaces/scenes.mojom.h" |
15 #include "services/gfx/compositor/graph/node_def.h" | 16 #include "services/gfx/compositor/graph/node_def.h" |
16 #include "services/gfx/compositor/graph/resource_def.h" | 17 #include "services/gfx/compositor/graph/resource_def.h" |
17 #include "services/gfx/compositor/graph/scene_label.h" | 18 #include "services/gfx/compositor/graph/scene_label.h" |
18 | 19 |
| 20 class SkCanvas; |
| 21 struct SkPoint; |
| 22 class SkMatrix; |
| 23 |
19 namespace compositor { | 24 namespace compositor { |
20 | 25 |
21 class SceneContentBuilder; | 26 class SceneContentBuilder; |
22 class SceneDef; | 27 class SceneDef; |
23 | 28 |
24 // Represents the content of a particular published version of a scene. | 29 // Represents the content of a particular published version of a scene. |
25 // | 30 // |
26 // Holds a resource and node table which describes the content of a | 31 // Holds a resource and node table which describes the content of a |
27 // scene as it was when a particular version was published. Only the | 32 // scene as it was when a particular version was published. Only the |
28 // internal state of the scene is described; links to other scenes are | 33 // internal state of the scene is described; links to other scenes are |
(...skipping 13 matching lines...) Expand all Loading... |
42 std::string FormattedLabel() const { | 47 std::string FormattedLabel() const { |
43 return label_.FormattedLabelForVersion(version_); | 48 return label_.FormattedLabelForVersion(version_); |
44 } | 49 } |
45 std::string FormattedLabelForNode(uint32_t node_id) const { | 50 std::string FormattedLabelForNode(uint32_t node_id) const { |
46 return label_.FormattedLabelForNode(version_, node_id); | 51 return label_.FormattedLabelForNode(version_, node_id); |
47 } | 52 } |
48 | 53 |
49 // Gets the version of the scene represented by this object. | 54 // Gets the version of the scene represented by this object. |
50 uint32_t version() const { return version_; } | 55 uint32_t version() const { return version_; } |
51 | 56 |
| 57 // Called to record drawing commands from a snapshot. |
| 58 void RecordPicture(const Snapshot* snapshot, SkCanvas* canvas) const; |
| 59 |
| 60 // Performs a hit test at the specified point. |
| 61 // The |scene_point| is the hit tested point in the scene's coordinate space. |
| 62 // The |global_to_scene_transform| is the accumulated transform from the |
| 63 // global coordinate space to the scene's coordinate space. |
| 64 // Provides hit information for the scene in |out_scene_hit| if any. |
| 65 // Returns true if the search was terminated by an opaque hit. |
| 66 bool HitTest(const Snapshot* snapshot, |
| 67 const SkPoint& scene_point, |
| 68 const SkMatrix& global_to_scene_transform, |
| 69 mojo::gfx::composition::SceneHitPtr* out_scene_hit) const; |
| 70 |
52 // Gets the requested resource, never null because it must be present. | 71 // Gets the requested resource, never null because it must be present. |
53 const ResourceDef* GetResource(uint32_t resource_id, | 72 const ResourceDef* GetResource(uint32_t resource_id, |
54 ResourceDef::Type resource_type) const; | 73 ResourceDef::Type resource_type) const; |
55 | 74 |
56 // Gets the requested node, never null because it must be present. | 75 // Gets the requested node, never null because it must be present. |
57 const NodeDef* GetNode(uint32_t node_id) const; | 76 const NodeDef* GetNode(uint32_t node_id) const; |
58 | 77 |
59 // Gets the root node if it exists, otherwise returns nullptr. | 78 // Gets the root node if it exists, otherwise returns nullptr. |
60 const NodeDef* GetRootNodeIfExists() const; | 79 const NodeDef* GetRootNodeIfExists() const; |
61 | 80 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 bool AddNode(const NodeDef* node); | 127 bool AddNode(const NodeDef* node); |
109 | 128 |
110 scoped_refptr<SceneContent> content_; | 129 scoped_refptr<SceneContent> content_; |
111 const SceneDef* scene_; | 130 const SceneDef* scene_; |
112 std::ostream& err_; | 131 std::ostream& err_; |
113 }; | 132 }; |
114 | 133 |
115 } // namespace compositor | 134 } // namespace compositor |
116 | 135 |
117 #endif // SERVICES_GFX_COMPOSITOR_GRAPH_SCENE_CONTENT_H_ | 136 #endif // SERVICES_GFX_COMPOSITOR_GRAPH_SCENE_CONTENT_H_ |
OLD | NEW |