| 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::ElementId element_id; |
| 621 element_id.id = cc_layer_->id(); |
| 622 cc_layer_->SetElementId(element_id); |
| 621 | 623 |
| 622 SetLayerFilters(); | 624 SetLayerFilters(); |
| 623 SetLayerBackgroundFilters(); | 625 SetLayerBackgroundFilters(); |
| 624 } | 626 } |
| 625 | 627 |
| 626 void Layer::SwitchCCLayerForTest() { | 628 void Layer::SwitchCCLayerForTest() { |
| 627 scoped_refptr<cc::Layer> new_layer = cc::PictureLayer::Create(this); | 629 scoped_refptr<cc::Layer> new_layer = cc::PictureLayer::Create(this); |
| 628 SwitchToLayer(new_layer); | 630 SwitchToLayer(new_layer); |
| 629 content_layer_ = new_layer; | 631 content_layer_ = new_layer; |
| 630 } | 632 } |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 nine_patch_layer_ = cc::NinePatchLayer::Create(); | 1162 nine_patch_layer_ = cc::NinePatchLayer::Create(); |
| 1161 cc_layer_ = nine_patch_layer_.get(); | 1163 cc_layer_ = nine_patch_layer_.get(); |
| 1162 } else { | 1164 } else { |
| 1163 content_layer_ = cc::PictureLayer::Create(this); | 1165 content_layer_ = cc::PictureLayer::Create(this); |
| 1164 cc_layer_ = content_layer_.get(); | 1166 cc_layer_ = content_layer_.get(); |
| 1165 } | 1167 } |
| 1166 cc_layer_->SetTransformOrigin(gfx::Point3F()); | 1168 cc_layer_->SetTransformOrigin(gfx::Point3F()); |
| 1167 cc_layer_->SetContentsOpaque(true); | 1169 cc_layer_->SetContentsOpaque(true); |
| 1168 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); | 1170 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); |
| 1169 cc_layer_->SetLayerClient(this); | 1171 cc_layer_->SetLayerClient(this); |
| 1170 cc_layer_->SetElementId(cc::ElementId(cc_layer_->id(), 0)); | 1172 cc::ElementId element_id; |
| 1173 element_id.id = cc_layer_->id(); |
| 1174 cc_layer_->SetElementId(element_id); |
| 1171 RecomputePosition(); | 1175 RecomputePosition(); |
| 1172 } | 1176 } |
| 1173 | 1177 |
| 1174 gfx::Transform Layer::transform() const { | 1178 gfx::Transform Layer::transform() const { |
| 1175 return cc_layer_->transform(); | 1179 return cc_layer_->transform(); |
| 1176 } | 1180 } |
| 1177 | 1181 |
| 1178 void Layer::RecomputeDrawsContentAndUVRect() { | 1182 void Layer::RecomputeDrawsContentAndUVRect() { |
| 1179 DCHECK(cc_layer_); | 1183 DCHECK(cc_layer_); |
| 1180 gfx::Size size(bounds_.size()); | 1184 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(), | 1231 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), |
| 1228 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { | 1232 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { |
| 1229 return mirror_ptr.get() == mirror; | 1233 return mirror_ptr.get() == mirror; |
| 1230 }); | 1234 }); |
| 1231 | 1235 |
| 1232 DCHECK(it != mirrors_.end()); | 1236 DCHECK(it != mirrors_.end()); |
| 1233 mirrors_.erase(it); | 1237 mirrors_.erase(it); |
| 1234 } | 1238 } |
| 1235 | 1239 |
| 1236 } // namespace ui | 1240 } // namespace ui |
| OLD | NEW |