Chromium Code Reviews| Index: cc/surfaces/surface_aggregator.cc |
| diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc |
| index 05d1070a10305178aa58a100090efb99daa35b8d..7a3cc634aa87e924f62a6c4776b0f1137d57ad71 100644 |
| --- a/cc/surfaces/surface_aggregator.cc |
| +++ b/cc/surfaces/surface_aggregator.cc |
| @@ -225,7 +225,8 @@ void SurfaceAggregator::HandleSurfaceQuad( |
| RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id); |
| copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, |
| - source.transform_to_root_target, |
| + source.transform_to_root_target, source.filters, |
| + source.background_filters, |
| source.has_transparent_background); |
| MoveMatchingRequests(source.id, ©_requests, ©_pass->copy_requests); |
| @@ -294,8 +295,8 @@ void SurfaceAggregator::HandleSurfaceQuad( |
| dest_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
| quad->SetNew(shared_quad_state, surface_quad->rect, |
| surface_quad->visible_rect, remapped_pass_id, 0, |
| - gfx::Vector2dF(), gfx::Size(), FilterOperations(), |
| - gfx::Vector2dF(), gfx::PointF(), FilterOperations()); |
| + gfx::Vector2dF(), gfx::Size(), gfx::Vector2dF(), |
| + gfx::PointF()); |
| } |
| referenced_surfaces_.erase(it); |
| @@ -492,7 +493,8 @@ void SurfaceAggregator::CopyPasses(const CompositorFrame& frame, |
| RemapPassId(source.id, surface->surface_id()); |
| copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, |
| - source.transform_to_root_target, |
| + source.transform_to_root_target, source.filters, |
| + source.background_filters, |
| source.has_transparent_background); |
| CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, |
| @@ -537,7 +539,7 @@ void SurfaceAggregator::ProcessAddedAndRemovedSurfaces() { |
| // surface and its descendants, check if there are any copy requests, and |
| // return the combined damage rect. |
| gfx::Rect SurfaceAggregator::PrewalkTree(const SurfaceId& surface_id, |
| - bool in_moved_pixel_pass, |
| + bool in_moved_pixel_surface, |
| RenderPassId parent_pass, |
| PrewalkResult* result) { |
| // This is for debugging a possible use after free. |
| @@ -579,13 +581,22 @@ gfx::Rect SurfaceAggregator::PrewalkTree(const SurfaceId& surface_id, |
| if (!frame.render_pass_list.empty()) { |
| RenderPassId remapped_pass_id = |
| RemapPassId(frame.render_pass_list.back()->id, surface_id); |
| - if (in_moved_pixel_pass) |
| + if (in_moved_pixel_surface) |
| moved_pixel_passes_.insert(remapped_pass_id); |
| if (parent_pass.IsValid()) |
| render_pass_dependencies_[parent_pass].insert(remapped_pass_id); |
| } |
| struct SurfaceInfo { |
| + SurfaceInfo(const SurfaceId& id, |
| + bool has_moved_pixels, |
| + const RenderPassId& parent_pass, |
| + const gfx::Transform& target_to_surface_transform) |
| + : id(id), |
| + has_moved_pixels(has_moved_pixels), |
| + parent_pass(parent_pass), |
| + target_to_surface_transform(target_to_surface_transform) {} |
| + |
| SurfaceId id; |
| bool has_moved_pixels; |
| RenderPassId parent_pass; |
| @@ -593,8 +604,19 @@ gfx::Rect SurfaceAggregator::PrewalkTree(const SurfaceId& surface_id, |
| }; |
| std::vector<SurfaceInfo> child_surfaces; |
| + std::unordered_set<RenderPassId, RenderPassIdHash> |
| + pixel_moving_background_filter_passes; |
| + for (const auto& render_pass : frame.render_pass_list) { |
| + if (render_pass->background_filters.HasFilterThatMovesPixels()) { |
| + pixel_moving_background_filter_passes.insert( |
| + RemapPassId(render_pass->id, surface_id)); |
| + } |
| + } |
| + |
| for (const auto& render_pass : base::Reversed(frame.render_pass_list)) { |
| RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id); |
| + if (render_pass->filters.HasFilterThatMovesPixels()) |
| + moved_pixel_passes_.insert(remapped_pass_id); |
| bool in_moved_pixel_pass = !!moved_pixel_passes_.count(remapped_pass_id); |
|
danakj
2016/12/14 23:23:57
It could be nice to not force a lookup to happen i
ajuma
2016/12/15 16:49:20
Done.
|
| for (auto* quad : render_pass->quad_list) { |
| if (quad->material == DrawQuad::SURFACE_CONTENT) { |
| @@ -603,18 +625,18 @@ gfx::Rect SurfaceAggregator::PrewalkTree(const SurfaceId& surface_id, |
| gfx::Transform target_to_surface_transform( |
| render_pass->transform_to_root_target, |
| surface_quad->shared_quad_state->quad_to_target_transform); |
| - child_surfaces.push_back( |
| - SurfaceInfo{surface_quad->surface_id, in_moved_pixel_pass, |
| - remapped_pass_id, target_to_surface_transform}); |
| + child_surfaces.emplace_back(surface_quad->surface_id, |
| + in_moved_pixel_pass, remapped_pass_id, |
| + target_to_surface_transform); |
| } else if (quad->material == DrawQuad::RENDER_PASS) { |
| const RenderPassDrawQuad* render_pass_quad = |
| RenderPassDrawQuad::MaterialCast(quad); |
| - if (in_moved_pixel_pass || |
| - render_pass_quad->filters.HasFilterThatMovesPixels()) { |
| + if (in_moved_pixel_pass) { |
| moved_pixel_passes_.insert( |
| RemapPassId(render_pass_quad->render_pass_id, surface_id)); |
| } |
| - if (render_pass_quad->background_filters.HasFilterThatMovesPixels()) { |
| + if (pixel_moving_background_filter_passes.count( |
| + render_pass_quad->render_pass_id)) { |
| in_moved_pixel_pass = true; |
| } |
| render_pass_dependencies_[remapped_pass_id].insert( |