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

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
« no previous file with comments | « cc/surfaces/surface_aggregator.h ('k') | cc/surfaces/surface_aggregator_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 gfx::Rect 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::Transform quad_to_root_transform(quad_to_target_transform,
306 target_to_root_transform);
307 gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization);
308 bool inverse_valid = quad_to_root_transform.GetInverse(&inverse_transform);
309 DCHECK(inverse_valid);
310
311 return MathUtil::ProjectEnclosingClippedRect(inverse_transform,
312 root_damage_rect);
299 } 313 }
300 314
301 void SurfaceAggregator::CopyQuadsToPass( 315 void SurfaceAggregator::CopyQuadsToPass(
302 const QuadList& source_quad_list, 316 const QuadList& source_quad_list,
303 const SharedQuadStateList& source_shared_quad_state_list, 317 const SharedQuadStateList& source_shared_quad_state_list,
304 const ResourceProvider::ResourceIdMap& child_to_parent_map, 318 const ResourceProvider::ResourceIdMap& child_to_parent_map,
305 const gfx::Transform& target_transform, 319 const gfx::Transform& target_transform,
306 const ClipData& clip_rect, 320 const ClipData& clip_rect,
307 RenderPass* dest_pass, 321 RenderPass* dest_pass,
308 SurfaceId surface_id) { 322 SurfaceId surface_id) {
309 const SharedQuadState* last_copied_source_shared_quad_state = NULL; 323 const SharedQuadState* last_copied_source_shared_quad_state = nullptr;
324 const SharedQuadState* dest_shared_quad_state = nullptr;
325 // If the current frame has copy requests then aggregate the entire
326 // thing, as otherwise parts of the copy requests may be ignored.
327 const bool ignore_undamaged = aggregate_only_damaged_ && !has_copy_requests_;
328 // Damage rect in the quad space of the current shared quad state.
329 // TODO(jbauman): This rect may contain unnecessary area if
330 // transform isn't axis-aligned.
331 gfx::Rect damage_rect_in_quad_space;
310 332
311 SharedQuadStateList::ConstIterator sqs_iter = 333 SharedQuadStateList::ConstIterator sqs_iter =
312 source_shared_quad_state_list.begin(); 334 source_shared_quad_state_list.begin();
313 for (const auto& quad : source_quad_list) { 335 for (const auto& quad : source_quad_list) {
314 while (quad->shared_quad_state != *sqs_iter) { 336 while (quad->shared_quad_state != *sqs_iter) {
315 ++sqs_iter; 337 ++sqs_iter;
316 DCHECK(sqs_iter != source_shared_quad_state_list.end()); 338 DCHECK(sqs_iter != source_shared_quad_state_list.end());
317 } 339 }
318 DCHECK_EQ(quad->shared_quad_state, *sqs_iter); 340 DCHECK_EQ(quad->shared_quad_state, *sqs_iter);
319 341
320 if (quad->material == DrawQuad::SURFACE_CONTENT) { 342 if (quad->material == DrawQuad::SURFACE_CONTENT) {
321 const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad); 343 const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad);
344 // HandleSurfaceQuad may add other shared quad state, so reset the
345 // current data.
346 last_copied_source_shared_quad_state = nullptr;
347
348 if (ignore_undamaged) {
349 gfx::Transform quad_to_target_transform(
350 quad->shared_quad_state->quad_to_target_transform,
351 target_transform);
352 damage_rect_in_quad_space = CalculateQuadSpaceDamageRect(
353 quad_to_target_transform, dest_pass->transform_to_root_target,
354 root_damage_rect_);
355 if (!damage_rect_in_quad_space.Intersects(quad->visible_rect))
356 continue;
357 }
322 HandleSurfaceQuad(surface_quad, target_transform, clip_rect, dest_pass); 358 HandleSurfaceQuad(surface_quad, target_transform, clip_rect, dest_pass);
323 } else { 359 } else {
324 if (quad->shared_quad_state != last_copied_source_shared_quad_state) { 360 if (quad->shared_quad_state != last_copied_source_shared_quad_state) {
325 CopySharedQuadState(quad->shared_quad_state, target_transform, 361 dest_shared_quad_state = CopySharedQuadState(
326 clip_rect, dest_pass); 362 quad->shared_quad_state, target_transform, clip_rect, dest_pass);
327 last_copied_source_shared_quad_state = quad->shared_quad_state; 363 last_copied_source_shared_quad_state = quad->shared_quad_state;
364 if (aggregate_only_damaged_ && !has_copy_requests_) {
365 damage_rect_in_quad_space = CalculateQuadSpaceDamageRect(
366 dest_shared_quad_state->quad_to_target_transform,
367 dest_pass->transform_to_root_target, root_damage_rect_);
368 }
328 } 369 }
370
371 if (ignore_undamaged) {
372 if (!damage_rect_in_quad_space.Intersects(quad->visible_rect))
373 continue;
374 }
375
329 DrawQuad* dest_quad; 376 DrawQuad* dest_quad;
330 if (quad->material == DrawQuad::RENDER_PASS) { 377 if (quad->material == DrawQuad::RENDER_PASS) {
331 const RenderPassDrawQuad* pass_quad = 378 const RenderPassDrawQuad* pass_quad =
332 RenderPassDrawQuad::MaterialCast(quad); 379 RenderPassDrawQuad::MaterialCast(quad);
333 RenderPassId original_pass_id = pass_quad->render_pass_id; 380 RenderPassId original_pass_id = pass_quad->render_pass_id;
334 RenderPassId remapped_pass_id = 381 RenderPassId remapped_pass_id =
335 RemapPassId(original_pass_id, surface_id); 382 RemapPassId(original_pass_id, surface_id);
336 383
337 dest_quad = dest_pass->CopyFromAndAppendRenderPassDrawQuad( 384 dest_quad = dest_pass->CopyFromAndAppendRenderPassDrawQuad(
338 pass_quad, dest_pass->shared_quad_state_list.back(), 385 pass_quad, dest_shared_quad_state, remapped_pass_id);
339 remapped_pass_id);
340 } else { 386 } else {
341 dest_quad = dest_pass->CopyFromAndAppendDrawQuad( 387 dest_quad =
342 quad, dest_pass->shared_quad_state_list.back()); 388 dest_pass->CopyFromAndAppendDrawQuad(quad, dest_shared_quad_state);
343 } 389 }
344 if (!child_to_parent_map.empty()) { 390 if (!child_to_parent_map.empty()) {
345 for (ResourceId& resource_id : dest_quad->resources) { 391 for (ResourceId& resource_id : dest_quad->resources) {
346 ResourceProvider::ResourceIdMap::const_iterator it = 392 ResourceProvider::ResourceIdMap::const_iterator it =
347 child_to_parent_map.find(resource_id); 393 child_to_parent_map.find(resource_id);
348 DCHECK(it != child_to_parent_map.end()); 394 DCHECK(it != child_to_parent_map.end());
349 395
350 DCHECK_EQ(it->first, resource_id); 396 DCHECK_EQ(it->first, resource_id);
351 ResourceId remapped_id = it->second; 397 ResourceId remapped_id = it->second;
352 resource_id = remapped_id; 398 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); 454 surface_id_to_resource_child_id_.erase(it);
409 } 455 }
410 456
411 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first); 457 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first);
412 if (surface_ptr) 458 if (surface_ptr)
413 surface_ptr->RunDrawCallbacks(SurfaceDrawStatus::DRAW_SKIPPED); 459 surface_ptr->RunDrawCallbacks(SurfaceDrawStatus::DRAW_SKIPPED);
414 } 460 }
415 } 461 }
416 } 462 }
417 463
418 // Validate the resources of the current surface and its descendants, and 464 // Walk the Surface tree from surface_id. Validate the resources of the current
419 // calculate their combined damage rect. 465 // surface and its descendants, check if there are any copy requests, and
420 gfx::Rect SurfaceAggregator::ValidateAndCalculateDamageRect( 466 // return the combined damage rect.
421 SurfaceId surface_id) { 467 gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id) {
422 if (referenced_surfaces_.count(surface_id)) 468 if (referenced_surfaces_.count(surface_id))
423 return gfx::Rect(); 469 return gfx::Rect();
424 Surface* surface = manager_->GetSurfaceForId(surface_id); 470 Surface* surface = manager_->GetSurfaceForId(surface_id);
425 if (!surface) 471 if (!surface) {
472 contained_surfaces_[surface_id] = 0;
426 return gfx::Rect(); 473 return gfx::Rect();
474 }
475 contained_surfaces_[surface_id] = surface->frame_index();
427 const CompositorFrame* surface_frame = surface->GetEligibleFrame(); 476 const CompositorFrame* surface_frame = surface->GetEligibleFrame();
428 if (!surface_frame) 477 if (!surface_frame)
429 return gfx::Rect(); 478 return gfx::Rect();
430 const DelegatedFrameData* frame_data = 479 const DelegatedFrameData* frame_data =
431 surface_frame->delegated_frame_data.get(); 480 surface_frame->delegated_frame_data.get();
432 if (!frame_data) 481 if (!frame_data)
433 return gfx::Rect(); 482 return gfx::Rect();
434 int child_id = 0; 483 int child_id = 0;
435 // TODO(jbauman): hack for unit tests that don't set up rp 484 // TODO(jbauman): hack for unit tests that don't set up rp
436 if (provider_) { 485 if (provider_) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 } 534 }
486 } 535 }
487 536
488 if (invalid_frame) 537 if (invalid_frame)
489 return gfx::Rect(); 538 return gfx::Rect();
490 valid_surfaces_.insert(surface->surface_id()); 539 valid_surfaces_.insert(surface->surface_id());
491 540
492 if (provider_) 541 if (provider_)
493 provider_->DeclareUsedResourcesFromChild(child_id, referenced_resources); 542 provider_->DeclareUsedResourcesFromChild(child_id, referenced_resources);
494 543
544 for (const auto& render_pass : frame_data->render_pass_list)
545 has_copy_requests_ |= !render_pass->copy_requests.empty();
546
495 gfx::Rect damage_rect; 547 gfx::Rect damage_rect;
496 if (!frame_data->render_pass_list.empty()) { 548 if (!frame_data->render_pass_list.empty()) {
549 RenderPass* last_pass = frame_data->render_pass_list.back();
497 damage_rect = 550 damage_rect =
498 DamageRectForSurface(surface, *frame_data->render_pass_list.back(), 551 DamageRectForSurface(surface, *last_pass, last_pass->output_rect);
499 frame_data->render_pass_list.back()->output_rect);
500 } 552 }
501 553
502 // Avoid infinite recursion by adding current surface to 554 // Avoid infinite recursion by adding current surface to
503 // referenced_surfaces_. 555 // referenced_surfaces_.
504 SurfaceSet::iterator it = 556 SurfaceSet::iterator it =
505 referenced_surfaces_.insert(surface->surface_id()).first; 557 referenced_surfaces_.insert(surface->surface_id()).first;
506 for (const auto& surface_info : child_surfaces) { 558 for (const auto& surface_info : child_surfaces) {
507 gfx::Rect surface_damage = 559 gfx::Rect surface_damage = PrewalkTree(surface_info.first);
508 ValidateAndCalculateDamageRect(surface_info.first);
509 damage_rect.Union( 560 damage_rect.Union(
510 MathUtil::MapEnclosingClippedRect(surface_info.second, surface_damage)); 561 MathUtil::MapEnclosingClippedRect(surface_info.second, surface_damage));
511 } 562 }
512 referenced_surfaces_.erase(it); 563 referenced_surfaces_.erase(it);
513 return damage_rect; 564 return damage_rect;
514 } 565 }
515 566
516 scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) { 567 scoped_ptr<CompositorFrame> SurfaceAggregator::Aggregate(SurfaceId surface_id) {
517 Surface* surface = manager_->GetSurfaceForId(surface_id); 568 Surface* surface = manager_->GetSurfaceForId(surface_id);
518 DCHECK(surface); 569 DCHECK(surface);
519 contained_surfaces_[surface_id] = surface->frame_index(); 570 contained_surfaces_[surface_id] = surface->frame_index();
520 const CompositorFrame* root_surface_frame = surface->GetEligibleFrame(); 571 const CompositorFrame* root_surface_frame = surface->GetEligibleFrame();
521 if (!root_surface_frame) 572 if (!root_surface_frame)
522 return nullptr; 573 return nullptr;
523 TRACE_EVENT0("cc", "SurfaceAggregator::Aggregate"); 574 TRACE_EVENT0("cc", "SurfaceAggregator::Aggregate");
524 575
525 scoped_ptr<CompositorFrame> frame(new CompositorFrame); 576 scoped_ptr<CompositorFrame> frame(new CompositorFrame);
526 frame->delegated_frame_data = make_scoped_ptr(new DelegatedFrameData); 577 frame->delegated_frame_data = make_scoped_ptr(new DelegatedFrameData);
527 578
528 DCHECK(root_surface_frame->delegated_frame_data); 579 DCHECK(root_surface_frame->delegated_frame_data);
529 580
530 dest_resource_list_ = &frame->delegated_frame_data->resource_list; 581 dest_resource_list_ = &frame->delegated_frame_data->resource_list;
531 dest_pass_list_ = &frame->delegated_frame_data->render_pass_list; 582 dest_pass_list_ = &frame->delegated_frame_data->render_pass_list;
532 583
533 valid_surfaces_.clear(); 584 valid_surfaces_.clear();
534 gfx::Rect damage_rect = ValidateAndCalculateDamageRect(surface_id); 585 has_copy_requests_ = false;
586 root_damage_rect_ = PrewalkTree(surface_id);
535 587
536 SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first; 588 SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first;
537 CopyPasses(root_surface_frame->delegated_frame_data.get(), surface); 589 CopyPasses(root_surface_frame->delegated_frame_data.get(), surface);
538 referenced_surfaces_.erase(it); 590 referenced_surfaces_.erase(it);
539 591
540 DCHECK(referenced_surfaces_.empty()); 592 DCHECK(referenced_surfaces_.empty());
541 593
542 if (dest_pass_list_->empty()) 594 if (dest_pass_list_->empty())
543 return nullptr; 595 return nullptr;
544 dest_pass_list_->back()->damage_rect = damage_rect; 596 dest_pass_list_->back()->damage_rect = root_damage_rect_;
545 597
546 dest_pass_list_ = NULL; 598 dest_pass_list_ = NULL;
547 RemoveUnreferencedChildren(); 599 RemoveUnreferencedChildren();
548 contained_surfaces_.swap(previous_contained_surfaces_); 600 contained_surfaces_.swap(previous_contained_surfaces_);
549 contained_surfaces_.clear(); 601 contained_surfaces_.clear();
550 602
551 for (SurfaceIndexMap::iterator it = previous_contained_surfaces_.begin(); 603 for (SurfaceIndexMap::iterator it = previous_contained_surfaces_.begin();
552 it != previous_contained_surfaces_.end(); 604 it != previous_contained_surfaces_.end();
553 ++it) { 605 ++it) {
554 Surface* surface = manager_->GetSurfaceForId(it->first); 606 Surface* surface = manager_->GetSurfaceForId(it->first);
(...skipping 18 matching lines...) Expand all
573 625
574 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { 626 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) {
575 auto it = previous_contained_surfaces_.find(surface_id); 627 auto it = previous_contained_surfaces_.find(surface_id);
576 if (it == previous_contained_surfaces_.end()) 628 if (it == previous_contained_surfaces_.end())
577 return; 629 return;
578 // Set the last drawn index as 0 to ensure full damage next time it's drawn. 630 // Set the last drawn index as 0 to ensure full damage next time it's drawn.
579 it->second = 0; 631 it->second = 0;
580 } 632 }
581 633
582 } // namespace cc 634 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_aggregator.h ('k') | cc/surfaces/surface_aggregator_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698