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

Side by Side Diff: cc/surfaces/surface_aggregator.cc

Issue 1172883004: Don't aggregate quads outside of damage rect when using partial swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@predamage
Patch Set: Created 5 years, 5 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surfaces/surface_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 23 matching lines...) Expand all
34 DCHECK(it->second); 34 DCHECK(it->second);
35 output_requests->push_back(scoped_ptr<CopyOutputRequest>(it->second)); 35 output_requests->push_back(scoped_ptr<CopyOutputRequest>(it->second));
36 it->second = nullptr; 36 it->second = nullptr;
37 } 37 }
38 copy_requests->erase(request_range.first, request_range.second); 38 copy_requests->erase(request_range.first, request_range.second);
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 SurfaceAggregator::SurfaceAggregator(SurfaceManager* manager, 43 SurfaceAggregator::SurfaceAggregator(SurfaceManager* manager,
44 ResourceProvider* provider) 44 ResourceProvider* provider,
45 : manager_(manager), provider_(provider), next_render_pass_id_(1) { 45 bool aggregate_only_damaged)
46 : manager_(manager),
47 provider_(provider),
48 next_render_pass_id_(1),
49 aggregate_only_damaged_(aggregate_only_damaged) {
46 DCHECK(manager_); 50 DCHECK(manager_);
47 } 51 }
48 52
49 SurfaceAggregator::~SurfaceAggregator() {} 53 SurfaceAggregator::~SurfaceAggregator() {}
50 54
51 // Create a clip rect for an aggregated quad from the original clip rect and 55 // Create a clip rect for an aggregated quad from the original clip rect and
52 // the clip rect from the surface it's on. 56 // the clip rect from the surface it's on.
53 SurfaceAggregator::ClipData SurfaceAggregator::CalculateClipRect( 57 SurfaceAggregator::ClipData SurfaceAggregator::CalculateClipRect(
54 const ClipData& surface_clip, 58 const ClipData& surface_clip,
55 const ClipData& quad_clip, 59 const ClipData& quad_clip,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 const SurfaceDrawQuad* surface_quad, 151 const SurfaceDrawQuad* surface_quad,
148 const gfx::Transform& target_transform, 152 const gfx::Transform& target_transform,
149 const ClipData& clip_rect, 153 const ClipData& clip_rect,
150 RenderPass* dest_pass) { 154 RenderPass* dest_pass) {
151 SurfaceId surface_id = surface_quad->surface_id; 155 SurfaceId surface_id = surface_quad->surface_id;
152 // If this surface's id is already in our referenced set then it creates 156 // If this surface's id is already in our referenced set then it creates
153 // a cycle in the graph and should be dropped. 157 // a cycle in the graph and should be dropped.
154 if (referenced_surfaces_.count(surface_id)) 158 if (referenced_surfaces_.count(surface_id))
155 return; 159 return;
156 Surface* surface = manager_->GetSurfaceForId(surface_id); 160 Surface* surface = manager_->GetSurfaceForId(surface_id);
157 if (!surface) { 161 if (!surface)
158 contained_surfaces_[surface_id] = 0;
159 return; 162 return;
160 }
161 contained_surfaces_[surface_id] = surface->frame_index();
162 const CompositorFrame* frame = surface->GetEligibleFrame(); 163 const CompositorFrame* frame = surface->GetEligibleFrame();
163 if (!frame) 164 if (!frame)
164 return; 165 return;
165 const DelegatedFrameData* frame_data = frame->delegated_frame_data.get(); 166 const DelegatedFrameData* frame_data = frame->delegated_frame_data.get();
166 if (!frame_data) 167 if (!frame_data)
167 return; 168 return;
168 169
169 std::multimap<RenderPassId, CopyOutputRequest*> copy_requests; 170 std::multimap<RenderPassId, CopyOutputRequest*> copy_requests;
170 surface->TakeCopyOutputRequests(&copy_requests); 171 surface->TakeCopyOutputRequests(&copy_requests);
171 172
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 245
245 ClipData quads_clip = 246 ClipData quads_clip =
246 CalculateClipRect(clip_rect, surface_quad_clip_rect, target_transform); 247 CalculateClipRect(clip_rect, surface_quad_clip_rect, target_transform);
247 248
248 CopyQuadsToPass(quads, last_pass.shared_quad_state_list, 249 CopyQuadsToPass(quads, last_pass.shared_quad_state_list,
249 child_to_parent_map, surface_transform, quads_clip, 250 child_to_parent_map, surface_transform, quads_clip,
250 dest_pass, surface_id); 251 dest_pass, surface_id);
251 } else { 252 } else {
252 RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id); 253 RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id);
253 254
254 CopySharedQuadState(surface_quad->shared_quad_state, target_transform, 255 SharedQuadState* shared_quad_state =
255 clip_rect, dest_pass); 256 CopySharedQuadState(surface_quad->shared_quad_state, target_transform,
257 clip_rect, dest_pass);
256 258
257 SharedQuadState* shared_quad_state =
258 dest_pass->shared_quad_state_list.back();
259 RenderPassDrawQuad* quad = 259 RenderPassDrawQuad* quad =
260 dest_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); 260 dest_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
261 quad->SetNew(shared_quad_state, 261 quad->SetNew(shared_quad_state,
262 surface_quad->rect, 262 surface_quad->rect,
263 surface_quad->visible_rect, 263 surface_quad->visible_rect,
264 remapped_pass_id, 264 remapped_pass_id,
265 0, 265 0,
266 gfx::Vector2dF(), 266 gfx::Vector2dF(),
267 gfx::Size(), 267 gfx::Size(),
268 FilterOperations(), 268 FilterOperations(),
269 gfx::Vector2dF(), 269 gfx::Vector2dF(),
270 FilterOperations()); 270 FilterOperations());
271 } 271 }
272 272
273
274 referenced_surfaces_.erase(it); 273 referenced_surfaces_.erase(it);
275 } 274 }
276 275
277 void SurfaceAggregator::CopySharedQuadState( 276 SharedQuadState* SurfaceAggregator::CopySharedQuadState(
278 const SharedQuadState* source_sqs, 277 const SharedQuadState* source_sqs,
279 const gfx::Transform& target_transform, 278 const gfx::Transform& target_transform,
280 const ClipData& clip_rect, 279 const ClipData& clip_rect,
281 RenderPass* dest_render_pass) { 280 RenderPass* dest_render_pass) {
282 SharedQuadState* copy_shared_quad_state = 281 SharedQuadState* copy_shared_quad_state =
283 dest_render_pass->CreateAndAppendSharedQuadState(); 282 dest_render_pass->CreateAndAppendSharedQuadState();
284 copy_shared_quad_state->CopyFrom(source_sqs); 283 copy_shared_quad_state->CopyFrom(source_sqs);
285 // target_transform contains any transformation that may exist 284 // target_transform contains any transformation that may exist
286 // between the context that these quads are being copied from (i.e. the 285 // between the context that these quads are being copied from (i.e. the
287 // surface's draw transform when aggregated from within a surface) to the 286 // surface's draw transform when aggregated from within a surface) to the
288 // target space of the pass. This will be identity except when copying the 287 // target space of the pass. This will be identity except when copying the
289 // root draw pass from a surface into a pass when the surface draw quad's 288 // root draw pass from a surface into a pass when the surface draw quad's
290 // transform is not identity. 289 // transform is not identity.
291 copy_shared_quad_state->quad_to_target_transform.ConcatTransform( 290 copy_shared_quad_state->quad_to_target_transform.ConcatTransform(
292 target_transform); 291 target_transform);
293 292
294 ClipData new_clip_rect = CalculateClipRect( 293 ClipData new_clip_rect = CalculateClipRect(
295 clip_rect, ClipData(source_sqs->is_clipped, source_sqs->clip_rect), 294 clip_rect, ClipData(source_sqs->is_clipped, source_sqs->clip_rect),
296 target_transform); 295 target_transform);
297 copy_shared_quad_state->is_clipped = new_clip_rect.is_clipped; 296 copy_shared_quad_state->is_clipped = new_clip_rect.is_clipped;
298 copy_shared_quad_state->clip_rect = new_clip_rect.rect; 297 copy_shared_quad_state->clip_rect = new_clip_rect.rect;
298 return copy_shared_quad_state;
299 }
300
301 static void CalculateQuadSpaceDamageRect(
302 const gfx::Transform& quad_to_target_transform,
303 const gfx::Transform& target_to_root_transform,
304 const gfx::Rect& root_damage_rect,
305 gfx::Rect* quad_damage_rect) {
danakj 2015/07/13 20:15:14 just return this instead of Rect*?
306 gfx::Transform quad_to_root_transform(quad_to_target_transform,
307 target_to_root_transform);
308 gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization);
309 bool inverse_valid = quad_to_root_transform.GetInverse(&inverse_transform);
310 DCHECK(inverse_valid);
311
312 *quad_damage_rect = MathUtil::ProjectEnclosingClippedRect(inverse_transform,
313 root_damage_rect);
299 } 314 }
300 315
301 void SurfaceAggregator::CopyQuadsToPass( 316 void SurfaceAggregator::CopyQuadsToPass(
302 const QuadList& source_quad_list, 317 const QuadList& source_quad_list,
303 const SharedQuadStateList& source_shared_quad_state_list, 318 const SharedQuadStateList& source_shared_quad_state_list,
304 const ResourceProvider::ResourceIdMap& child_to_parent_map, 319 const ResourceProvider::ResourceIdMap& child_to_parent_map,
305 const gfx::Transform& target_transform, 320 const gfx::Transform& target_transform,
306 const ClipData& clip_rect, 321 const ClipData& clip_rect,
307 RenderPass* dest_pass, 322 RenderPass* dest_pass,
308 SurfaceId surface_id) { 323 SurfaceId surface_id) {
309 const SharedQuadState* last_copied_source_shared_quad_state = NULL; 324 const SharedQuadState* last_copied_source_shared_quad_state = NULL;
danakj 2015/07/13 20:15:14 nullptr while youre here?
325 const SharedQuadState* dest_shared_quad_state = nullptr;
326 // Damage rect in the quad space of the current shared quad state, if
327 // the transform from that is invertible.
danakj 2015/07/13 20:15:14 not relevant anymore?
328 // TODO(jbauman): This rect may contain unnecessary area if
329 // transform isn't axis-aligned.
330 gfx::Rect damage_rect_in_quad_space;
310 331
311 SharedQuadStateList::ConstIterator sqs_iter = 332 SharedQuadStateList::ConstIterator sqs_iter =
312 source_shared_quad_state_list.begin(); 333 source_shared_quad_state_list.begin();
313 for (const auto& quad : source_quad_list) { 334 for (const auto& quad : source_quad_list) {
314 while (quad->shared_quad_state != *sqs_iter) { 335 while (quad->shared_quad_state != *sqs_iter) {
315 ++sqs_iter; 336 ++sqs_iter;
316 DCHECK(sqs_iter != source_shared_quad_state_list.end()); 337 DCHECK(sqs_iter != source_shared_quad_state_list.end());
317 } 338 }
318 DCHECK_EQ(quad->shared_quad_state, *sqs_iter); 339 DCHECK_EQ(quad->shared_quad_state, *sqs_iter);
319 340
320 if (quad->material == DrawQuad::SURFACE_CONTENT) { 341 if (quad->material == DrawQuad::SURFACE_CONTENT) {
321 const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad); 342 const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad);
343 // HandleSurfaceQuad may add other shared quad state, so reset the
344 // current data.
345 last_copied_source_shared_quad_state = nullptr;
346
347 // If the current frame has copy requests then aggregate the entire
348 // thing, as otherwise parts of the copy requests may be ignored.
349 if (aggregate_only_damaged_ && !has_copy_requests_) {
danakj 2015/07/13 20:15:14 can you put this in a temp bool at the top of the
350 gfx::Transform quad_to_target_transform(
351 quad->shared_quad_state->quad_to_target_transform,
352 target_transform);
353 CalculateQuadSpaceDamageRect(
354 quad_to_target_transform, dest_pass->transform_to_root_target,
355 root_damage_rect_, &damage_rect_in_quad_space);
356 if (!damage_rect_in_quad_space.Intersects(quad->visible_rect))
357 continue;
358 }
322 HandleSurfaceQuad(surface_quad, target_transform, clip_rect, dest_pass); 359 HandleSurfaceQuad(surface_quad, target_transform, clip_rect, dest_pass);
323 } else { 360 } else {
324 if (quad->shared_quad_state != last_copied_source_shared_quad_state) { 361 if (quad->shared_quad_state != last_copied_source_shared_quad_state) {
325 CopySharedQuadState(quad->shared_quad_state, target_transform, 362 dest_shared_quad_state = CopySharedQuadState(
326 clip_rect, dest_pass); 363 quad->shared_quad_state, target_transform, clip_rect, dest_pass);
327 last_copied_source_shared_quad_state = quad->shared_quad_state; 364 last_copied_source_shared_quad_state = quad->shared_quad_state;
365 if (aggregate_only_damaged_ && !has_copy_requests_) {
366 CalculateQuadSpaceDamageRect(
367 dest_shared_quad_state->quad_to_target_transform,
368 dest_pass->transform_to_root_target, root_damage_rect_,
369 &damage_rect_in_quad_space);
370 }
328 } 371 }
372
373 if (aggregate_only_damaged_ && !has_copy_requests_) {
374 if (!damage_rect_in_quad_space.Intersects(quad->visible_rect))
375 continue;
376 }
377
329 DrawQuad* dest_quad; 378 DrawQuad* dest_quad;
330 if (quad->material == DrawQuad::RENDER_PASS) { 379 if (quad->material == DrawQuad::RENDER_PASS) {
331 const RenderPassDrawQuad* pass_quad = 380 const RenderPassDrawQuad* pass_quad =
332 RenderPassDrawQuad::MaterialCast(quad); 381 RenderPassDrawQuad::MaterialCast(quad);
333 RenderPassId original_pass_id = pass_quad->render_pass_id; 382 RenderPassId original_pass_id = pass_quad->render_pass_id;
334 RenderPassId remapped_pass_id = 383 RenderPassId remapped_pass_id =
335 RemapPassId(original_pass_id, surface_id); 384 RemapPassId(original_pass_id, surface_id);
336 385
337 dest_quad = dest_pass->CopyFromAndAppendRenderPassDrawQuad( 386 dest_quad = dest_pass->CopyFromAndAppendRenderPassDrawQuad(
338 pass_quad, dest_pass->shared_quad_state_list.back(), 387 pass_quad, dest_shared_quad_state, remapped_pass_id);
339 remapped_pass_id);
340 } else { 388 } else {
341 dest_quad = dest_pass->CopyFromAndAppendDrawQuad( 389 dest_quad =
342 quad, dest_pass->shared_quad_state_list.back()); 390 dest_pass->CopyFromAndAppendDrawQuad(quad, dest_shared_quad_state);
343 } 391 }
344 if (!child_to_parent_map.empty()) { 392 if (!child_to_parent_map.empty()) {
345 for (ResourceId& resource_id : dest_quad->resources) { 393 for (ResourceId& resource_id : dest_quad->resources) {
346 ResourceProvider::ResourceIdMap::const_iterator it = 394 ResourceProvider::ResourceIdMap::const_iterator it =
347 child_to_parent_map.find(resource_id); 395 child_to_parent_map.find(resource_id);
348 DCHECK(it != child_to_parent_map.end()); 396 DCHECK(it != child_to_parent_map.end());
349 397
350 DCHECK_EQ(it->first, resource_id); 398 DCHECK_EQ(it->first, resource_id);
351 ResourceId remapped_id = it->second; 399 ResourceId remapped_id = it->second;
352 resource_id = remapped_id; 400 resource_id = remapped_id;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 surface_id_to_resource_child_id_.erase(it); 456 surface_id_to_resource_child_id_.erase(it);
409 } 457 }
410 458
411 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first); 459 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first);
412 if (surface_ptr) 460 if (surface_ptr)
413 surface_ptr->RunDrawCallbacks(SurfaceDrawStatus::DRAW_SKIPPED); 461 surface_ptr->RunDrawCallbacks(SurfaceDrawStatus::DRAW_SKIPPED);
414 } 462 }
415 } 463 }
416 } 464 }
417 465
418 // Validate the resources of the current surface and its descendants, and 466 // Walk the Surface tree from surface_id. Validate the resources of the current
419 // calculate their combined damage rect. 467 // surface and its descendants, check if there are any copy requests, and
420 gfx::Rect SurfaceAggregator::ValidateAndCalculateDamageRect( 468 // return the combined damage rect.
421 SurfaceId surface_id) { 469 gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id) {
422 if (referenced_surfaces_.count(surface_id)) 470 if (referenced_surfaces_.count(surface_id))
423 return gfx::Rect(); 471 return gfx::Rect();
424 Surface* surface = manager_->GetSurfaceForId(surface_id); 472 Surface* surface = manager_->GetSurfaceForId(surface_id);
425 if (!surface) 473 if (!surface) {
474 contained_surfaces_[surface_id] = 0;
426 return gfx::Rect(); 475 return gfx::Rect();
476 }
477 contained_surfaces_[surface_id] = surface->frame_index();
427 const CompositorFrame* surface_frame = surface->GetEligibleFrame(); 478 const CompositorFrame* surface_frame = surface->GetEligibleFrame();
428 if (!surface_frame) 479 if (!surface_frame)
429 return gfx::Rect(); 480 return gfx::Rect();
430 const DelegatedFrameData* frame_data = 481 const DelegatedFrameData* frame_data =
431 surface_frame->delegated_frame_data.get(); 482 surface_frame->delegated_frame_data.get();
432 if (!frame_data) 483 if (!frame_data)
433 return gfx::Rect(); 484 return gfx::Rect();
434 int child_id = 0; 485 int child_id = 0;
435 // TODO(jbauman): hack for unit tests that don't set up rp 486 // TODO(jbauman): hack for unit tests that don't set up rp
436 if (provider_) { 487 if (provider_) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 } 536 }
486 } 537 }
487 538
488 if (invalid_frame) 539 if (invalid_frame)
489 return gfx::Rect(); 540 return gfx::Rect();
490 valid_surfaces_.insert(surface->surface_id()); 541 valid_surfaces_.insert(surface->surface_id());
491 542
492 if (provider_) 543 if (provider_)
493 provider_->DeclareUsedResourcesFromChild(child_id, referenced_resources); 544 provider_->DeclareUsedResourcesFromChild(child_id, referenced_resources);
494 545
546 for (const auto& render_pass : frame_data->render_pass_list)
547 has_copy_requests_ |= !render_pass->copy_requests.empty();
548
495 gfx::Rect damage_rect; 549 gfx::Rect damage_rect;
496 if (!frame_data->render_pass_list.empty()) { 550 if (!frame_data->render_pass_list.empty()) {
551 RenderPass* last_pass = frame_data->render_pass_list.back();
497 damage_rect = 552 damage_rect =
498 DamageRectForSurface(surface, *frame_data->render_pass_list.back(), 553 DamageRectForSurface(surface, *last_pass, last_pass->output_rect);
499 frame_data->render_pass_list.back()->output_rect);
500 } 554 }
501 555
502 // Avoid infinite recursion by adding current surface to 556 // Avoid infinite recursion by adding current surface to
503 // referenced_surfaces_. 557 // referenced_surfaces_.
504 SurfaceSet::iterator it = 558 SurfaceSet::iterator it =
505 referenced_surfaces_.insert(surface->surface_id()).first; 559 referenced_surfaces_.insert(surface->surface_id()).first;
506 for (const auto& surface_info : child_surfaces) { 560 for (const auto& surface_info : child_surfaces) {
507 gfx::Rect surface_damage = 561 gfx::Rect surface_damage = PrewalkTree(surface_info.first);
508 ValidateAndCalculateDamageRect(surface_info.first);
509 damage_rect.Union( 562 damage_rect.Union(
510 MathUtil::MapEnclosingClippedRect(surface_info.second, surface_damage)); 563 MathUtil::MapEnclosingClippedRect(surface_info.second, surface_damage));
511 } 564 }
512 referenced_surfaces_.erase(it); 565 referenced_surfaces_.erase(it);
513 return damage_rect; 566 return damage_rect;
514 } 567 }
515 568
516 scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) { 569 scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) {
517 Surface* surface = manager_->GetSurfaceForId(surface_id); 570 Surface* surface = manager_->GetSurfaceForId(surface_id);
518 DCHECK(surface); 571 DCHECK(surface);
519 contained_surfaces_[surface_id] = surface->frame_index(); 572 contained_surfaces_[surface_id] = surface->frame_index();
520 const CompositorFrame* root_surface_frame = surface->GetEligibleFrame(); 573 const CompositorFrame* root_surface_frame = surface->GetEligibleFrame();
521 if (!root_surface_frame) 574 if (!root_surface_frame)
522 return nullptr; 575 return nullptr;
523 TRACE_EVENT0("cc", "SurfaceAggregator::Aggregate"); 576 TRACE_EVENT0("cc", "SurfaceAggregator::Aggregate");
524 577
525 scoped_ptr<CompositorFrame> frame(new CompositorFrame); 578 scoped_ptr<CompositorFrame> frame(new CompositorFrame);
526 frame->delegated_frame_data = make_scoped_ptr(new DelegatedFrameData); 579 frame->delegated_frame_data = make_scoped_ptr(new DelegatedFrameData);
527 580
528 DCHECK(root_surface_frame->delegated_frame_data); 581 DCHECK(root_surface_frame->delegated_frame_data);
529 582
530 dest_resource_list_ = &frame->delegated_frame_data->resource_list; 583 dest_resource_list_ = &frame->delegated_frame_data->resource_list;
531 dest_pass_list_ = &frame->delegated_frame_data->render_pass_list; 584 dest_pass_list_ = &frame->delegated_frame_data->render_pass_list;
532 585
533 valid_surfaces_.clear(); 586 valid_surfaces_.clear();
534 gfx::Rect damage_rect = ValidateAndCalculateDamageRect(surface_id); 587 has_copy_requests_ = false;
588 root_damage_rect_ = PrewalkTree(surface_id);
535 589
536 SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first; 590 SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first;
537 CopyPasses(root_surface_frame->delegated_frame_data.get(), surface); 591 CopyPasses(root_surface_frame->delegated_frame_data.get(), surface);
538 referenced_surfaces_.erase(it); 592 referenced_surfaces_.erase(it);
539 593
540 DCHECK(referenced_surfaces_.empty()); 594 DCHECK(referenced_surfaces_.empty());
541 595
542 if (dest_pass_list_->empty()) 596 if (dest_pass_list_->empty())
543 return nullptr; 597 return nullptr;
544 dest_pass_list_->back()->damage_rect = damage_rect; 598 dest_pass_list_->back()->damage_rect = root_damage_rect_;
545 599
546 dest_pass_list_ = NULL; 600 dest_pass_list_ = NULL;
547 RemoveUnreferencedChildren(); 601 RemoveUnreferencedChildren();
548 contained_surfaces_.swap(previous_contained_surfaces_); 602 contained_surfaces_.swap(previous_contained_surfaces_);
549 contained_surfaces_.clear(); 603 contained_surfaces_.clear();
550 604
551 for (SurfaceIndexMap::iterator it = previous_contained_surfaces_.begin(); 605 for (SurfaceIndexMap::iterator it = previous_contained_surfaces_.begin();
552 it != previous_contained_surfaces_.end(); 606 it != previous_contained_surfaces_.end();
553 ++it) { 607 ++it) {
554 Surface* surface = manager_->GetSurfaceForId(it->first); 608 Surface* surface = manager_->GetSurfaceForId(it->first);
(...skipping 18 matching lines...) Expand all
573 627
574 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { 628 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) {
575 auto it = previous_contained_surfaces_.find(surface_id); 629 auto it = previous_contained_surfaces_.find(surface_id);
576 if (it == previous_contained_surfaces_.end()) 630 if (it == previous_contained_surfaces_.end())
577 return; 631 return;
578 // Set the last drawn index as 0 to ensure full damage next time it's drawn. 632 // Set the last drawn index as 0 to ensure full damage next time it's drawn.
579 it->second = 0; 633 it->second = 0;
580 } 634 }
581 635
582 } // namespace cc 636 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698