OLD | NEW |
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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "mojo/services/gfx/composition/interfaces/scheduling.mojom.h" | 10 #include "mojo/services/gfx/composition/interfaces/scheduling.mojom.h" |
11 #include "skia/ext/refptr.h" | |
12 #include "third_party/skia/include/core/SkRect.h" | 11 #include "third_party/skia/include/core/SkRect.h" |
| 12 #include "third_party/skia/include/core/SkRefCnt.h" |
13 | 13 |
14 class SkCanvas; | 14 class SkCanvas; |
15 class SkPicture; | 15 class SkPicture; |
16 | 16 |
17 namespace compositor { | 17 namespace compositor { |
18 | 18 |
19 // Describes a frame to be rendered. | 19 // Describes a frame to be rendered. |
20 // | 20 // |
21 // Render objects are thread-safe, immutable, and reference counted. | 21 // Render objects are thread-safe, immutable, and reference counted. |
22 // They have no direct references to the scene graph. | 22 // They have no direct references to the scene graph. |
(...skipping 16 matching lines...) Expand all Loading... |
39 mojo::gfx::composition::FrameInfo frame_info_; | 39 mojo::gfx::composition::FrameInfo frame_info_; |
40 int64_t composition_time_; | 40 int64_t composition_time_; |
41 }; | 41 }; |
42 | 42 |
43 // Creates an empty render frame with no content. | 43 // Creates an empty render frame with no content. |
44 RenderFrame(const Metadata& metadata, const SkIRect& viewport); | 44 RenderFrame(const Metadata& metadata, const SkIRect& viewport); |
45 | 45 |
46 // Creates render frame backed by a picture. | 46 // Creates render frame backed by a picture. |
47 RenderFrame(const Metadata& metadata, | 47 RenderFrame(const Metadata& metadata, |
48 const SkIRect& viewport, | 48 const SkIRect& viewport, |
49 const skia::RefPtr<SkPicture>& picture); | 49 const sk_sp<SkPicture>& picture); |
50 | 50 |
51 // Gets metadata about the frame. | 51 // Gets metadata about the frame. |
52 const Metadata& metadata() const { return metadata_; } | 52 const Metadata& metadata() const { return metadata_; } |
53 | 53 |
54 // Gets the frame's viewport in pixels. | 54 // Gets the frame's viewport in pixels. |
55 const SkIRect& viewport() const { return viewport_; } | 55 const SkIRect& viewport() const { return viewport_; } |
56 | 56 |
57 // Gets the underlying picture to rasterize, or null if the frame is empty. | 57 // Gets the underlying picture to rasterize, or null if the frame is empty. |
58 const skia::RefPtr<SkPicture>& picture() const { return picture_; } | 58 const sk_sp<SkPicture>& picture() const { return picture_; } |
59 | 59 |
60 // Draws the contents of the frame to a canvas. | 60 // Draws the contents of the frame to a canvas. |
61 void Draw(SkCanvas* canvas) const; | 61 void Draw(SkCanvas* canvas) const; |
62 | 62 |
63 private: | 63 private: |
64 friend class base::RefCountedThreadSafe<RenderFrame>; | 64 friend class base::RefCountedThreadSafe<RenderFrame>; |
65 friend class RenderFrameBuilder; | 65 friend class RenderFrameBuilder; |
66 | 66 |
67 ~RenderFrame(); | 67 ~RenderFrame(); |
68 | 68 |
69 Metadata metadata_; | 69 Metadata metadata_; |
70 SkIRect viewport_; | 70 SkIRect viewport_; |
71 skia::RefPtr<SkPicture> picture_; | 71 sk_sp<SkPicture> picture_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(RenderFrame); | 73 DISALLOW_COPY_AND_ASSIGN(RenderFrame); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace compositor | 76 } // namespace compositor |
77 | 77 |
78 #endif // SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_ | 78 #endif // SERVICES_GFX_COMPOSITOR_RENDER_RENDER_FRAME_H_ |
OLD | NEW |