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

Side by Side Diff: services/gfx/compositor/render/render_frame.h

Issue 1749063002: Mozart: Improve internal scene graph representation. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-0
Patch Set: avoid unnecessary hashtable lookups 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 #ifndef SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_ 5 #ifndef SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_
6 #define SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_ 6 #define SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "mojo/services/gfx/composition/interfaces/hit_tests.mojom.h"
12 #include "mojo/services/gfx/composition/interfaces/scheduling.mojom.h" 11 #include "mojo/services/gfx/composition/interfaces/scheduling.mojom.h"
12 #include "skia/ext/refptr.h"
13 #include "third_party/skia/include/core/SkRect.h" 13 #include "third_party/skia/include/core/SkRect.h"
14 14
15 class SkCanvas; 15 class SkCanvas;
16 struct SkPoint; 16 class SkPicture;
17 17
18 namespace compositor { 18 namespace compositor {
19 19
20 class RenderLayer; 20 // Describes a frame to be rendered.
21
22 // Describes a sequence of drawing commands to be evaluated as a single pass.
23 // Frames are introduced into the render frame at points where blending must
24 // occur or where portions of a scene graph may be drawn once into a temporary
25 // buffer and used many times.
26 // 21 //
27 // Render objects are thread-safe, immutable, and reference counted via 22 // Render objects are thread-safe, immutable, and reference counted via
28 // std::shared_ptr. They have no direct references to the scene graph. 23 // std::shared_ptr. They have no direct references to the scene graph.
29 class RenderFrame { 24 class RenderFrame {
30 public: 25 public:
31 RenderFrame(const std::shared_ptr<RenderLayer>& root_layer, 26 RenderFrame(const skia::RefPtr<SkPicture>& picture,
32 const SkRect& viewport, 27 const SkRect& viewport,
33 const mojo::gfx::composition::FrameInfo& frame_info); 28 const mojo::gfx::composition::FrameInfo& frame_info);
34 ~RenderFrame(); 29 ~RenderFrame();
35 30
36 static std::shared_ptr<RenderFrame> Create( 31 static std::shared_ptr<RenderFrame> Create(
37 const std::shared_ptr<RenderLayer>& root_layer, 32 const skia::RefPtr<SkPicture>& picture,
38 const SkRect& viewport, 33 const SkRect& viewport,
39 const mojo::gfx::composition::FrameInfo& frame_info) { 34 const mojo::gfx::composition::FrameInfo& frame_info) {
40 return std::make_shared<RenderFrame>(root_layer, viewport, frame_info); 35 return std::make_shared<RenderFrame>(picture, viewport, frame_info);
41 } 36 }
42 37
43 // Gets the root layer of the frame. 38 // Gets the underlying picture to rasterize.
44 const std::shared_ptr<RenderLayer>& root_layer() const { return root_layer_; } 39 const skia::RefPtr<SkPicture>& picture() const { return picture_; }
45 40
46 // Gets the frame's viewport. 41 // Gets the frame's viewport.
47 const SkRect& viewport() const { return viewport_; } 42 const SkRect& viewport() const { return viewport_; }
48 43
49 // Gets information about the frame to be rendered. 44 // Gets information about the frame to be rendered.
50 const mojo::gfx::composition::FrameInfo& frame_info() const { 45 const mojo::gfx::composition::FrameInfo& frame_info() const {
51 return frame_info_; 46 return frame_info_;
52 } 47 }
53 48
54 // Paints the frame to a canvas. 49 // Paints the frame to a canvas.
55 void Paint(SkCanvas* canvas) const; 50 void Paint(SkCanvas* canvas) const;
56 51
57 // Performs a hit test on the content of the frame.
58 mojo::gfx::composition::HitTestResultPtr HitTest(const SkPoint& point) const;
59
60 private: 52 private:
61 friend class RenderFrameBuilder; 53 friend class RenderFrameBuilder;
62 54
63 std::shared_ptr<RenderLayer> root_layer_; 55 skia::RefPtr<SkPicture> picture_;
64 SkRect viewport_; 56 SkRect viewport_;
65 mojo::gfx::composition::FrameInfo frame_info_; 57 mojo::gfx::composition::FrameInfo frame_info_;
66 58
67 DISALLOW_COPY_AND_ASSIGN(RenderFrame); 59 DISALLOW_COPY_AND_ASSIGN(RenderFrame);
68 }; 60 };
69 61
70 } // namespace compositor 62 } // namespace compositor
71 63
72 #endif // SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_ 64 #endif // SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_
OLDNEW
« no previous file with comments | « services/gfx/compositor/graph/snapshot.cc ('k') | services/gfx/compositor/render/render_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698