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 if (content_layer_) |
| 694 paint_region_.Union(damaged_region_); |
695 damaged_region_.Clear(); | 695 damaged_region_.Clear(); |
696 } | 696 } |
697 | 697 |
698 void Layer::CompleteAllAnimations() { | 698 void Layer::CompleteAllAnimations() { |
699 typedef std::vector<scoped_refptr<LayerAnimator> > LayerAnimatorVector; | 699 typedef std::vector<scoped_refptr<LayerAnimator> > LayerAnimatorVector; |
700 LayerAnimatorVector animators; | 700 LayerAnimatorVector animators; |
701 CollectAnimators(&animators); | 701 CollectAnimators(&animators); |
702 for (LayerAnimatorVector::const_iterator it = animators.begin(); | 702 for (LayerAnimatorVector::const_iterator it = animators.begin(); |
703 it != animators.end(); | 703 it != animators.end(); |
704 ++it) { | 704 ++it) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 749 |
750 gfx::Rect Layer::PaintableRegion() { | 750 gfx::Rect Layer::PaintableRegion() { |
751 return gfx::Rect(size()); | 751 return gfx::Rect(size()); |
752 } | 752 } |
753 | 753 |
754 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( | 754 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( |
755 ContentLayerClient::PaintingControlSetting painting_control) { | 755 ContentLayerClient::PaintingControlSetting painting_control) { |
756 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); | 756 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); |
757 gfx::Rect local_bounds(bounds().size()); | 757 gfx::Rect local_bounds(bounds().size()); |
758 gfx::Rect invalidation( | 758 gfx::Rect invalidation( |
759 gfx::IntersectRects(damaged_region_.bounds(), local_bounds)); | 759 gfx::IntersectRects(paint_region_.bounds(), local_bounds)); |
760 ClearDamagedRects(); | 760 paint_region_.Clear(); |
761 cc::DisplayItemListSettings settings; | 761 cc::DisplayItemListSettings settings; |
762 settings.use_cached_picture = false; | 762 settings.use_cached_picture = false; |
763 scoped_refptr<cc::DisplayItemList> display_list = | 763 scoped_refptr<cc::DisplayItemList> display_list = |
764 cc::DisplayItemList::Create(PaintableRegion(), settings); | 764 cc::DisplayItemList::Create(PaintableRegion(), settings); |
765 if (delegate_) { | 765 if (delegate_) { |
766 delegate_->OnPaintLayer( | 766 delegate_->OnPaintLayer( |
767 PaintContext(display_list.get(), device_scale_factor_, invalidation)); | 767 PaintContext(display_list.get(), device_scale_factor_, invalidation)); |
768 } | 768 } |
769 display_list->Finalize(); | 769 display_list->Finalize(); |
770 return display_list; | 770 return display_list; |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 if (animator_) { | 1049 if (animator_) { |
1050 animator_->ResetCompositor(compositor); | 1050 animator_->ResetCompositor(compositor); |
1051 animator_->RemoveFromCollection(collection); | 1051 animator_->RemoveFromCollection(collection); |
1052 } | 1052 } |
1053 | 1053 |
1054 for (auto* child : children_) | 1054 for (auto* child : children_) |
1055 child->ResetCompositorForAnimatorsInTree(compositor); | 1055 child->ResetCompositorForAnimatorsInTree(compositor); |
1056 } | 1056 } |
1057 | 1057 |
1058 } // namespace ui | 1058 } // namespace ui |
OLD | NEW |