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

Side by Side Diff: cc/trees/occlusion_tracker.cc

Issue 381613004: cc: early return if unoccluded_region_in_target_surface is empty (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added same early out in UnoccludedContributingSurfaceContentRect also. Created 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/trees/occlusion_tracker.h" 5 #include "cc/trees/occlusion_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 560
561 // Take the ToEnclosingRect at each step, as we want to contain any unoccluded 561 // Take the ToEnclosingRect at each step, as we want to contain any unoccluded
562 // partial pixels in the resulting Rect. 562 // partial pixels in the resulting Rect.
563 Region unoccluded_region_in_target_surface = 563 Region unoccluded_region_in_target_surface =
564 MathUtil::MapEnclosingClippedRect(draw_transform, content_rect); 564 MathUtil::MapEnclosingClippedRect(draw_transform, content_rect);
565 unoccluded_region_in_target_surface.Subtract( 565 unoccluded_region_in_target_surface.Subtract(
566 stack_.back().occlusion_from_inside_target); 566 stack_.back().occlusion_from_inside_target);
567 unoccluded_region_in_target_surface.Subtract( 567 unoccluded_region_in_target_surface.Subtract(
568 stack_.back().occlusion_from_outside_target); 568 stack_.back().occlusion_from_outside_target);
569 569
570 if (unoccluded_region_in_target_surface.IsEmpty())
571 return gfx::Rect();
572
570 gfx::Rect unoccluded_rect_in_target_surface = 573 gfx::Rect unoccluded_rect_in_target_surface =
571 unoccluded_region_in_target_surface.bounds(); 574 unoccluded_region_in_target_surface.bounds();
572 gfx::Rect unoccluded_rect = MathUtil::ProjectEnclosingClippedRect( 575 gfx::Rect unoccluded_rect = MathUtil::ProjectEnclosingClippedRect(
573 inverse_draw_transform, unoccluded_rect_in_target_surface); 576 inverse_draw_transform, unoccluded_rect_in_target_surface);
574 unoccluded_rect.Intersect(content_rect); 577 unoccluded_rect.Intersect(content_rect);
575 578
576 return unoccluded_rect; 579 return unoccluded_rect;
577 } 580 }
578 581
579 template <typename LayerType> 582 template <typename LayerType>
(...skipping 22 matching lines...) Expand all
602 605
603 // Take the ToEnclosingRect at each step, as we want to contain any unoccluded 606 // Take the ToEnclosingRect at each step, as we want to contain any unoccluded
604 // partial pixels in the resulting Rect. 607 // partial pixels in the resulting Rect.
605 Region unoccluded_region_in_target_surface = 608 Region unoccluded_region_in_target_surface =
606 MathUtil::MapEnclosingClippedRect(draw_transform, content_rect); 609 MathUtil::MapEnclosingClippedRect(draw_transform, content_rect);
607 unoccluded_region_in_target_surface.Subtract( 610 unoccluded_region_in_target_surface.Subtract(
608 second_last.occlusion_from_inside_target); 611 second_last.occlusion_from_inside_target);
609 unoccluded_region_in_target_surface.Subtract( 612 unoccluded_region_in_target_surface.Subtract(
610 second_last.occlusion_from_outside_target); 613 second_last.occlusion_from_outside_target);
611 614
615 if (unoccluded_region_in_target_surface.IsEmpty())
616 return gfx::Rect();
617
612 gfx::Rect unoccluded_rect_in_target_surface = 618 gfx::Rect unoccluded_rect_in_target_surface =
613 unoccluded_region_in_target_surface.bounds(); 619 unoccluded_region_in_target_surface.bounds();
614 gfx::Rect unoccluded_rect = MathUtil::ProjectEnclosingClippedRect( 620 gfx::Rect unoccluded_rect = MathUtil::ProjectEnclosingClippedRect(
615 inverse_draw_transform, unoccluded_rect_in_target_surface); 621 inverse_draw_transform, unoccluded_rect_in_target_surface);
616 unoccluded_rect.Intersect(content_rect); 622 unoccluded_rect.Intersect(content_rect);
617 623
618 return unoccluded_rect; 624 return unoccluded_rect;
619 } 625 }
620 626
621 // Instantiate (and export) templates here for the linker. 627 // Instantiate (and export) templates here for the linker.
622 template class OcclusionTracker<Layer>; 628 template class OcclusionTracker<Layer>;
623 template class OcclusionTracker<LayerImpl>; 629 template class OcclusionTracker<LayerImpl>;
624 630
625 } // namespace cc 631 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698