OLD | NEW |
---|---|
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 Loading... | |
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()) | |
danakj
2014/07/14 15:14:53
ProjectEnclosingClippedRect and Intersect both hav
hyunki
2014/07/14 15:29:34
I think Intersect have early out.
However, when I
danakj
2014/07/14 16:00:08
Oh, right sorry. Ok sounds good, does this have an
hyunki
2014/07/14 16:25:09
When I added logs, I've checked it falls early out
danakj
2014/07/14 16:26:02
It's not testing this case, so I would expect no c
| |
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 21 matching lines...) Expand all Loading... | |
601 return content_rect; | 604 return content_rect; |
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 |
danakj
2014/07/14 16:00:08
How about here?
hyunki
2014/07/14 16:25:09
Done.
| |
612 gfx::Rect unoccluded_rect_in_target_surface = | 615 gfx::Rect unoccluded_rect_in_target_surface = |
613 unoccluded_region_in_target_surface.bounds(); | 616 unoccluded_region_in_target_surface.bounds(); |
614 gfx::Rect unoccluded_rect = MathUtil::ProjectEnclosingClippedRect( | 617 gfx::Rect unoccluded_rect = MathUtil::ProjectEnclosingClippedRect( |
615 inverse_draw_transform, unoccluded_rect_in_target_surface); | 618 inverse_draw_transform, unoccluded_rect_in_target_surface); |
616 unoccluded_rect.Intersect(content_rect); | 619 unoccluded_rect.Intersect(content_rect); |
617 | 620 |
618 return unoccluded_rect; | 621 return unoccluded_rect; |
619 } | 622 } |
620 | 623 |
621 // Instantiate (and export) templates here for the linker. | 624 // Instantiate (and export) templates here for the linker. |
622 template class OcclusionTracker<Layer>; | 625 template class OcclusionTracker<Layer>; |
623 template class OcclusionTracker<LayerImpl>; | 626 template class OcclusionTracker<LayerImpl>; |
624 | 627 |
625 } // namespace cc | 628 } // namespace cc |
OLD | NEW |