Chromium Code Reviews| 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 663 bool Layer::ConvertPointFromAncestor(const Layer* ancestor, | 663 bool Layer::ConvertPointFromAncestor(const Layer* ancestor, |
| 664 gfx::Point* point) const { | 664 gfx::Point* point) const { |
| 665 gfx::Transform transform; | 665 gfx::Transform transform; |
| 666 bool result = GetTargetTransformRelativeTo(ancestor, &transform); | 666 bool result = GetTargetTransformRelativeTo(ancestor, &transform); |
| 667 gfx::Point3F p(*point); | 667 gfx::Point3F p(*point); |
| 668 transform.TransformPointReverse(p); | 668 transform.TransformPointReverse(p); |
| 669 *point = gfx::ToFlooredPoint(p.AsPointF()); | 669 *point = gfx::ToFlooredPoint(p.AsPointF()); |
| 670 return result; | 670 return result; |
| 671 } | 671 } |
| 672 | 672 |
| 673 bool Layer::GetTargetTransformRelativeTo(const Layer* ancestor, | 673 bool Layer::GetTargetTransformRelativeTo(const Layer* ancestor, |
|
sky
2013/03/15 03:15:05
Move implementation to match new position in heade
scottmg
2013/03/15 22:23:46
Done.
| |
| 674 gfx::Transform* transform) const { | 674 gfx::Transform* transform) const { |
| 675 const Layer* p = this; | 675 const Layer* p = this; |
| 676 for (; p && p != ancestor; p = p->parent()) { | 676 for (; p && p != ancestor; p = p->parent()) { |
| 677 gfx::Transform translation; | 677 gfx::Transform translation; |
| 678 translation.Translate(static_cast<float>(p->bounds().x()), | 678 translation.Translate(static_cast<float>(p->bounds().x()), |
| 679 static_cast<float>(p->bounds().y())); | 679 static_cast<float>(p->bounds().y())); |
| 680 // Use target transform so that result will be correct once animation is | 680 // Use target transform so that result will be correct once animation is |
| 681 // finished. | 681 // finished. |
| 682 if (!p->GetTargetTransform().IsIdentity()) | 682 if (!p->GetTargetTransform().IsIdentity()) |
| 683 transform->ConcatTransform(p->GetTargetTransform()); | 683 transform->ConcatTransform(p->GetTargetTransform()); |
| 684 transform->ConcatTransform(translation); | 684 transform->ConcatTransform(translation); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 916 texture_layer_->SetUV(uv_top_left, uv_bottom_right); | 916 texture_layer_->SetUV(uv_top_left, uv_bottom_right); |
| 917 } else if (delegated_renderer_layer_.get()) { | 917 } else if (delegated_renderer_layer_.get()) { |
| 918 delegated_renderer_layer_->SetDisplaySize( | 918 delegated_renderer_layer_->SetDisplaySize( |
| 919 ConvertSizeToPixel(this, delegated_frame_size_in_dip_)); | 919 ConvertSizeToPixel(this, delegated_frame_size_in_dip_)); |
| 920 size.ClampToMax(delegated_frame_size_in_dip_); | 920 size.ClampToMax(delegated_frame_size_in_dip_); |
| 921 } | 921 } |
| 922 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); | 922 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); |
| 923 } | 923 } |
| 924 | 924 |
| 925 } // namespace ui | 925 } // namespace ui |
| OLD | NEW |