OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CC_QUADS_RENDER_PASS_H_ | 5 #ifndef CC_QUADS_RENDER_PASS_H_ |
6 #define CC_QUADS_RENDER_PASS_H_ | 6 #define CC_QUADS_RENDER_PASS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 inline ConstBackToFrontIterator BackToFrontBegin() const { return rbegin(); } | 50 inline ConstBackToFrontIterator BackToFrontBegin() const { return rbegin(); } |
51 inline ConstBackToFrontIterator BackToFrontEnd() const { return rend(); } | 51 inline ConstBackToFrontIterator BackToFrontEnd() const { return rend(); } |
52 }; | 52 }; |
53 | 53 |
54 typedef ListContainer<SharedQuadState> SharedQuadStateList; | 54 typedef ListContainer<SharedQuadState> SharedQuadStateList; |
55 | 55 |
56 class CC_EXPORT RenderPass { | 56 class CC_EXPORT RenderPass { |
57 public: | 57 public: |
58 ~RenderPass(); | 58 ~RenderPass(); |
59 | 59 |
60 static scoped_ptr<RenderPass> Create(); | 60 static std::unique_ptr<RenderPass> Create(); |
61 static scoped_ptr<RenderPass> Create(size_t num_layers); | 61 static std::unique_ptr<RenderPass> Create(size_t num_layers); |
62 static scoped_ptr<RenderPass> Create(size_t shared_quad_state_list_size, | 62 static std::unique_ptr<RenderPass> Create(size_t shared_quad_state_list_size, |
63 size_t quad_list_size); | 63 size_t quad_list_size); |
64 | 64 |
65 // A shallow copy of the render pass, which does not include its quads or copy | 65 // A shallow copy of the render pass, which does not include its quads or copy |
66 // requests. | 66 // requests. |
67 scoped_ptr<RenderPass> Copy(RenderPassId new_id) const; | 67 std::unique_ptr<RenderPass> Copy(RenderPassId new_id) const; |
68 | 68 |
69 // A deep copy of the render passes in the list including the quads. | 69 // A deep copy of the render passes in the list including the quads. |
70 static void CopyAll(const std::vector<scoped_ptr<RenderPass>>& in, | 70 static void CopyAll(const std::vector<std::unique_ptr<RenderPass>>& in, |
71 std::vector<scoped_ptr<RenderPass>>* out); | 71 std::vector<std::unique_ptr<RenderPass>>* out); |
72 | 72 |
73 void SetNew(RenderPassId id, | 73 void SetNew(RenderPassId id, |
74 const gfx::Rect& output_rect, | 74 const gfx::Rect& output_rect, |
75 const gfx::Rect& damage_rect, | 75 const gfx::Rect& damage_rect, |
76 const gfx::Transform& transform_to_root_target); | 76 const gfx::Transform& transform_to_root_target); |
77 | 77 |
78 void SetAll(RenderPassId id, | 78 void SetAll(RenderPassId id, |
79 const gfx::Rect& output_rect, | 79 const gfx::Rect& output_rect, |
80 const gfx::Rect& damage_rect, | 80 const gfx::Rect& damage_rect, |
81 const gfx::Transform& transform_to_root_target, | 81 const gfx::Transform& transform_to_root_target, |
(...skipping 26 matching lines...) Expand all Loading... |
108 // render pass' |output_rect|. | 108 // render pass' |output_rect|. |
109 gfx::Transform transform_to_root_target; | 109 gfx::Transform transform_to_root_target; |
110 | 110 |
111 // If false, the pixels in the render pass' texture are all opaque. | 111 // If false, the pixels in the render pass' texture are all opaque. |
112 bool has_transparent_background; | 112 bool has_transparent_background; |
113 | 113 |
114 // If non-empty, the renderer should produce a copy of the render pass' | 114 // If non-empty, the renderer should produce a copy of the render pass' |
115 // contents as a bitmap, and give a copy of the bitmap to each callback in | 115 // contents as a bitmap, and give a copy of the bitmap to each callback in |
116 // this list. This property should not be serialized between compositors, as | 116 // this list. This property should not be serialized between compositors, as |
117 // it only makes sense in the root compositor. | 117 // it only makes sense in the root compositor. |
118 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; | 118 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; |
119 | 119 |
120 QuadList quad_list; | 120 QuadList quad_list; |
121 SharedQuadStateList shared_quad_state_list; | 121 SharedQuadStateList shared_quad_state_list; |
122 | 122 |
123 protected: | 123 protected: |
124 explicit RenderPass(size_t num_layers); | 124 explicit RenderPass(size_t num_layers); |
125 RenderPass(); | 125 RenderPass(); |
126 RenderPass(size_t shared_quad_state_list_size, size_t quad_list_size); | 126 RenderPass(size_t shared_quad_state_list_size, size_t quad_list_size); |
127 | 127 |
128 private: | 128 private: |
129 template <typename DrawQuadType> | 129 template <typename DrawQuadType> |
130 DrawQuadType* CopyFromAndAppendTypedDrawQuad(const DrawQuad* quad) { | 130 DrawQuadType* CopyFromAndAppendTypedDrawQuad(const DrawQuad* quad) { |
131 return quad_list.AllocateAndCopyFrom(DrawQuadType::MaterialCast(quad)); | 131 return quad_list.AllocateAndCopyFrom(DrawQuadType::MaterialCast(quad)); |
132 } | 132 } |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(RenderPass); | 134 DISALLOW_COPY_AND_ASSIGN(RenderPass); |
135 }; | 135 }; |
136 | 136 |
137 using RenderPassList = std::vector<scoped_ptr<RenderPass>>; | 137 using RenderPassList = std::vector<std::unique_ptr<RenderPass>>; |
138 using RenderPassIdHashMap = | 138 using RenderPassIdHashMap = |
139 std::unordered_map<RenderPassId, RenderPass*, RenderPassIdHash>; | 139 std::unordered_map<RenderPassId, RenderPass*, RenderPassIdHash>; |
140 | 140 |
141 } // namespace cc | 141 } // namespace cc |
142 | 142 |
143 #endif // CC_QUADS_RENDER_PASS_H_ | 143 #endif // CC_QUADS_RENDER_PASS_H_ |
OLD | NEW |