| 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 } | 665 } |
| 666 | 666 |
| 667 void Layer::SendDamagedRects() { | 667 void Layer::SendDamagedRects() { |
| 668 if (damaged_region_.IsEmpty()) | 668 if (damaged_region_.IsEmpty()) |
| 669 return; | 669 return; |
| 670 if (!delegate_ && !mailbox_.IsValid()) | 670 if (!delegate_ && !mailbox_.IsValid()) |
| 671 return; | 671 return; |
| 672 | 672 |
| 673 for (cc::Region::Iterator iter(damaged_region_); iter.has_rect(); iter.next()) | 673 for (cc::Region::Iterator iter(damaged_region_); iter.has_rect(); iter.next()) |
| 674 cc_layer_->SetNeedsDisplayRect(iter.rect()); | 674 cc_layer_->SetNeedsDisplayRect(iter.rect()); |
| 675 } | |
| 676 | 675 |
| 677 void Layer::ClearDamagedRects() { | 676 if (content_layer_) |
| 677 paint_region_.Union(damaged_region_); |
| 678 damaged_region_.Clear(); | 678 damaged_region_.Clear(); |
| 679 } | 679 } |
| 680 | 680 |
| 681 void Layer::CompleteAllAnimations() { | 681 void Layer::CompleteAllAnimations() { |
| 682 typedef std::vector<scoped_refptr<LayerAnimator> > LayerAnimatorVector; | 682 typedef std::vector<scoped_refptr<LayerAnimator> > LayerAnimatorVector; |
| 683 LayerAnimatorVector animators; | 683 LayerAnimatorVector animators; |
| 684 CollectAnimators(&animators); | 684 CollectAnimators(&animators); |
| 685 for (LayerAnimatorVector::const_iterator it = animators.begin(); | 685 for (LayerAnimatorVector::const_iterator it = animators.begin(); |
| 686 it != animators.end(); | 686 it != animators.end(); |
| 687 ++it) { | 687 ++it) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 | 732 |
| 733 gfx::Rect Layer::PaintableRegion() { | 733 gfx::Rect Layer::PaintableRegion() { |
| 734 return gfx::Rect(size()); | 734 return gfx::Rect(size()); |
| 735 } | 735 } |
| 736 | 736 |
| 737 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( | 737 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( |
| 738 ContentLayerClient::PaintingControlSetting painting_control) { | 738 ContentLayerClient::PaintingControlSetting painting_control) { |
| 739 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); | 739 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); |
| 740 gfx::Rect local_bounds(bounds().size()); | 740 gfx::Rect local_bounds(bounds().size()); |
| 741 gfx::Rect invalidation( | 741 gfx::Rect invalidation( |
| 742 gfx::IntersectRects(damaged_region_.bounds(), local_bounds)); | 742 gfx::IntersectRects(paint_region_.bounds(), local_bounds)); |
| 743 ClearDamagedRects(); | 743 paint_region_.Clear(); |
| 744 cc::DisplayItemListSettings settings; | 744 cc::DisplayItemListSettings settings; |
| 745 settings.use_cached_picture = false; | 745 settings.use_cached_picture = false; |
| 746 scoped_refptr<cc::DisplayItemList> display_list = | 746 scoped_refptr<cc::DisplayItemList> display_list = |
| 747 cc::DisplayItemList::Create(PaintableRegion(), settings); | 747 cc::DisplayItemList::Create(PaintableRegion(), settings); |
| 748 if (delegate_) { | 748 if (delegate_) { |
| 749 delegate_->OnPaintLayer( | 749 delegate_->OnPaintLayer( |
| 750 PaintContext(display_list.get(), device_scale_factor_, invalidation)); | 750 PaintContext(display_list.get(), device_scale_factor_, invalidation)); |
| 751 } | 751 } |
| 752 display_list->Finalize(); | 752 display_list->Finalize(); |
| 753 return display_list; | 753 return display_list; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 if (animator_) { | 1020 if (animator_) { |
| 1021 animator_->ResetCompositor(compositor); | 1021 animator_->ResetCompositor(compositor); |
| 1022 animator_->RemoveFromCollection(collection); | 1022 animator_->RemoveFromCollection(collection); |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 for (auto* child : children_) | 1025 for (auto* child : children_) |
| 1026 child->ResetCompositorForAnimatorsInTree(compositor); | 1026 child->ResetCompositorForAnimatorsInTree(compositor); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 } // namespace ui | 1029 } // namespace ui |
| OLD | NEW |