Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Side by Side Diff: ui/compositor/layer.cc

Issue 2083083004: cc: nine patch: add occlusion support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on ToT before commit Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/wm/core/shadow.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 644
645 void Layer::UpdateNinePatchLayerAperture(const gfx::Rect& aperture_in_dip) { 645 void Layer::UpdateNinePatchLayerAperture(const gfx::Rect& aperture_in_dip) {
646 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); 646 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get());
647 nine_patch_layer_aperture_ = aperture_in_dip; 647 nine_patch_layer_aperture_ = aperture_in_dip;
648 gfx::Rect aperture_in_pixel = ConvertRectToPixel(this, aperture_in_dip); 648 gfx::Rect aperture_in_pixel = ConvertRectToPixel(this, aperture_in_dip);
649 nine_patch_layer_->SetAperture(aperture_in_pixel); 649 nine_patch_layer_->SetAperture(aperture_in_pixel);
650 } 650 }
651 651
652 void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) { 652 void Layer::UpdateNinePatchLayerBorder(const gfx::Rect& border) {
653 DCHECK_EQ(type_, LAYER_NINE_PATCH);
654 DCHECK(nine_patch_layer_.get());
655 nine_patch_layer_->SetBorder(border);
656 }
657
658 void Layer::UpdateNinePatchOcclusion(const gfx::Rect& occlusion) {
653 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get()); 659 DCHECK(type_ == LAYER_NINE_PATCH && nine_patch_layer_.get());
654 nine_patch_layer_->SetBorder(border); 660 nine_patch_layer_->SetLayerOcclusion(occlusion);
655 } 661 }
656 662
657 void Layer::SetColor(SkColor color) { GetAnimator()->SetColor(color); } 663 void Layer::SetColor(SkColor color) { GetAnimator()->SetColor(color); }
658 664
659 SkColor Layer::GetTargetColor() { 665 SkColor Layer::GetTargetColor() {
660 if (GetAnimator()->IsAnimatingProperty(LayerAnimationElement::COLOR)) 666 if (GetAnimator()->IsAnimatingProperty(LayerAnimationElement::COLOR))
661 return GetAnimator()->GetTargetColor(); 667 return GetAnimator()->GetTargetColor();
662 return cc_layer_->background_color(); 668 return cc_layer_->background_color();
663 } 669 }
664 670
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 std::find(children_.begin(), children_.end(), child) - children_.begin(); 841 std::find(children_.begin(), children_.end(), child) - children_.begin();
836 const size_t other_i = 842 const size_t other_i =
837 std::find(children_.begin(), children_.end(), other) - children_.begin(); 843 std::find(children_.begin(), children_.end(), other) - children_.begin();
838 if ((above && child_i == other_i + 1) || (!above && child_i + 1 == other_i)) 844 if ((above && child_i == other_i + 1) || (!above && child_i + 1 == other_i))
839 return; 845 return;
840 846
841 const size_t dest_i = 847 const size_t dest_i =
842 above ? 848 above ?
843 (child_i < other_i ? other_i : other_i + 1) : 849 (child_i < other_i ? other_i : other_i + 1) :
844 (child_i < other_i ? other_i - 1 : other_i); 850 (child_i < other_i ? other_i - 1 : other_i);
851
845 children_.erase(children_.begin() + child_i); 852 children_.erase(children_.begin() + child_i);
846 children_.insert(children_.begin() + dest_i, child); 853 children_.insert(children_.begin() + dest_i, child);
847 854
848 child->cc_layer_->RemoveFromParent(); 855 child->cc_layer_->RemoveFromParent();
849 cc_layer_->InsertChild(child->cc_layer_, dest_i); 856 cc_layer_->InsertChild(child->cc_layer_, dest_i);
850 } 857 }
851 858
852 bool Layer::ConvertPointForAncestor(const Layer* ancestor, 859 bool Layer::ConvertPointForAncestor(const Layer* ancestor,
853 gfx::Point* point) const { 860 gfx::Point* point) const {
854 gfx::Transform transform; 861 gfx::Transform transform;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 if (animator_) { 1067 if (animator_) {
1061 animator_->ResetCompositor(compositor); 1068 animator_->ResetCompositor(compositor);
1062 animator_->RemoveFromCollection(collection); 1069 animator_->RemoveFromCollection(collection);
1063 } 1070 }
1064 1071
1065 for (auto* child : children_) 1072 for (auto* child : children_)
1066 child->ResetCompositorForAnimatorsInTree(compositor); 1073 child->ResetCompositorForAnimatorsInTree(compositor);
1067 } 1074 }
1068 1075
1069 } // namespace ui 1076 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/wm/core/shadow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698