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

Side by Side Diff: services/gfx/compositor/graph/nodes.h

Issue 1995873002: Mozart: Improve tracing and backpressure. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address review comments Created 4 years, 7 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 #ifndef SERVICES_GFX_COMPOSITOR_GRAPH_NODES_H_ 5 #ifndef SERVICES_GFX_COMPOSITOR_GRAPH_NODES_H_
6 #define SERVICES_GFX_COMPOSITOR_GRAPH_NODES_H_ 6 #define SERVICES_GFX_COMPOSITOR_GRAPH_NODES_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Returns true if successful, false if the node contains linkage errors. 63 // Returns true if successful, false if the node contains linkage errors.
64 virtual bool RecordContent(SceneContentBuilder* builder) const; 64 virtual bool RecordContent(SceneContentBuilder* builder) const;
65 65
66 // Called by the snapshot builder to traverse the node's dependencies 66 // Called by the snapshot builder to traverse the node's dependencies
67 // recursively follow links into other scenes, evaluate whether the 67 // recursively follow links into other scenes, evaluate whether the
68 // node can be rendered, and record which path was taken for the purposes 68 // node can be rendered, and record which path was taken for the purposes
69 // of satisfying combinators. 69 // of satisfying combinators.
70 virtual Snapshot::Disposition RecordSnapshot(const SceneContent* content, 70 virtual Snapshot::Disposition RecordSnapshot(const SceneContent* content,
71 SnapshotBuilder* builder) const; 71 SnapshotBuilder* builder) const;
72 72
73 // Called to record drawing commands from a snapshot. 73 // Paints the content of the node to a recording canvas.
74 void RecordPicture(const SceneContent* content, 74 void Paint(const SceneContent* content,
75 const Snapshot* snapshot, 75 const Snapshot* snapshot,
76 SkCanvas* canvas) const; 76 SkCanvas* canvas) const;
77 77
78 // Performs a hit test at the specified point. 78 // Performs a hit test at the specified point.
79 // The |point| is the hit tested point in the parent's coordinate space. 79 // The |point| is the hit tested point in the parent's coordinate space.
80 // The |global_to_parent_transform| is the accumulated transform from the 80 // The |global_to_parent_transform| is the accumulated transform from the
81 // global coordinate space to the parent's coordinate space. 81 // global coordinate space to the parent's coordinate space.
82 // Adds hit information for the node to |hits|. 82 // Adds hit information for the node to |hits|.
83 // Returns true if the search was terminated by an opaque hit. 83 // Returns true if the search was terminated by an opaque hit.
84 bool HitTest(const SceneContent* content, 84 bool HitTest(const SceneContent* content,
85 const Snapshot* snapshot, 85 const Snapshot* snapshot,
86 const SkPoint& parent_point, 86 const SkPoint& parent_point,
87 const SkMatrix44& global_to_parent_transform, 87 const SkMatrix44& global_to_parent_transform,
88 mojo::Array<mojo::gfx::composition::HitPtr>* hits) const; 88 mojo::Array<mojo::gfx::composition::HitPtr>* hits) const;
89 89
90 protected: 90 protected:
91 friend class base::RefCounted<Node>; 91 friend class base::RefCounted<Node>;
92 virtual ~Node(); 92 virtual ~Node();
93 93
94 // Applies a unary function to the children selected by the node's 94 // Applies a unary function to the children selected by the node's
95 // combinator rule during a snapshot. 95 // combinator rule during a snapshot.
96 // Stops when |Func| returns false. 96 // Stops when |Func| returns false.
97 // |Func| should have the signature |bool func(const Node*)|. 97 // |Func| should have the signature |bool func(const Node*)|.
98 template <typename Func> 98 template <typename Func>
99 void TraverseSnapshottedChildren(const SceneContent* content, 99 void TraverseSnapshottedChildren(const SceneContent* content,
100 const Snapshot* snapshot, 100 const Snapshot* snapshot,
101 const Func& func) const; 101 const Func& func) const;
102 102
103 virtual void RecordPictureInner(const SceneContent* content, 103 virtual void PaintInner(const SceneContent* content,
104 const Snapshot* snapshot, 104 const Snapshot* snapshot,
105 SkCanvas* canvas) const; 105 SkCanvas* canvas) const;
106 106
107 virtual bool HitTestInner( 107 virtual bool HitTestInner(
108 const SceneContent* content, 108 const SceneContent* content,
109 const Snapshot* snapshot, 109 const Snapshot* snapshot,
110 const SkPoint& local_point, 110 const SkPoint& local_point,
111 const SkMatrix44& global_to_local_transform, 111 const SkMatrix44& global_to_local_transform,
112 mojo::Array<mojo::gfx::composition::HitPtr>* hits) const; 112 mojo::Array<mojo::gfx::composition::HitPtr>* hits) const;
113 113
114 private: 114 private:
115 bool HitTestSelf(const SceneContent* content, 115 bool HitTestSelf(const SceneContent* content,
(...skipping 25 matching lines...) Expand all
141 const std::vector<uint32_t>& child_node_ids, 141 const std::vector<uint32_t>& child_node_ids,
142 const mojo::RectF& content_rect, 142 const mojo::RectF& content_rect,
143 const mojo::gfx::composition::Color& color); 143 const mojo::gfx::composition::Color& color);
144 144
145 const mojo::RectF& content_rect() const { return content_rect_; } 145 const mojo::RectF& content_rect() const { return content_rect_; }
146 const mojo::gfx::composition::Color& color() const { return color_; } 146 const mojo::gfx::composition::Color& color() const { return color_; }
147 147
148 protected: 148 protected:
149 ~RectNode() override; 149 ~RectNode() override;
150 150
151 void RecordPictureInner(const SceneContent* content, 151 void PaintInner(const SceneContent* content,
152 const Snapshot* snapshot, 152 const Snapshot* snapshot,
153 SkCanvas* canvas) const override; 153 SkCanvas* canvas) const override;
154 154
155 private: 155 private:
156 mojo::RectF const content_rect_; 156 mojo::RectF const content_rect_;
157 mojo::gfx::composition::Color const color_; 157 mojo::gfx::composition::Color const color_;
158 158
159 DISALLOW_COPY_AND_ASSIGN(RectNode); 159 DISALLOW_COPY_AND_ASSIGN(RectNode);
160 }; 160 };
161 161
162 // Represents an image node. 162 // Represents an image node.
163 // 163 //
(...skipping 14 matching lines...) Expand all
178 const mojo::RectF& content_rect() const { return content_rect_; } 178 const mojo::RectF& content_rect() const { return content_rect_; }
179 const mojo::RectF* image_rect() const { return image_rect_.get(); } 179 const mojo::RectF* image_rect() const { return image_rect_.get(); }
180 uint32_t image_resource_id() const { return image_resource_id_; } 180 uint32_t image_resource_id() const { return image_resource_id_; }
181 const mojo::gfx::composition::Blend* blend() const { return blend_.get(); } 181 const mojo::gfx::composition::Blend* blend() const { return blend_.get(); }
182 182
183 bool RecordContent(SceneContentBuilder* builder) const override; 183 bool RecordContent(SceneContentBuilder* builder) const override;
184 184
185 protected: 185 protected:
186 ~ImageNode() override; 186 ~ImageNode() override;
187 187
188 void RecordPictureInner(const SceneContent* content, 188 void PaintInner(const SceneContent* content,
189 const Snapshot* snapshot, 189 const Snapshot* snapshot,
190 SkCanvas* canvas) const override; 190 SkCanvas* canvas) const override;
191 191
192 private: 192 private:
193 mojo::RectF const content_rect_; 193 mojo::RectF const content_rect_;
194 mojo::RectFPtr const image_rect_; 194 mojo::RectFPtr const image_rect_;
195 uint32_t const image_resource_id_; 195 uint32_t const image_resource_id_;
196 mojo::gfx::composition::BlendPtr const blend_; 196 mojo::gfx::composition::BlendPtr const blend_;
197 197
198 DISALLOW_COPY_AND_ASSIGN(ImageNode); 198 DISALLOW_COPY_AND_ASSIGN(ImageNode);
199 }; 199 };
200 200
(...skipping 15 matching lines...) Expand all
216 uint32_t scene_version() const { return scene_version_; } 216 uint32_t scene_version() const { return scene_version_; }
217 217
218 bool RecordContent(SceneContentBuilder* builder) const override; 218 bool RecordContent(SceneContentBuilder* builder) const override;
219 219
220 Snapshot::Disposition RecordSnapshot(const SceneContent* content, 220 Snapshot::Disposition RecordSnapshot(const SceneContent* content,
221 SnapshotBuilder* builder) const override; 221 SnapshotBuilder* builder) const override;
222 222
223 protected: 223 protected:
224 ~SceneNode() override; 224 ~SceneNode() override;
225 225
226 void RecordPictureInner(const SceneContent* content, 226 void PaintInner(const SceneContent* content,
227 const Snapshot* snapshot, 227 const Snapshot* snapshot,
228 SkCanvas* canvas) const override; 228 SkCanvas* canvas) const override;
229 229
230 bool HitTestInner( 230 bool HitTestInner(
231 const SceneContent* content, 231 const SceneContent* content,
232 const Snapshot* snapshot, 232 const Snapshot* snapshot,
233 const SkPoint& local_point, 233 const SkPoint& local_point,
234 const SkMatrix44& global_to_local_transform, 234 const SkMatrix44& global_to_local_transform,
235 mojo::Array<mojo::gfx::composition::HitPtr>* hits) const override; 235 mojo::Array<mojo::gfx::composition::HitPtr>* hits) const override;
236 236
237 private: 237 private:
238 uint32_t const scene_resource_id_; 238 uint32_t const scene_resource_id_;
(...skipping 15 matching lines...) Expand all
254 const std::vector<uint32_t>& child_node_ids, 254 const std::vector<uint32_t>& child_node_ids,
255 const mojo::RectF& layer_rect, 255 const mojo::RectF& layer_rect,
256 mojo::gfx::composition::BlendPtr blend); 256 mojo::gfx::composition::BlendPtr blend);
257 257
258 const mojo::RectF& layer_rect() const { return layer_rect_; } 258 const mojo::RectF& layer_rect() const { return layer_rect_; }
259 const mojo::gfx::composition::Blend* blend() const { return blend_.get(); } 259 const mojo::gfx::composition::Blend* blend() const { return blend_.get(); }
260 260
261 protected: 261 protected:
262 ~LayerNode() override; 262 ~LayerNode() override;
263 263
264 void RecordPictureInner(const SceneContent* content, 264 void PaintInner(const SceneContent* content,
265 const Snapshot* snapshot, 265 const Snapshot* snapshot,
266 SkCanvas* canvas) const override; 266 SkCanvas* canvas) const override;
267 267
268 private: 268 private:
269 mojo::RectF const layer_rect_; 269 mojo::RectF const layer_rect_;
270 mojo::gfx::composition::BlendPtr const blend_; 270 mojo::gfx::composition::BlendPtr const blend_;
271 271
272 DISALLOW_COPY_AND_ASSIGN(LayerNode); 272 DISALLOW_COPY_AND_ASSIGN(LayerNode);
273 }; 273 };
274 274
275 } // namespace compositor 275 } // namespace compositor
276 276
277 #endif // SERVICES_GFX_COMPOSITOR_GRAPH_NODES_H_ 277 #endif // SERVICES_GFX_COMPOSITOR_GRAPH_NODES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698