| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 } | 703 } |
| 704 } | 704 } |
| 705 | 705 |
| 706 CHECK(debug_weak_this.get()); | 706 CHECK(debug_weak_this.get()); |
| 707 if (surface->factory()) { | 707 if (surface->factory()) { |
| 708 surface->factory()->WillDrawSurface( | 708 surface->factory()->WillDrawSurface( |
| 709 surface->surface_id().local_surface_id(), damage_rect); | 709 surface->surface_id().local_surface_id(), damage_rect); |
| 710 } | 710 } |
| 711 | 711 |
| 712 CHECK(debug_weak_this.get()); | 712 CHECK(debug_weak_this.get()); |
| 713 if (surface->HasRootCopyRequests() && !frame.render_pass_list.empty()) { |
| 714 int remapped_pass_id = |
| 715 RemapPassId(frame.render_pass_list.back()->id, surface_id); |
| 716 copy_request_passes_.insert(remapped_pass_id); |
| 717 } |
| 718 |
| 713 for (const auto& render_pass : frame.render_pass_list) { | 719 for (const auto& render_pass : frame.render_pass_list) { |
| 714 if (!render_pass->copy_requests.empty()) { | 720 if (!render_pass->copy_requests.empty()) { |
| 715 int remapped_pass_id = RemapPassId(render_pass->id, surface_id); | 721 int remapped_pass_id = RemapPassId(render_pass->id, surface_id); |
| 716 copy_request_passes_.insert(remapped_pass_id); | 722 copy_request_passes_.insert(remapped_pass_id); |
| 717 } | 723 } |
| 718 } | 724 } |
| 719 | 725 |
| 720 referenced_surfaces_.erase(it); | 726 referenced_surfaces_.erase(it); |
| 721 if (!damage_rect.IsEmpty() && frame.metadata.may_contain_video) | 727 if (!damage_rect.IsEmpty() && frame.metadata.may_contain_video) |
| 722 result->may_contain_video = true; | 728 result->may_contain_video = true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 733 prewalk_result->undrawn_surfaces.end()); | 739 prewalk_result->undrawn_surfaces.end()); |
| 734 | 740 |
| 735 for (size_t i = 0; i < surfaces_to_copy.size(); i++) { | 741 for (size_t i = 0; i < surfaces_to_copy.size(); i++) { |
| 736 SurfaceId surface_id = surfaces_to_copy[i]; | 742 SurfaceId surface_id = surfaces_to_copy[i]; |
| 737 Surface* surface = manager_->GetSurfaceForId(surface_id); | 743 Surface* surface = manager_->GetSurfaceForId(surface_id); |
| 738 if (!surface) | 744 if (!surface) |
| 739 continue; | 745 continue; |
| 740 if (!surface->HasActiveFrame()) | 746 if (!surface->HasActiveFrame()) |
| 741 continue; | 747 continue; |
| 742 const CompositorFrame& frame = surface->GetActiveFrame(); | 748 const CompositorFrame& frame = surface->GetActiveFrame(); |
| 743 bool surface_has_copy_requests = false; | 749 bool surface_has_copy_requests = surface->HasRootCopyRequests(); |
| 744 for (const auto& render_pass : frame.render_pass_list) { | 750 for (const auto& render_pass : frame.render_pass_list) { |
| 745 surface_has_copy_requests |= !render_pass->copy_requests.empty(); | 751 surface_has_copy_requests |= !render_pass->copy_requests.empty(); |
| 746 } | 752 } |
| 747 if (!surface_has_copy_requests) { | 753 if (!surface_has_copy_requests) { |
| 748 // Children are not necessarily included in undrawn_surfaces (because | 754 // Children are not necessarily included in undrawn_surfaces (because |
| 749 // they weren't referenced directly from a drawn surface), but may have | 755 // they weren't referenced directly from a drawn surface), but may have |
| 750 // copy requests, so make sure to check them as well. | 756 // copy requests, so make sure to check them as well. |
| 751 for (const auto& child_id : frame.metadata.referenced_surfaces) { | 757 for (const auto& child_id : frame.metadata.referenced_surfaces) { |
| 752 // Don't iterate over the child Surface if it was already listed as a | 758 // Don't iterate over the child Surface if it was already listed as a |
| 753 // child of a different Surface, or in the case where there's infinite | 759 // child of a different Surface, or in the case where there's infinite |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 // Set the last drawn index as 0 to ensure full damage next time it's drawn. | 871 // Set the last drawn index as 0 to ensure full damage next time it's drawn. |
| 866 it->second = 0; | 872 it->second = 0; |
| 867 } | 873 } |
| 868 | 874 |
| 869 void SurfaceAggregator::SetOutputColorSpace( | 875 void SurfaceAggregator::SetOutputColorSpace( |
| 870 const gfx::ColorSpace& output_color_space) { | 876 const gfx::ColorSpace& output_color_space) { |
| 871 output_color_space_ = output_color_space; | 877 output_color_space_ = output_color_space; |
| 872 } | 878 } |
| 873 | 879 |
| 874 } // namespace cc | 880 } // namespace cc |
| OLD | NEW |