OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 } | 682 } |
683 | 683 |
684 void Layer::SendDamagedRects() { | 684 void Layer::SendDamagedRects() { |
685 if (damaged_region_.IsEmpty()) | 685 if (damaged_region_.IsEmpty()) |
686 return; | 686 return; |
687 if (!delegate_ && !mailbox_.IsValid()) | 687 if (!delegate_ && !mailbox_.IsValid()) |
688 return; | 688 return; |
689 | 689 |
690 for (cc::Region::Iterator iter(damaged_region_); iter.has_rect(); iter.next()) | 690 for (cc::Region::Iterator iter(damaged_region_); iter.has_rect(); iter.next()) |
691 cc_layer_->SetNeedsDisplayRect(iter.rect()); | 691 cc_layer_->SetNeedsDisplayRect(iter.rect()); |
692 } | |
693 | 692 |
694 void Layer::ClearDamagedRects() { | 693 paint_region_.Union(damaged_region_); |
danakj
2016/05/31 19:53:15
Do you think we should union only when it's a pain
| |
695 damaged_region_.Clear(); | 694 damaged_region_.Clear(); |
696 } | 695 } |
697 | 696 |
698 void Layer::CompleteAllAnimations() { | 697 void Layer::CompleteAllAnimations() { |
699 typedef std::vector<scoped_refptr<LayerAnimator> > LayerAnimatorVector; | 698 typedef std::vector<scoped_refptr<LayerAnimator> > LayerAnimatorVector; |
700 LayerAnimatorVector animators; | 699 LayerAnimatorVector animators; |
701 CollectAnimators(&animators); | 700 CollectAnimators(&animators); |
702 for (LayerAnimatorVector::const_iterator it = animators.begin(); | 701 for (LayerAnimatorVector::const_iterator it = animators.begin(); |
703 it != animators.end(); | 702 it != animators.end(); |
704 ++it) { | 703 ++it) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 | 748 |
750 gfx::Rect Layer::PaintableRegion() { | 749 gfx::Rect Layer::PaintableRegion() { |
751 return gfx::Rect(size()); | 750 return gfx::Rect(size()); |
752 } | 751 } |
753 | 752 |
754 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( | 753 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( |
755 ContentLayerClient::PaintingControlSetting painting_control) { | 754 ContentLayerClient::PaintingControlSetting painting_control) { |
756 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); | 755 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); |
757 gfx::Rect local_bounds(bounds().size()); | 756 gfx::Rect local_bounds(bounds().size()); |
758 gfx::Rect invalidation( | 757 gfx::Rect invalidation( |
759 gfx::IntersectRects(damaged_region_.bounds(), local_bounds)); | 758 gfx::IntersectRects(paint_region_.bounds(), local_bounds)); |
760 ClearDamagedRects(); | 759 paint_region_.Clear(); |
761 cc::DisplayItemListSettings settings; | 760 cc::DisplayItemListSettings settings; |
762 settings.use_cached_picture = false; | 761 settings.use_cached_picture = false; |
763 scoped_refptr<cc::DisplayItemList> display_list = | 762 scoped_refptr<cc::DisplayItemList> display_list = |
764 cc::DisplayItemList::Create(PaintableRegion(), settings); | 763 cc::DisplayItemList::Create(PaintableRegion(), settings); |
765 if (delegate_) { | 764 if (delegate_) { |
766 delegate_->OnPaintLayer( | 765 delegate_->OnPaintLayer( |
767 PaintContext(display_list.get(), device_scale_factor_, invalidation)); | 766 PaintContext(display_list.get(), device_scale_factor_, invalidation)); |
768 } | 767 } |
769 display_list->Finalize(); | 768 display_list->Finalize(); |
770 return display_list; | 769 return display_list; |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1049 if (animator_) { | 1048 if (animator_) { |
1050 animator_->ResetCompositor(compositor); | 1049 animator_->ResetCompositor(compositor); |
1051 animator_->RemoveFromCollection(collection); | 1050 animator_->RemoveFromCollection(collection); |
1052 } | 1051 } |
1053 | 1052 |
1054 for (auto* child : children_) | 1053 for (auto* child : children_) |
1055 child->ResetCompositorForAnimatorsInTree(compositor); | 1054 child->ResetCompositorForAnimatorsInTree(compositor); |
1056 } | 1055 } |
1057 | 1056 |
1058 } // namespace ui | 1057 } // namespace ui |
OLD | NEW |