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

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

Issue 2543473004: cc: Move filters from RenderPassDrawQuad to RenderPass (Closed)
Patch Set: 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 #include "cc/quads/render_pass.h" 5 #include "cc/quads/render_pass.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 RenderPass::~RenderPass() { 85 RenderPass::~RenderPass() {
86 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 86 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
87 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"), 87 TRACE_DISABLED_BY_DEFAULT("cc.debug.quads"),
88 "cc::RenderPass", id.AsTracingId()); 88 "cc::RenderPass", id.AsTracingId());
89 } 89 }
90 90
91 std::unique_ptr<RenderPass> RenderPass::Copy(RenderPassId new_id) const { 91 std::unique_ptr<RenderPass> RenderPass::Copy(RenderPassId new_id) const {
92 std::unique_ptr<RenderPass> copy_pass( 92 std::unique_ptr<RenderPass> copy_pass(
93 Create(shared_quad_state_list.size(), quad_list.size())); 93 Create(shared_quad_state_list.size(), quad_list.size()));
94 copy_pass->SetAll(new_id, 94 copy_pass->SetAll(new_id, output_rect, damage_rect, transform_to_root_target,
95 output_rect, 95 filters, background_filters, has_transparent_background);
96 damage_rect,
97 transform_to_root_target,
98 has_transparent_background);
99 return copy_pass; 96 return copy_pass;
100 } 97 }
101 98
102 std::unique_ptr<RenderPass> RenderPass::DeepCopy() const { 99 std::unique_ptr<RenderPass> RenderPass::DeepCopy() const {
103 // Since we can't copy these, it's wrong to use DeepCopy in a situation where 100 // Since we can't copy these, it's wrong to use DeepCopy in a situation where
104 // you may have copy_requests present. 101 // you may have copy_requests present.
105 DCHECK_EQ(copy_requests.size(), 0u); 102 DCHECK_EQ(copy_requests.size(), 0u);
106 103
107 std::unique_ptr<RenderPass> copy_pass( 104 std::unique_ptr<RenderPass> copy_pass(
108 Create(shared_quad_state_list.size(), quad_list.size())); 105 Create(shared_quad_state_list.size(), quad_list.size()));
109 copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target, 106 copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target,
110 has_transparent_background); 107 filters, background_filters, has_transparent_background);
111 for (auto* shared_quad_state : shared_quad_state_list) { 108 for (auto* shared_quad_state : shared_quad_state_list) {
112 SharedQuadState* copy_shared_quad_state = 109 SharedQuadState* copy_shared_quad_state =
113 copy_pass->CreateAndAppendSharedQuadState(); 110 copy_pass->CreateAndAppendSharedQuadState();
114 *copy_shared_quad_state = *shared_quad_state; 111 *copy_shared_quad_state = *shared_quad_state;
115 } 112 }
116 SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin(); 113 SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin();
117 SharedQuadStateList::Iterator copy_sqs_iter = 114 SharedQuadStateList::Iterator copy_sqs_iter =
118 copy_pass->shared_quad_state_list.begin(); 115 copy_pass->shared_quad_state_list.begin();
119 for (auto* quad : quad_list) { 116 for (auto* quad : quad_list) {
120 while (quad->shared_quad_state != *sqs_iter) { 117 while (quad->shared_quad_state != *sqs_iter) {
(...skipping 20 matching lines...) Expand all
141 // static 138 // static
142 void RenderPass::CopyAll(const std::vector<std::unique_ptr<RenderPass>>& in, 139 void RenderPass::CopyAll(const std::vector<std::unique_ptr<RenderPass>>& in,
143 std::vector<std::unique_ptr<RenderPass>>* out) { 140 std::vector<std::unique_ptr<RenderPass>>* out) {
144 for (const auto& source : in) 141 for (const auto& source : in)
145 out->push_back(source->DeepCopy()); 142 out->push_back(source->DeepCopy());
146 } 143 }
147 144
148 void RenderPass::SetNew(RenderPassId id, 145 void RenderPass::SetNew(RenderPassId id,
149 const gfx::Rect& output_rect, 146 const gfx::Rect& output_rect,
150 const gfx::Rect& damage_rect, 147 const gfx::Rect& damage_rect,
151 const gfx::Transform& transform_to_root_target) { 148 const gfx::Transform& transform_to_root_target,
149 const FilterOperations& filters,
150 const FilterOperations& background_filters) {
152 DCHECK(id.IsValid()); 151 DCHECK(id.IsValid());
153 DCHECK(damage_rect.IsEmpty() || output_rect.Contains(damage_rect)) 152 DCHECK(damage_rect.IsEmpty() || output_rect.Contains(damage_rect))
154 << "damage_rect: " << damage_rect.ToString() 153 << "damage_rect: " << damage_rect.ToString()
155 << " output_rect: " << output_rect.ToString(); 154 << " output_rect: " << output_rect.ToString();
156 155
157 this->id = id; 156 this->id = id;
158 this->output_rect = output_rect; 157 this->output_rect = output_rect;
159 this->damage_rect = damage_rect; 158 this->damage_rect = damage_rect;
160 this->transform_to_root_target = transform_to_root_target; 159 this->transform_to_root_target = transform_to_root_target;
160 this->filters = filters;
161 this->background_filters = background_filters;
161 162
162 DCHECK(quad_list.empty()); 163 DCHECK(quad_list.empty());
163 DCHECK(shared_quad_state_list.empty()); 164 DCHECK(shared_quad_state_list.empty());
164 } 165 }
165 166
166 void RenderPass::SetAll(RenderPassId id, 167 void RenderPass::SetAll(RenderPassId id,
167 const gfx::Rect& output_rect, 168 const gfx::Rect& output_rect,
168 const gfx::Rect& damage_rect, 169 const gfx::Rect& damage_rect,
169 const gfx::Transform& transform_to_root_target, 170 const gfx::Transform& transform_to_root_target,
171 const FilterOperations& filters,
172 const FilterOperations& background_filters,
170 bool has_transparent_background) { 173 bool has_transparent_background) {
171 DCHECK(id.IsValid()); 174 DCHECK(id.IsValid());
172 175
173 this->id = id; 176 this->id = id;
174 this->output_rect = output_rect; 177 this->output_rect = output_rect;
175 this->damage_rect = damage_rect; 178 this->damage_rect = damage_rect;
176 this->transform_to_root_target = transform_to_root_target; 179 this->transform_to_root_target = transform_to_root_target;
180 this->filters = filters;
181 this->background_filters = background_filters;
177 this->has_transparent_background = has_transparent_background; 182 this->has_transparent_background = has_transparent_background;
178 183
179 DCHECK(quad_list.empty()); 184 DCHECK(quad_list.empty());
180 DCHECK(shared_quad_state_list.empty()); 185 DCHECK(shared_quad_state_list.empty());
181 } 186 }
182 187
183 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const { 188 void RenderPass::AsValueInto(base::trace_event::TracedValue* value) const {
184 MathUtil::AddToTracedValue("output_rect", output_rect, value); 189 MathUtil::AddToTracedValue("output_rect", output_rect, value);
185 MathUtil::AddToTracedValue("damage_rect", damage_rect, value); 190 MathUtil::AddToTracedValue("damage_rect", damage_rect, value);
186 191
187 value->SetBoolean("has_transparent_background", has_transparent_background); 192 value->SetBoolean("has_transparent_background", has_transparent_background);
188 value->SetInteger("copy_requests", 193 value->SetInteger("copy_requests",
189 base::saturated_cast<int>(copy_requests.size())); 194 base::saturated_cast<int>(copy_requests.size()));
190 195
196 value->BeginArray("filters");
197 filters.AsValueInto(value);
198 value->EndArray();
199
200 value->BeginArray("background_filters");
201 background_filters.AsValueInto(value);
202 value->EndArray();
203
191 value->BeginArray("shared_quad_state_list"); 204 value->BeginArray("shared_quad_state_list");
192 for (auto* shared_quad_state : shared_quad_state_list) { 205 for (auto* shared_quad_state : shared_quad_state_list) {
193 value->BeginDictionary(); 206 value->BeginDictionary();
194 shared_quad_state->AsValueInto(value); 207 shared_quad_state->AsValueInto(value);
195 value->EndDictionary(); 208 value->EndDictionary();
196 } 209 }
197 value->EndArray(); 210 value->EndArray();
198 211
199 value->BeginArray("quad_list"); 212 value->BeginArray("quad_list");
200 for (auto* quad : quad_list) { 213 for (auto* quad : quad_list) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 case DrawQuad::RENDER_PASS: 271 case DrawQuad::RENDER_PASS:
259 case DrawQuad::INVALID: 272 case DrawQuad::INVALID:
260 LOG(FATAL) << "Invalid DrawQuad material " << quad->material; 273 LOG(FATAL) << "Invalid DrawQuad material " << quad->material;
261 break; 274 break;
262 } 275 }
263 quad_list.back()->shared_quad_state = shared_quad_state; 276 quad_list.back()->shared_quad_state = shared_quad_state;
264 return quad_list.back(); 277 return quad_list.back();
265 } 278 }
266 279
267 } // namespace cc 280 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698