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

Side by Side Diff: cc/quads/render_pass.h

Issue 2543473004: cc: Move filters from RenderPassDrawQuad to RenderPass (Closed)
Patch Set: Address review comments Created 4 years 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 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 "cc/quads/render_pass_id.h" 22 #include "cc/quads/render_pass_id.h"
22 #include "cc/surfaces/surface_id.h" 23 #include "cc/surfaces/surface_id.h"
23 #include "ui/gfx/geometry/rect.h" 24 #include "ui/gfx/geometry/rect.h"
24 #include "ui/gfx/geometry/rect_f.h" 25 #include "ui/gfx/geometry/rect_f.h"
25 #include "ui/gfx/transform.h" 26 #include "ui/gfx/transform.h"
26 27
27 namespace base { 28 namespace base {
28 namespace trace_event { 29 namespace trace_event {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 77
77 void SetNew(RenderPassId id, 78 void SetNew(RenderPassId id,
78 const gfx::Rect& output_rect, 79 const gfx::Rect& output_rect,
79 const gfx::Rect& damage_rect, 80 const gfx::Rect& damage_rect,
80 const gfx::Transform& transform_to_root_target); 81 const gfx::Transform& transform_to_root_target);
81 82
82 void SetAll(RenderPassId id, 83 void SetAll(RenderPassId id,
83 const gfx::Rect& output_rect, 84 const gfx::Rect& output_rect,
84 const gfx::Rect& damage_rect, 85 const gfx::Rect& damage_rect,
85 const gfx::Transform& transform_to_root_target, 86 const gfx::Transform& transform_to_root_target,
87 const FilterOperations& filters,
88 const FilterOperations& background_filters,
86 bool has_transparent_background); 89 bool has_transparent_background);
87 90
88 void AsValueInto(base::trace_event::TracedValue* dict) const; 91 void AsValueInto(base::trace_event::TracedValue* dict) const;
89 92
90 SharedQuadState* CreateAndAppendSharedQuadState(); 93 SharedQuadState* CreateAndAppendSharedQuadState();
91 94
92 template <typename DrawQuadType> 95 template <typename DrawQuadType>
93 DrawQuadType* CreateAndAppendDrawQuad() { 96 DrawQuadType* CreateAndAppendDrawQuad() {
94 return quad_list.AllocateAndConstruct<DrawQuadType>(); 97 return quad_list.AllocateAndConstruct<DrawQuadType>();
95 } 98 }
96 99
97 RenderPassDrawQuad* CopyFromAndAppendRenderPassDrawQuad( 100 RenderPassDrawQuad* CopyFromAndAppendRenderPassDrawQuad(
98 const RenderPassDrawQuad* quad, 101 const RenderPassDrawQuad* quad,
99 const SharedQuadState* shared_quad_state, 102 const SharedQuadState* shared_quad_state,
100 RenderPassId render_pass_id); 103 RenderPassId render_pass_id);
101 DrawQuad* CopyFromAndAppendDrawQuad(const DrawQuad* quad, 104 DrawQuad* CopyFromAndAppendDrawQuad(const DrawQuad* quad,
102 const SharedQuadState* shared_quad_state); 105 const SharedQuadState* shared_quad_state);
103 106
104 // Uniquely identifies the render pass in the compositor's current frame. 107 // Uniquely identifies the render pass in the compositor's current frame.
105 RenderPassId id; 108 RenderPassId id;
106 109
107 // These are in the space of the render pass' physical pixels. 110 // These are in the space of the render pass' physical pixels.
108 gfx::Rect output_rect; 111 gfx::Rect output_rect;
109 gfx::Rect damage_rect; 112 gfx::Rect damage_rect;
110 113
111 // Transforms from the origin of the |output_rect| to the origin of the root 114 // Transforms from the origin of the |output_rect| to the origin of the root
112 // render pass' |output_rect|. 115 // render pass' |output_rect|.
113 gfx::Transform transform_to_root_target; 116 gfx::Transform transform_to_root_target;
114 117
118 // Post-processing filters, applied to the pixels in the render pass' texture.
119 FilterOperations filters;
120
121 // Post-processing filters, applied to the pixels showing through the
122 // background of the render pass, from behind it.
123 FilterOperations background_filters;
124
115 // If false, the pixels in the render pass' texture are all opaque. 125 // If false, the pixels in the render pass' texture are all opaque.
116 bool has_transparent_background; 126 bool has_transparent_background;
117 127
118 // If non-empty, the renderer should produce a copy of the render pass' 128 // If non-empty, the renderer should produce a copy of the render pass'
119 // contents as a bitmap, and give a copy of the bitmap to each callback in 129 // contents as a bitmap, and give a copy of the bitmap to each callback in
120 // this list. This property should not be serialized between compositors, as 130 // this list. This property should not be serialized between compositors, as
121 // it only makes sense in the root compositor. 131 // it only makes sense in the root compositor.
122 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; 132 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests;
123 133
124 QuadList quad_list; 134 QuadList quad_list;
125 SharedQuadStateList shared_quad_state_list; 135 SharedQuadStateList shared_quad_state_list;
126 136
127 protected: 137 protected:
128 explicit RenderPass(size_t num_layers); 138 explicit RenderPass(size_t num_layers);
129 RenderPass(); 139 RenderPass();
130 RenderPass(size_t shared_quad_state_list_size, size_t quad_list_size); 140 RenderPass(size_t shared_quad_state_list_size, size_t quad_list_size);
131 141
132 private: 142 private:
133 template <typename DrawQuadType> 143 template <typename DrawQuadType>
134 DrawQuadType* CopyFromAndAppendTypedDrawQuad(const DrawQuad* quad) { 144 DrawQuadType* CopyFromAndAppendTypedDrawQuad(const DrawQuad* quad) {
135 return quad_list.AllocateAndCopyFrom(DrawQuadType::MaterialCast(quad)); 145 return quad_list.AllocateAndCopyFrom(DrawQuadType::MaterialCast(quad));
136 } 146 }
137 147
138 DISALLOW_COPY_AND_ASSIGN(RenderPass); 148 DISALLOW_COPY_AND_ASSIGN(RenderPass);
139 }; 149 };
140 150
141 using RenderPassList = std::vector<std::unique_ptr<RenderPass>>; 151 using RenderPassList = std::vector<std::unique_ptr<RenderPass>>;
142 using RenderPassIdHashMap = 152 using RenderPassIdHashMap =
143 std::unordered_map<RenderPassId, RenderPass*, RenderPassIdHash>; 153 std::unordered_map<RenderPassId, RenderPass*, RenderPassIdHash>;
154 using RenderPassFilterList =
danakj 2016/12/14 23:23:57 I think we need to either mention here that this i
ajuma 2016/12/15 16:49:20 Added a comment here.
155 std::vector<std::pair<RenderPassId, FilterOperations*>>;
156 class RenderPassFilterListComparator {
157 public:
158 bool operator()(const std::pair<RenderPassId, FilterOperations*>& a,
159 const std::pair<RenderPassId, FilterOperations*>& b) {
160 return a.first < b.first;
161 }
162 };
144 163
145 } // namespace cc 164 } // namespace cc
146 165
147 #endif // CC_QUADS_RENDER_PASS_H_ 166 #endif // CC_QUADS_RENDER_PASS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698