Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/layers/layer.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1621 // Changing the transform may change the visible part of this layer, so a new | 1621 // Changing the transform may change the visible part of this layer, so a new |
| 1622 // recording may be needed. | 1622 // recording may be needed. |
| 1623 SetNeedsUpdate(); | 1623 SetNeedsUpdate(); |
| 1624 if (layer_tree_host_) { | 1624 if (layer_tree_host_) { |
| 1625 if (TransformNode* node = | 1625 if (TransformNode* node = |
| 1626 layer_tree_host_->property_trees()->transform_tree.Node( | 1626 layer_tree_host_->property_trees()->transform_tree.Node( |
| 1627 transform_tree_index())) { | 1627 transform_tree_index())) { |
| 1628 if (node->owner_id == id()) { | 1628 if (node->owner_id == id()) { |
| 1629 node->data.local = transform; | 1629 node->data.local = transform; |
| 1630 node->data.needs_local_transform_update = true; | 1630 node->data.needs_local_transform_update = true; |
| 1631 node->data.is_animated = true; | 1631 node->data.has_potential_animation = true; |
| 1632 layer_tree_host_->property_trees()->transform_tree.set_needs_update( | 1632 layer_tree_host_->property_trees()->transform_tree.set_needs_update( |
| 1633 true); | 1633 true); |
| 1634 } | 1634 } |
| 1635 } | 1635 } |
| 1636 } | 1636 } |
| 1637 } | 1637 } |
| 1638 | 1638 |
| 1639 void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { | 1639 void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { |
| 1640 // Do nothing. Scroll deltas will be sent from the compositor thread back | 1640 // Do nothing. Scroll deltas will be sent from the compositor thread back |
| 1641 // to the main thread in the same manner as during non-animated | 1641 // to the main thread in the same manner as during non-animated |
| 1642 // compositor-driven scrolling. | 1642 // compositor-driven scrolling. |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 void Layer::OnTransformIsPotentiallyAnimatingChanged(bool is_animating) { | 1645 void Layer::OnTransformIsCurrentlyAnimatingChanged( |
| 1646 bool is_currently_animating) { | |
| 1647 DCHECK(layer_tree_host_); | |
| 1648 TransformTree& transform_tree = | |
| 1649 layer_tree_host_->property_trees()->transform_tree; | |
| 1650 TransformNode* node = transform_tree.Node(transform_tree_index()); | |
| 1651 if (!node) | |
| 1652 return; | |
| 1653 | |
| 1654 if (node->owner_id == id()) | |
|
jaydasika
2016/05/18 00:57:23
I will make this use the map in a follow up. My pl
| |
| 1655 node->data.is_currently_animating = is_currently_animating; | |
| 1656 } | |
| 1657 | |
| 1658 void Layer::OnTransformIsPotentiallyAnimatingChanged( | |
| 1659 bool has_potential_animation) { | |
| 1646 if (!layer_tree_host_) | 1660 if (!layer_tree_host_) |
| 1647 return; | 1661 return; |
| 1648 TransformTree& transform_tree = | 1662 TransformTree& transform_tree = |
| 1649 layer_tree_host_->property_trees()->transform_tree; | 1663 layer_tree_host_->property_trees()->transform_tree; |
| 1650 TransformNode* node = transform_tree.Node(transform_tree_index()); | 1664 TransformNode* node = transform_tree.Node(transform_tree_index()); |
| 1651 if (!node) | 1665 if (!node) |
| 1652 return; | 1666 return; |
| 1653 | 1667 |
| 1654 if (node->owner_id == id()) { | 1668 if (node->owner_id == id()) { |
| 1655 node->data.is_animated = is_animating; | 1669 node->data.has_potential_animation = has_potential_animation; |
| 1656 if (is_animating) { | 1670 if (has_potential_animation) { |
| 1657 float maximum_target_scale = 0.f; | 1671 float maximum_target_scale = 0.f; |
| 1658 node->data.local_maximum_animation_target_scale = | 1672 node->data.local_maximum_animation_target_scale = |
| 1659 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale | 1673 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale |
| 1660 : 0.f; | 1674 : 0.f; |
| 1661 | 1675 |
| 1662 float animation_start_scale = 0.f; | 1676 float animation_start_scale = 0.f; |
| 1663 node->data.local_starting_animation_scale = | 1677 node->data.local_starting_animation_scale = |
| 1664 AnimationStartScale(&animation_start_scale) ? animation_start_scale | 1678 AnimationStartScale(&animation_start_scale) ? animation_start_scale |
| 1665 : 0.f; | 1679 : 0.f; |
| 1666 | 1680 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1786 ->data.num_copy_requests_in_subtree; | 1800 ->data.num_copy_requests_in_subtree; |
| 1787 } | 1801 } |
| 1788 | 1802 |
| 1789 gfx::Transform Layer::screen_space_transform() const { | 1803 gfx::Transform Layer::screen_space_transform() const { |
| 1790 DCHECK_NE(transform_tree_index_, -1); | 1804 DCHECK_NE(transform_tree_index_, -1); |
| 1791 return draw_property_utils::ScreenSpaceTransform( | 1805 return draw_property_utils::ScreenSpaceTransform( |
| 1792 this, layer_tree_host_->property_trees()->transform_tree); | 1806 this, layer_tree_host_->property_trees()->transform_tree); |
| 1793 } | 1807 } |
| 1794 | 1808 |
| 1795 } // namespace cc | 1809 } // namespace cc |
| OLD | NEW |