| 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 return cc_layer_->background_color(); | 666 return cc_layer_->background_color(); |
| 667 } | 667 } |
| 668 | 668 |
| 669 bool Layer::SchedulePaint(const gfx::Rect& invalid_rect) { | 669 bool Layer::SchedulePaint(const gfx::Rect& invalid_rect) { |
| 670 if ((type_ == LAYER_SOLID_COLOR && !texture_layer_.get()) || | 670 if ((type_ == LAYER_SOLID_COLOR && !texture_layer_.get()) || |
| 671 type_ == LAYER_NINE_PATCH || (!delegate_ && !mailbox_.IsValid())) | 671 type_ == LAYER_NINE_PATCH || (!delegate_ && !mailbox_.IsValid())) |
| 672 return false; | 672 return false; |
| 673 | 673 |
| 674 damaged_region_.Union(invalid_rect); | 674 damaged_region_.Union(invalid_rect); |
| 675 ScheduleDraw(); | 675 ScheduleDraw(); |
| 676 |
| 677 if (layer_mask_) { |
| 678 layer_mask_->damaged_region_.Union(invalid_rect); |
| 679 layer_mask_->ScheduleDraw(); |
| 680 } |
| 676 return true; | 681 return true; |
| 677 } | 682 } |
| 678 | 683 |
| 679 void Layer::ScheduleDraw() { | 684 void Layer::ScheduleDraw() { |
| 680 Compositor* compositor = GetCompositor(); | 685 Compositor* compositor = GetCompositor(); |
| 681 if (compositor) | 686 if (compositor) |
| 682 compositor->ScheduleDraw(); | 687 compositor->ScheduleDraw(); |
| 683 } | 688 } |
| 684 | 689 |
| 685 void Layer::SendDamagedRects() { | 690 void Layer::SendDamagedRects() { |
| 686 if (damaged_region_.IsEmpty()) | 691 if (damaged_region_.IsEmpty()) |
| 687 return; | 692 return; |
| 688 if (!delegate_ && !mailbox_.IsValid()) | 693 if (!delegate_ && !mailbox_.IsValid()) |
| 689 return; | 694 return; |
| 690 | 695 |
| 691 for (cc::Region::Iterator iter(damaged_region_); iter.has_rect(); iter.next()) | 696 for (cc::Region::Iterator iter(damaged_region_); iter.has_rect(); iter.next()) |
| 692 cc_layer_->SetNeedsDisplayRect(iter.rect()); | 697 cc_layer_->SetNeedsDisplayRect(iter.rect()); |
| 698 if (layer_mask_) |
| 699 layer_mask_->SendDamagedRects(); |
| 693 | 700 |
| 694 if (content_layer_) | 701 if (content_layer_) |
| 695 paint_region_.Union(damaged_region_); | 702 paint_region_.Union(damaged_region_); |
| 696 damaged_region_.Clear(); | 703 damaged_region_.Clear(); |
| 697 } | 704 } |
| 698 | 705 |
| 699 void Layer::CompleteAllAnimations() { | 706 void Layer::CompleteAllAnimations() { |
| 700 typedef std::vector<scoped_refptr<LayerAnimator> > LayerAnimatorVector; | 707 typedef std::vector<scoped_refptr<LayerAnimator> > LayerAnimatorVector; |
| 701 LayerAnimatorVector animators; | 708 LayerAnimatorVector animators; |
| 702 CollectAnimators(&animators); | 709 CollectAnimators(&animators); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 if (animator_) { | 1058 if (animator_) { |
| 1052 animator_->ResetCompositor(compositor); | 1059 animator_->ResetCompositor(compositor); |
| 1053 animator_->RemoveFromCollection(collection); | 1060 animator_->RemoveFromCollection(collection); |
| 1054 } | 1061 } |
| 1055 | 1062 |
| 1056 for (auto* child : children_) | 1063 for (auto* child : children_) |
| 1057 child->ResetCompositorForAnimatorsInTree(compositor); | 1064 child->ResetCompositorForAnimatorsInTree(compositor); |
| 1058 } | 1065 } |
| 1059 | 1066 |
| 1060 } // namespace ui | 1067 } // namespace ui |
| OLD | NEW |