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> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/hash.h" | 15 #include "base/hash.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
18 #include "cc/base/list_container.h" | 18 #include "cc/base/list_container.h" |
| 19 #include "cc/output/filter_operations.h" |
19 #include "cc/quads/draw_quad.h" | 20 #include "cc/quads/draw_quad.h" |
20 #include "cc/quads/largest_draw_quad.h" | 21 #include "cc/quads/largest_draw_quad.h" |
21 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
22 #include "ui/gfx/geometry/rect_f.h" | 23 #include "ui/gfx/geometry/rect_f.h" |
23 #include "ui/gfx/transform.h" | 24 #include "ui/gfx/transform.h" |
24 | 25 |
25 namespace base { | 26 namespace base { |
26 namespace trace_event { | 27 namespace trace_event { |
27 class TracedValue; | 28 class TracedValue; |
28 } | 29 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 75 |
75 void SetNew(int id, | 76 void SetNew(int id, |
76 const gfx::Rect& output_rect, | 77 const gfx::Rect& output_rect, |
77 const gfx::Rect& damage_rect, | 78 const gfx::Rect& damage_rect, |
78 const gfx::Transform& transform_to_root_target); | 79 const gfx::Transform& transform_to_root_target); |
79 | 80 |
80 void SetAll(int id, | 81 void SetAll(int id, |
81 const gfx::Rect& output_rect, | 82 const gfx::Rect& output_rect, |
82 const gfx::Rect& damage_rect, | 83 const gfx::Rect& damage_rect, |
83 const gfx::Transform& transform_to_root_target, | 84 const gfx::Transform& transform_to_root_target, |
| 85 const FilterOperations& filters, |
| 86 const FilterOperations& background_filters, |
84 bool has_transparent_background); | 87 bool has_transparent_background); |
85 | 88 |
86 void AsValueInto(base::trace_event::TracedValue* dict) const; | 89 void AsValueInto(base::trace_event::TracedValue* dict) const; |
87 | 90 |
88 SharedQuadState* CreateAndAppendSharedQuadState(); | 91 SharedQuadState* CreateAndAppendSharedQuadState(); |
89 | 92 |
90 template <typename DrawQuadType> | 93 template <typename DrawQuadType> |
91 DrawQuadType* CreateAndAppendDrawQuad() { | 94 DrawQuadType* CreateAndAppendDrawQuad() { |
92 return quad_list.AllocateAndConstruct<DrawQuadType>(); | 95 return quad_list.AllocateAndConstruct<DrawQuadType>(); |
93 } | 96 } |
94 | 97 |
95 RenderPassDrawQuad* CopyFromAndAppendRenderPassDrawQuad( | 98 RenderPassDrawQuad* CopyFromAndAppendRenderPassDrawQuad( |
96 const RenderPassDrawQuad* quad, | 99 const RenderPassDrawQuad* quad, |
97 const SharedQuadState* shared_quad_state, | 100 const SharedQuadState* shared_quad_state, |
98 int render_pass_id); | 101 int render_pass_id); |
99 DrawQuad* CopyFromAndAppendDrawQuad(const DrawQuad* quad, | 102 DrawQuad* CopyFromAndAppendDrawQuad(const DrawQuad* quad, |
100 const SharedQuadState* shared_quad_state); | 103 const SharedQuadState* shared_quad_state); |
101 | 104 |
102 // Uniquely identifies the render pass in the compositor's current frame. | 105 // Uniquely identifies the render pass in the compositor's current frame. |
103 int id = 0; | 106 int id = 0; |
104 | 107 |
105 // These are in the space of the render pass' physical pixels. | 108 // These are in the space of the render pass' physical pixels. |
106 gfx::Rect output_rect; | 109 gfx::Rect output_rect; |
107 gfx::Rect damage_rect; | 110 gfx::Rect damage_rect; |
108 | 111 |
109 // Transforms from the origin of the |output_rect| to the origin of the root | 112 // Transforms from the origin of the |output_rect| to the origin of the root |
110 // render pass' |output_rect|. | 113 // render pass' |output_rect|. |
111 gfx::Transform transform_to_root_target; | 114 gfx::Transform transform_to_root_target; |
112 | 115 |
| 116 // Post-processing filters, applied to the pixels in the render pass' texture. |
| 117 FilterOperations filters; |
| 118 |
| 119 // Post-processing filters, applied to the pixels showing through the |
| 120 // background of the render pass, from behind it. |
| 121 FilterOperations background_filters; |
| 122 |
113 // If false, the pixels in the render pass' texture are all opaque. | 123 // If false, the pixels in the render pass' texture are all opaque. |
114 bool has_transparent_background = true; | 124 bool has_transparent_background = true; |
115 | 125 |
116 // If non-empty, the renderer should produce a copy of the render pass' | 126 // If non-empty, the renderer should produce a copy of the render pass' |
117 // contents as a bitmap, and give a copy of the bitmap to each callback in | 127 // contents as a bitmap, and give a copy of the bitmap to each callback in |
118 // this list. This property should not be serialized between compositors, as | 128 // this list. This property should not be serialized between compositors, as |
119 // it only makes sense in the root compositor. | 129 // it only makes sense in the root compositor. |
120 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; | 130 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; |
121 | 131 |
122 QuadList quad_list; | 132 QuadList quad_list; |
123 SharedQuadStateList shared_quad_state_list; | 133 SharedQuadStateList shared_quad_state_list; |
124 | 134 |
125 protected: | 135 protected: |
126 explicit RenderPass(size_t num_layers); | 136 explicit RenderPass(size_t num_layers); |
127 RenderPass(); | 137 RenderPass(); |
128 RenderPass(size_t shared_quad_state_list_size, size_t quad_list_size); | 138 RenderPass(size_t shared_quad_state_list_size, size_t quad_list_size); |
129 | 139 |
130 private: | 140 private: |
131 template <typename DrawQuadType> | 141 template <typename DrawQuadType> |
132 DrawQuadType* CopyFromAndAppendTypedDrawQuad(const DrawQuad* quad) { | 142 DrawQuadType* CopyFromAndAppendTypedDrawQuad(const DrawQuad* quad) { |
133 return quad_list.AllocateAndCopyFrom(DrawQuadType::MaterialCast(quad)); | 143 return quad_list.AllocateAndCopyFrom(DrawQuadType::MaterialCast(quad)); |
134 } | 144 } |
135 | 145 |
136 DISALLOW_COPY_AND_ASSIGN(RenderPass); | 146 DISALLOW_COPY_AND_ASSIGN(RenderPass); |
137 }; | 147 }; |
138 | 148 |
139 using RenderPassList = std::vector<std::unique_ptr<RenderPass>>; | 149 using RenderPassList = std::vector<std::unique_ptr<RenderPass>>; |
140 | 150 |
| 151 // List of pairs of render pass id and filter, sorted by render pass id so that |
| 152 // it can be searched using std::lower_bound. |
| 153 using RenderPassFilterList = std::vector<std::pair<int, FilterOperations*>>; |
| 154 |
141 } // namespace cc | 155 } // namespace cc |
142 | 156 |
143 #endif // CC_QUADS_RENDER_PASS_H_ | 157 #endif // CC_QUADS_RENDER_PASS_H_ |
OLD | NEW |