| 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::UpdateNinePatchOcclusion(const gfx::Rect& occlusion) { | 633 void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) { |
| 634 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); | 634 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); |
| 635 nine_patch_layer_->SetLayerOcclusion(occlusion); | 635 nine_patch_layer_->SetBorder(border); |
| 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 | |
| 826 children_.erase(children_.begin() + child_i); | 825 children_.erase(children_.begin() + child_i); |
| 827 children_.insert(children_.begin() + dest_i, child); | 826 children_.insert(children_.begin() + dest_i, child); |
| 828 | 827 |
| 829 child->cc_layer_->RemoveFromParent(); | 828 child->cc_layer_->RemoveFromParent(); |
| 830 cc_layer_->InsertChild(child->cc_layer_, dest_i); | 829 cc_layer_->InsertChild(child->cc_layer_, dest_i); |
| 831 } | 830 } |
| 832 | 831 |
| 833 bool Layer::ConvertPointForAncestor(const Layer* ancestor, | 832 bool Layer::ConvertPointForAncestor(const Layer* ancestor, |
| 834 gfx::Point* point) const { | 833 gfx::Point* point) const { |
| 835 gfx::Transform transform; | 834 gfx::Transform transform; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 if (animator_) { | 1027 if (animator_) { |
| 1029 animator_->ResetCompositor(compositor); | 1028 animator_->ResetCompositor(compositor); |
| 1030 animator_->RemoveFromCollection(collection); | 1029 animator_->RemoveFromCollection(collection); |
| 1031 } | 1030 } |
| 1032 | 1031 |
| 1033 for (auto* child : children_) | 1032 for (auto* child : children_) |
| 1034 child->ResetCompositorForAnimatorsInTree(compositor); | 1033 child->ResetCompositorForAnimatorsInTree(compositor); |
| 1035 } | 1034 } |
| 1036 | 1035 |
| 1037 } // namespace ui | 1036 } // namespace ui |
| OLD | NEW |