OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_ | |
6 #define SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_ | |
7 | |
8 #include <memory> | |
9 | |
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" | |
13 #include "services/gfx/compositor/render/painting.h" | |
14 #include "third_party/skia/include/core/SkRect.h" | |
15 | |
16 class SkCanvas; | |
17 struct SkPoint; | |
18 | |
19 namespace compositor { | |
20 | |
21 class RenderLayer; | |
22 | |
23 // Describes a sequence of drawing commands to be evaluated as a single pass. | |
24 // Frames are introduced into the render frame at points where blending must | |
25 // occur or where portions of a scene graph may be drawn once into a temporary | |
26 // buffer and used many times. | |
27 // | |
28 // Render objects are thread-safe, immutable, and reference counted via | |
29 // std::shared_ptr. They have no direct references to the scene graph. | |
30 class RenderFrame { | |
31 public: | |
32 RenderFrame(const std::shared_ptr<RenderLayer>& root_layer, | |
33 const SkRect& viewport, | |
34 const mojo::gfx::composition::FrameInfo& frame_info); | |
35 ~RenderFrame(); | |
36 | |
37 static std::shared_ptr<RenderFrame> New( | |
abarth
2016/01/10 22:55:36
We usually call these functions "Create"
jeffbrown
2016/01/16 03:28:32
Done.
| |
38 const std::shared_ptr<RenderLayer>& root_layer, | |
39 const SkRect& viewport, | |
40 const mojo::gfx::composition::FrameInfo& frame_info) { | |
41 return std::make_shared<RenderFrame>(root_layer, viewport, frame_info); | |
42 } | |
43 | |
44 // Gets the root layer of the frame. | |
45 const std::shared_ptr<RenderLayer>& root_layer() const { return root_layer_; } | |
46 | |
47 // Gets the frame's viewport. | |
48 const SkRect& viewport() const { return viewport_; } | |
49 | |
50 // Gets information about the frame to be rendered. | |
51 const mojo::gfx::composition::FrameInfo& frame_info() const { | |
52 return frame_info_; | |
53 } | |
54 | |
55 // Paints the frame to a canvas. | |
56 void Paint(const PaintingScope& painting_scope, SkCanvas* canvas) const; | |
57 | |
58 // Performs a hit test on the content of the frame. | |
59 mojo::gfx::composition::HitTestResultPtr HitTest(const SkPoint& point) const; | |
60 | |
61 private: | |
62 friend class RenderFrameBuilder; | |
63 | |
64 std::shared_ptr<RenderLayer> root_layer_; | |
65 SkRect viewport_; | |
66 mojo::gfx::composition::FrameInfo frame_info_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(RenderFrame); | |
69 }; | |
70 | |
71 } // namespace compositor | |
72 | |
73 #endif // SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_ | |
OLD | NEW |