| 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 610 |
| 611 for (size_t i = 0; i < children_.size(); ++i) { | 611 for (size_t i = 0; i < children_.size(); ++i) { |
| 612 DCHECK(children_[i]->cc_layer_); | 612 DCHECK(children_[i]->cc_layer_); |
| 613 cc_layer_->AddChild(children_[i]->cc_layer_); | 613 cc_layer_->AddChild(children_[i]->cc_layer_); |
| 614 } | 614 } |
| 615 cc_layer_->SetLayerClient(this); | 615 cc_layer_->SetLayerClient(this); |
| 616 cc_layer_->SetTransformOrigin(gfx::Point3F()); | 616 cc_layer_->SetTransformOrigin(gfx::Point3F()); |
| 617 cc_layer_->SetContentsOpaque(fills_bounds_opaquely_); | 617 cc_layer_->SetContentsOpaque(fills_bounds_opaquely_); |
| 618 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); | 618 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); |
| 619 cc_layer_->SetHideLayerAndSubtree(!visible_); | 619 cc_layer_->SetHideLayerAndSubtree(!visible_); |
| 620 cc_layer_->SetElementId(cc::ElementId(cc_layer_->id(), 0)); | 620 cc_layer_->SetElementId(cc::ElementId(cc_layer_->id())); |
| 621 | 621 |
| 622 SetLayerFilters(); | 622 SetLayerFilters(); |
| 623 SetLayerBackgroundFilters(); | 623 SetLayerBackgroundFilters(); |
| 624 } | 624 } |
| 625 | 625 |
| 626 void Layer::SwitchCCLayerForTest() { | 626 void Layer::SwitchCCLayerForTest() { |
| 627 scoped_refptr<cc::Layer> new_layer = cc::PictureLayer::Create(this); | 627 scoped_refptr<cc::Layer> new_layer = cc::PictureLayer::Create(this); |
| 628 SwitchToLayer(new_layer); | 628 SwitchToLayer(new_layer); |
| 629 content_layer_ = new_layer; | 629 content_layer_ = new_layer; |
| 630 } | 630 } |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 nine_patch_layer_ = cc::NinePatchLayer::Create(); | 1160 nine_patch_layer_ = cc::NinePatchLayer::Create(); |
| 1161 cc_layer_ = nine_patch_layer_.get(); | 1161 cc_layer_ = nine_patch_layer_.get(); |
| 1162 } else { | 1162 } else { |
| 1163 content_layer_ = cc::PictureLayer::Create(this); | 1163 content_layer_ = cc::PictureLayer::Create(this); |
| 1164 cc_layer_ = content_layer_.get(); | 1164 cc_layer_ = content_layer_.get(); |
| 1165 } | 1165 } |
| 1166 cc_layer_->SetTransformOrigin(gfx::Point3F()); | 1166 cc_layer_->SetTransformOrigin(gfx::Point3F()); |
| 1167 cc_layer_->SetContentsOpaque(true); | 1167 cc_layer_->SetContentsOpaque(true); |
| 1168 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); | 1168 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); |
| 1169 cc_layer_->SetLayerClient(this); | 1169 cc_layer_->SetLayerClient(this); |
| 1170 cc_layer_->SetElementId(cc::ElementId(cc_layer_->id(), 0)); | 1170 cc_layer_->SetElementId(cc::ElementId(cc_layer_->id())); |
| 1171 RecomputePosition(); | 1171 RecomputePosition(); |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 gfx::Transform Layer::transform() const { | 1174 gfx::Transform Layer::transform() const { |
| 1175 return cc_layer_->transform(); | 1175 return cc_layer_->transform(); |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 void Layer::RecomputeDrawsContentAndUVRect() { | 1178 void Layer::RecomputeDrawsContentAndUVRect() { |
| 1179 DCHECK(cc_layer_); | 1179 DCHECK(cc_layer_); |
| 1180 gfx::Size size(bounds_.size()); | 1180 gfx::Size size(bounds_.size()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), | 1227 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), |
| 1228 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { | 1228 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { |
| 1229 return mirror_ptr.get() == mirror; | 1229 return mirror_ptr.get() == mirror; |
| 1230 }); | 1230 }); |
| 1231 | 1231 |
| 1232 DCHECK(it != mirrors_.end()); | 1232 DCHECK(it != mirrors_.end()); |
| 1233 mirrors_.erase(it); | 1233 mirrors_.erase(it); |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 } // namespace ui | 1236 } // namespace ui |
| OLD | NEW |