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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 nine_patch_layer_->SetBitmap(bitmap_copy); | 623 nine_patch_layer_->SetBitmap(bitmap_copy); |
624 } | 624 } |
625 | 625 |
626 void Layer::UpdateNinePatchLayerAperture(const gfx::Rect& aperture_in_dip) { | 626 void Layer::UpdateNinePatchLayerAperture(const gfx::Rect& aperture_in_dip) { |
627 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); | 627 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); |
628 nine_patch_layer_aperture_ = aperture_in_dip; | 628 nine_patch_layer_aperture_ = aperture_in_dip; |
629 gfx::Rect aperture_in_pixel = ConvertRectToPixel(this, aperture_in_dip); | 629 gfx::Rect aperture_in_pixel = ConvertRectToPixel(this, aperture_in_dip); |
630 nine_patch_layer_->SetAperture(aperture_in_pixel); | 630 nine_patch_layer_->SetAperture(aperture_in_pixel); |
631 } | 631 } |
632 | 632 |
633 void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) { | 633 void Layer::UpdateNinePatchOcclusion(const gfx::Rect& occlusion) { |
634 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); | 634 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); |
635 nine_patch_layer_->SetBorder(border); | 635 nine_patch_layer_->SetLayerOcclusion(occlusion); |
636 } | 636 } |
637 | 637 |
638 void Layer::SetColor(SkColor color) { GetAnimator()->SetColor(color); } | 638 void Layer::SetColor(SkColor color) { GetAnimator()->SetColor(color); } |
639 | 639 |
640 SkColor Layer::GetTargetColor() { | 640 SkColor Layer::GetTargetColor() { |
641 if (GetAnimator()->IsAnimatingProperty(LayerAnimationElement::COLOR)) | 641 if (GetAnimator()->IsAnimatingProperty(LayerAnimationElement::COLOR)) |
642 return GetAnimator()->GetTargetColor(); | 642 return GetAnimator()->GetTargetColor(); |
643 return cc_layer_->background_color(); | 643 return cc_layer_->background_color(); |
644 } | 644 } |
645 | 645 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 std::find(children_.begin(), children_.end(), child) - children_.begin(); | 815 std::find(children_.begin(), children_.end(), child) - children_.begin(); |
816 const size_t other_i = | 816 const size_t other_i = |
817 std::find(children_.begin(), children_.end(), other) - children_.begin(); | 817 std::find(children_.begin(), children_.end(), other) - children_.begin(); |
818 if ((above && child_i == other_i + 1) || (!above && child_i + 1 == other_i)) | 818 if ((above && child_i == other_i + 1) || (!above && child_i + 1 == other_i)) |
819 return; | 819 return; |
820 | 820 |
821 const size_t dest_i = | 821 const size_t dest_i = |
822 above ? | 822 above ? |
823 (child_i < other_i ? other_i : other_i + 1) : | 823 (child_i < other_i ? other_i : other_i + 1) : |
824 (child_i < other_i ? other_i - 1 : other_i); | 824 (child_i < other_i ? other_i - 1 : other_i); |
| 825 |
825 children_.erase(children_.begin() + child_i); | 826 children_.erase(children_.begin() + child_i); |
826 children_.insert(children_.begin() + dest_i, child); | 827 children_.insert(children_.begin() + dest_i, child); |
827 | 828 |
828 child->cc_layer_->RemoveFromParent(); | 829 child->cc_layer_->RemoveFromParent(); |
829 cc_layer_->InsertChild(child->cc_layer_, dest_i); | 830 cc_layer_->InsertChild(child->cc_layer_, dest_i); |
830 } | 831 } |
831 | 832 |
832 bool Layer::ConvertPointForAncestor(const Layer* ancestor, | 833 bool Layer::ConvertPointForAncestor(const Layer* ancestor, |
833 gfx::Point* point) const { | 834 gfx::Point* point) const { |
834 gfx::Transform transform; | 835 gfx::Transform transform; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 if (animator_) { | 1028 if (animator_) { |
1028 animator_->ResetCompositor(compositor); | 1029 animator_->ResetCompositor(compositor); |
1029 animator_->RemoveFromCollection(collection); | 1030 animator_->RemoveFromCollection(collection); |
1030 } | 1031 } |
1031 | 1032 |
1032 for (auto* child : children_) | 1033 for (auto* child : children_) |
1033 child->ResetCompositorForAnimatorsInTree(compositor); | 1034 child->ResetCompositorForAnimatorsInTree(compositor); |
1034 } | 1035 } |
1035 | 1036 |
1036 } // namespace ui | 1037 } // namespace ui |
OLD | NEW |