| 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 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 451 } |
| 452 | 452 |
| 453 void Layer::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) { | 453 void Layer::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) { |
| 454 // Finish animations being handled by cc_layer_. | 454 // Finish animations being handled by cc_layer_. |
| 455 if (animator_.get()) { | 455 if (animator_.get()) { |
| 456 animator_->StopAnimatingProperty(LayerAnimationElement::TRANSFORM); | 456 animator_->StopAnimatingProperty(LayerAnimationElement::TRANSFORM); |
| 457 animator_->StopAnimatingProperty(LayerAnimationElement::OPACITY); | 457 animator_->StopAnimatingProperty(LayerAnimationElement::OPACITY); |
| 458 } | 458 } |
| 459 | 459 |
| 460 if (texture_layer_.get()) | 460 if (texture_layer_.get()) |
| 461 texture_layer_->WillModifyTexture(); | 461 texture_layer_->ClearClient(); |
| 462 // TODO(piman): delegated_renderer_layer_ cleanup. | 462 // TODO(piman): delegated_renderer_layer_ cleanup. |
| 463 | 463 |
| 464 cc_layer_->RemoveAllChildren(); | 464 cc_layer_->RemoveAllChildren(); |
| 465 if (parent_) { | 465 if (parent_) { |
| 466 DCHECK(parent_->cc_layer_); | 466 DCHECK(parent_->cc_layer_); |
| 467 parent_->cc_layer_->ReplaceChild(cc_layer_, new_layer); | 467 parent_->cc_layer_->ReplaceChild(cc_layer_, new_layer); |
| 468 } | 468 } |
| 469 cc_layer_->SetLayerClient(NULL); | 469 cc_layer_->SetLayerClient(NULL); |
| 470 cc_layer_->RemoveLayerAnimationEventObserver(this); | 470 cc_layer_->RemoveLayerAnimationEventObserver(this); |
| 471 new_layer->SetOpacity(cc_layer_->opacity()); | 471 new_layer->SetOpacity(cc_layer_->opacity()); |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); | 973 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); |
| 974 } | 974 } |
| 975 | 975 |
| 976 void Layer::RecomputePosition() { | 976 void Layer::RecomputePosition() { |
| 977 cc_layer_->SetPosition(gfx::ScalePoint( | 977 cc_layer_->SetPosition(gfx::ScalePoint( |
| 978 gfx::PointF(bounds_.x(), bounds_.y()), | 978 gfx::PointF(bounds_.x(), bounds_.y()), |
| 979 device_scale_factor_)); | 979 device_scale_factor_)); |
| 980 } | 980 } |
| 981 | 981 |
| 982 } // namespace ui | 982 } // namespace ui |
| OLD | NEW |