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

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

Issue 2543473004: cc: Move filters from RenderPassDrawQuad to RenderPass (Closed)
Patch Set: Created 4 years 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 const RenderPass& source = *referenced_passes[j]; 218 const RenderPass& source = *referenced_passes[j];
219 219
220 size_t sqs_size = source.shared_quad_state_list.size(); 220 size_t sqs_size = source.shared_quad_state_list.size();
221 size_t dq_size = source.quad_list.size(); 221 size_t dq_size = source.quad_list.size();
222 std::unique_ptr<RenderPass> copy_pass( 222 std::unique_ptr<RenderPass> copy_pass(
223 RenderPass::Create(sqs_size, dq_size)); 223 RenderPass::Create(sqs_size, dq_size));
224 224
225 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id); 225 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id);
226 226
227 copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, 227 copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect,
228 source.transform_to_root_target, 228 source.transform_to_root_target, source.filters,
229 source.background_filters,
229 source.has_transparent_background); 230 source.has_transparent_background);
230 231
231 MoveMatchingRequests(source.id, &copy_requests, &copy_pass->copy_requests); 232 MoveMatchingRequests(source.id, &copy_requests, &copy_pass->copy_requests);
232 233
233 // Contributing passes aggregated in to the pass list need to take the 234 // Contributing passes aggregated in to the pass list need to take the
234 // transform of the surface quad into account to update their transform to 235 // transform of the surface quad into account to update their transform to
235 // the root surface. 236 // the root surface.
236 copy_pass->transform_to_root_target.ConcatTransform( 237 copy_pass->transform_to_root_target.ConcatTransform(
237 surface_quad->shared_quad_state->quad_to_target_transform); 238 surface_quad->shared_quad_state->quad_to_target_transform);
238 copy_pass->transform_to_root_target.ConcatTransform(target_transform); 239 copy_pass->transform_to_root_target.ConcatTransform(target_transform);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id); 288 RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id);
288 289
289 SharedQuadState* shared_quad_state = 290 SharedQuadState* shared_quad_state =
290 CopySharedQuadState(surface_quad->shared_quad_state, target_transform, 291 CopySharedQuadState(surface_quad->shared_quad_state, target_transform,
291 clip_rect, dest_pass); 292 clip_rect, dest_pass);
292 293
293 RenderPassDrawQuad* quad = 294 RenderPassDrawQuad* quad =
294 dest_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); 295 dest_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
295 quad->SetNew(shared_quad_state, surface_quad->rect, 296 quad->SetNew(shared_quad_state, surface_quad->rect,
296 surface_quad->visible_rect, remapped_pass_id, 0, 297 surface_quad->visible_rect, remapped_pass_id, 0,
297 gfx::Vector2dF(), gfx::Size(), FilterOperations(), 298 gfx::Vector2dF(), gfx::Size(), gfx::Vector2dF(),
298 gfx::Vector2dF(), gfx::PointF(), FilterOperations()); 299 gfx::PointF());
299 } 300 }
300 301
301 referenced_surfaces_.erase(it); 302 referenced_surfaces_.erase(it);
302 } 303 }
303 304
304 SharedQuadState* SurfaceAggregator::CopySharedQuadState( 305 SharedQuadState* SurfaceAggregator::CopySharedQuadState(
305 const SharedQuadState* source_sqs, 306 const SharedQuadState* source_sqs,
306 const gfx::Transform& target_transform, 307 const gfx::Transform& target_transform,
307 const ClipData& clip_rect, 308 const ClipData& clip_rect,
308 RenderPass* dest_render_pass) { 309 RenderPass* dest_render_pass) {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 size_t dq_size = source.quad_list.size(); 486 size_t dq_size = source.quad_list.size();
486 std::unique_ptr<RenderPass> copy_pass( 487 std::unique_ptr<RenderPass> copy_pass(
487 RenderPass::Create(sqs_size, dq_size)); 488 RenderPass::Create(sqs_size, dq_size));
488 489
489 MoveMatchingRequests(source.id, &copy_requests, &copy_pass->copy_requests); 490 MoveMatchingRequests(source.id, &copy_requests, &copy_pass->copy_requests);
490 491
491 RenderPassId remapped_pass_id = 492 RenderPassId remapped_pass_id =
492 RemapPassId(source.id, surface->surface_id()); 493 RemapPassId(source.id, surface->surface_id());
493 494
494 copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect, 495 copy_pass->SetAll(remapped_pass_id, source.output_rect, source.output_rect,
495 source.transform_to_root_target, 496 source.transform_to_root_target, source.filters,
497 source.background_filters,
496 source.has_transparent_background); 498 source.has_transparent_background);
497 499
498 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, 500 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list,
499 child_to_parent_map, gfx::Transform(), ClipData(), 501 child_to_parent_map, gfx::Transform(), ClipData(),
500 copy_pass.get(), surface->surface_id()); 502 copy_pass.get(), surface->surface_id());
501 if (!copy_request_passes_.count(remapped_pass_id) && 503 if (!copy_request_passes_.count(remapped_pass_id) &&
502 !moved_pixel_passes_.count(remapped_pass_id)) { 504 !moved_pixel_passes_.count(remapped_pass_id)) {
503 gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization); 505 gfx::Transform inverse_transform(gfx::Transform::kSkipInitialization);
504 if (copy_pass->transform_to_root_target.GetInverse(&inverse_transform)) { 506 if (copy_pass->transform_to_root_target.GetInverse(&inverse_transform)) {
505 gfx::Rect damage_rect_in_render_pass_space = 507 gfx::Rect damage_rect_in_render_pass_space =
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 } 588 }
587 589
588 struct SurfaceInfo { 590 struct SurfaceInfo {
589 SurfaceId id; 591 SurfaceId id;
590 bool has_moved_pixels; 592 bool has_moved_pixels;
591 RenderPassId parent_pass; 593 RenderPassId parent_pass;
592 gfx::Transform target_to_surface_transform; 594 gfx::Transform target_to_surface_transform;
593 }; 595 };
594 std::vector<SurfaceInfo> child_surfaces; 596 std::vector<SurfaceInfo> child_surfaces;
595 597
598 std::unordered_set<RenderPassId, RenderPassIdHash> pixel_moving_filter_passes;
599 std::unordered_set<RenderPassId, RenderPassIdHash>
600 pixel_moving_background_filter_passes;
601 for (const auto& render_pass : frame.render_pass_list) {
602 if (render_pass->filters.HasFilterThatMovesPixels()) {
603 pixel_moving_filter_passes.insert(
604 RemapPassId(render_pass->id, surface_id));
jbauman 2016/12/07 01:15:47 I don't think you need this - I think you can just
ajuma 2016/12/13 15:08:11 Done.
605 }
606 if (render_pass->background_filters.HasFilterThatMovesPixels()) {
607 pixel_moving_background_filter_passes.insert(
608 RemapPassId(render_pass->id, surface_id));
609 }
610 }
611
596 for (const auto& render_pass : base::Reversed(frame.render_pass_list)) { 612 for (const auto& render_pass : base::Reversed(frame.render_pass_list)) {
597 RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id); 613 RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id);
598 bool in_moved_pixel_pass = !!moved_pixel_passes_.count(remapped_pass_id); 614 bool in_moved_pixel_pass = !!moved_pixel_passes_.count(remapped_pass_id);
danakj 2016/12/01 01:50:46 This variable shadows the outer one with same name
ajuma 2016/12/13 15:08:11 Renamed the outer one to |in_moved_pixel_surface|.
599 for (auto* quad : render_pass->quad_list) { 615 for (auto* quad : render_pass->quad_list) {
600 if (quad->material == DrawQuad::SURFACE_CONTENT) { 616 if (quad->material == DrawQuad::SURFACE_CONTENT) {
601 const SurfaceDrawQuad* surface_quad = 617 const SurfaceDrawQuad* surface_quad =
602 SurfaceDrawQuad::MaterialCast(quad); 618 SurfaceDrawQuad::MaterialCast(quad);
603 gfx::Transform target_to_surface_transform( 619 gfx::Transform target_to_surface_transform(
604 render_pass->transform_to_root_target, 620 render_pass->transform_to_root_target,
605 surface_quad->shared_quad_state->quad_to_target_transform); 621 surface_quad->shared_quad_state->quad_to_target_transform);
606 child_surfaces.push_back( 622 child_surfaces.push_back(
607 SurfaceInfo{surface_quad->surface_id, in_moved_pixel_pass, 623 SurfaceInfo{surface_quad->surface_id, in_moved_pixel_pass,
danakj 2016/12/01 01:50:46 aside.. this should use () not {} for the construc
ajuma 2016/12/13 15:08:11 Changed to using emplace_back.
danakj 2016/12/14 23:23:57 So uh, I guess that was ok cuz it was struct init
608 remapped_pass_id, target_to_surface_transform}); 624 remapped_pass_id, target_to_surface_transform});
609 } else if (quad->material == DrawQuad::RENDER_PASS) { 625 } else if (quad->material == DrawQuad::RENDER_PASS) {
610 const RenderPassDrawQuad* render_pass_quad = 626 const RenderPassDrawQuad* render_pass_quad =
611 RenderPassDrawQuad::MaterialCast(quad); 627 RenderPassDrawQuad::MaterialCast(quad);
612 if (in_moved_pixel_pass || 628 if (in_moved_pixel_pass ||
613 render_pass_quad->filters.HasFilterThatMovesPixels()) { 629 pixel_moving_filter_passes.count(
danakj 2016/12/01 01:50:46 I think this bit doesn't need to be in per-quad co
ajuma 2016/12/13 15:08:11 Done.
630 render_pass_quad->render_pass_id)) {
614 moved_pixel_passes_.insert( 631 moved_pixel_passes_.insert(
615 RemapPassId(render_pass_quad->render_pass_id, surface_id)); 632 RemapPassId(render_pass_quad->render_pass_id, surface_id));
616 } 633 }
617 if (render_pass_quad->background_filters.HasFilterThatMovesPixels()) { 634 if (pixel_moving_background_filter_passes.count(
635 render_pass_quad->render_pass_id)) {
618 in_moved_pixel_pass = true; 636 in_moved_pixel_pass = true;
619 } 637 }
620 render_pass_dependencies_[remapped_pass_id].insert( 638 render_pass_dependencies_[remapped_pass_id].insert(
621 RemapPassId(render_pass_quad->render_pass_id, surface_id)); 639 RemapPassId(render_pass_quad->render_pass_id, surface_id));
622 } 640 }
623 641
624 if (!provider_) 642 if (!provider_)
625 continue; 643 continue;
626 for (ResourceId resource_id : quad->resources) { 644 for (ResourceId resource_id : quad->resources) {
627 if (!child_to_parent_map.count(resource_id)) { 645 if (!child_to_parent_map.count(resource_id)) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 845
828 void SurfaceAggregator::SetFullDamageForSurface(const SurfaceId& surface_id) { 846 void SurfaceAggregator::SetFullDamageForSurface(const SurfaceId& surface_id) {
829 auto it = previous_contained_surfaces_.find(surface_id); 847 auto it = previous_contained_surfaces_.find(surface_id);
830 if (it == previous_contained_surfaces_.end()) 848 if (it == previous_contained_surfaces_.end())
831 return; 849 return;
832 // Set the last drawn index as 0 to ensure full damage next time it's drawn. 850 // Set the last drawn index as 0 to ensure full damage next time it's drawn.
833 it->second = 0; 851 it->second = 0;
834 } 852 }
835 853
836 } // namespace cc 854 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698