| OLD | NEW |
| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 copy_pass->transform_to_root_target.ConcatTransform( | 224 copy_pass->transform_to_root_target.ConcatTransform( |
| 225 surface_quad->shared_quad_state->quad_to_target_transform); | 225 surface_quad->shared_quad_state->quad_to_target_transform); |
| 226 copy_pass->transform_to_root_target.ConcatTransform(target_transform); | 226 copy_pass->transform_to_root_target.ConcatTransform(target_transform); |
| 227 copy_pass->transform_to_root_target.ConcatTransform( | 227 copy_pass->transform_to_root_target.ConcatTransform( |
| 228 dest_pass->transform_to_root_target); | 228 dest_pass->transform_to_root_target); |
| 229 | 229 |
| 230 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, | 230 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, |
| 231 child_to_parent_map, gfx::Transform(), ClipData(), | 231 child_to_parent_map, gfx::Transform(), ClipData(), |
| 232 copy_pass.get(), surface_id); | 232 copy_pass.get(), surface_id); |
| 233 | 233 |
| 234 dest_pass_list_->push_back(copy_pass.Pass()); | 234 dest_pass_list_->push_back(std::move(copy_pass)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 gfx::Transform surface_transform = | 237 gfx::Transform surface_transform = |
| 238 surface_quad->shared_quad_state->quad_to_target_transform; | 238 surface_quad->shared_quad_state->quad_to_target_transform; |
| 239 surface_transform.ConcatTransform(target_transform); | 239 surface_transform.ConcatTransform(target_transform); |
| 240 | 240 |
| 241 const RenderPass& last_pass = *render_pass_list.back(); | 241 const RenderPass& last_pass = *render_pass_list.back(); |
| 242 if (merge_pass) { | 242 if (merge_pass) { |
| 243 // TODO(jamesr): Clean up last pass special casing. | 243 // TODO(jamesr): Clean up last pass special casing. |
| 244 const QuadList& quads = last_pass.quad_list; | 244 const QuadList& quads = last_pass.quad_list; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 RemapPassId(source.id, surface->surface_id()); | 450 RemapPassId(source.id, surface->surface_id()); |
| 451 | 451 |
| 452 copy_pass->SetAll(remapped_pass_id, source.output_rect, gfx::Rect(), | 452 copy_pass->SetAll(remapped_pass_id, source.output_rect, gfx::Rect(), |
| 453 source.transform_to_root_target, | 453 source.transform_to_root_target, |
| 454 source.has_transparent_background); | 454 source.has_transparent_background); |
| 455 | 455 |
| 456 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, | 456 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, |
| 457 child_to_parent_map, gfx::Transform(), ClipData(), | 457 child_to_parent_map, gfx::Transform(), ClipData(), |
| 458 copy_pass.get(), surface->surface_id()); | 458 copy_pass.get(), surface->surface_id()); |
| 459 | 459 |
| 460 dest_pass_list_->push_back(copy_pass.Pass()); | 460 dest_pass_list_->push_back(std::move(copy_pass)); |
| 461 } | 461 } |
| 462 } | 462 } |
| 463 | 463 |
| 464 void SurfaceAggregator::ProcessAddedAndRemovedSurfaces() { | 464 void SurfaceAggregator::ProcessAddedAndRemovedSurfaces() { |
| 465 for (const auto& surface : previous_contained_surfaces_) { | 465 for (const auto& surface : previous_contained_surfaces_) { |
| 466 if (!contained_surfaces_.count(surface.first)) { | 466 if (!contained_surfaces_.count(surface.first)) { |
| 467 // Release resources of removed surface. | 467 // Release resources of removed surface. |
| 468 SurfaceToResourceChildIdMap::iterator it = | 468 SurfaceToResourceChildIdMap::iterator it = |
| 469 surface_id_to_resource_child_id_.find(surface.first); | 469 surface_id_to_resource_child_id_.find(surface.first); |
| 470 if (it != surface_id_to_resource_child_id_.end()) { | 470 if (it != surface_id_to_resource_child_id_.end()) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 it != previous_contained_surfaces_.end(); | 634 it != previous_contained_surfaces_.end(); |
| 635 ++it) { | 635 ++it) { |
| 636 Surface* surface = manager_->GetSurfaceForId(it->first); | 636 Surface* surface = manager_->GetSurfaceForId(it->first); |
| 637 if (surface) | 637 if (surface) |
| 638 surface->TakeLatencyInfo(&frame->metadata.latency_info); | 638 surface->TakeLatencyInfo(&frame->metadata.latency_info); |
| 639 } | 639 } |
| 640 | 640 |
| 641 // TODO(jamesr): Aggregate all resource references into the returned frame's | 641 // TODO(jamesr): Aggregate all resource references into the returned frame's |
| 642 // resource list. | 642 // resource list. |
| 643 | 643 |
| 644 return frame.Pass(); | 644 return frame; |
| 645 } | 645 } |
| 646 | 646 |
| 647 void SurfaceAggregator::ReleaseResources(SurfaceId surface_id) { | 647 void SurfaceAggregator::ReleaseResources(SurfaceId surface_id) { |
| 648 SurfaceToResourceChildIdMap::iterator it = | 648 SurfaceToResourceChildIdMap::iterator it = |
| 649 surface_id_to_resource_child_id_.find(surface_id); | 649 surface_id_to_resource_child_id_.find(surface_id); |
| 650 if (it != surface_id_to_resource_child_id_.end()) { | 650 if (it != surface_id_to_resource_child_id_.end()) { |
| 651 provider_->DestroyChild(it->second); | 651 provider_->DestroyChild(it->second); |
| 652 surface_id_to_resource_child_id_.erase(it); | 652 surface_id_to_resource_child_id_.erase(it); |
| 653 } | 653 } |
| 654 } | 654 } |
| 655 | 655 |
| 656 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { | 656 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { |
| 657 auto it = previous_contained_surfaces_.find(surface_id); | 657 auto it = previous_contained_surfaces_.find(surface_id); |
| 658 if (it == previous_contained_surfaces_.end()) | 658 if (it == previous_contained_surfaces_.end()) |
| 659 return; | 659 return; |
| 660 // Set the last drawn index as 0 to ensure full damage next time it's drawn. | 660 // Set the last drawn index as 0 to ensure full damage next time it's drawn. |
| 661 it->second = 0; | 661 it->second = 0; |
| 662 } | 662 } |
| 663 | 663 |
| 664 } // namespace cc | 664 } // namespace cc |
| OLD | NEW |