Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1571)

Side by Side Diff: cc/layers/layer.cc

Issue 1987123002: cc : Track transform animation changes on transform tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 // Changing the transform may change the visible part of this layer, so a new 1625 // Changing the transform may change the visible part of this layer, so a new
1626 // recording may be needed. 1626 // recording may be needed.
1627 SetNeedsUpdate(); 1627 SetNeedsUpdate();
1628 if (layer_tree_host_) { 1628 if (layer_tree_host_) {
1629 if (TransformNode* node = 1629 if (TransformNode* node =
1630 layer_tree_host_->property_trees()->transform_tree.Node( 1630 layer_tree_host_->property_trees()->transform_tree.Node(
1631 transform_tree_index())) { 1631 transform_tree_index())) {
1632 if (node->owner_id == id()) { 1632 if (node->owner_id == id()) {
1633 node->data.local = transform; 1633 node->data.local = transform;
1634 node->data.needs_local_transform_update = true; 1634 node->data.needs_local_transform_update = true;
1635 node->data.is_animated = true; 1635 node->data.has_potential_animation = true;
1636 layer_tree_host_->property_trees()->transform_tree.set_needs_update( 1636 layer_tree_host_->property_trees()->transform_tree.set_needs_update(
1637 true); 1637 true);
1638 } 1638 }
1639 } 1639 }
1640 } 1640 }
1641 } 1641 }
1642 1642
1643 void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { 1643 void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) {
1644 // Do nothing. Scroll deltas will be sent from the compositor thread back 1644 // Do nothing. Scroll deltas will be sent from the compositor thread back
1645 // to the main thread in the same manner as during non-animated 1645 // to the main thread in the same manner as during non-animated
1646 // compositor-driven scrolling. 1646 // compositor-driven scrolling.
1647 } 1647 }
1648 1648
1649 void Layer::OnTransformIsPotentiallyAnimatingChanged(bool is_animating) { 1649 void Layer::OnTransformIsCurrentlyAnimatingChanged(
1650 bool is_currently_animating) {
1651 DCHECK(layer_tree_host_);
1652 TransformTree& transform_tree =
1653 layer_tree_host_->property_trees()->transform_tree;
1654 TransformNode* node = transform_tree.Node(transform_tree_index());
1655 if (!node)
1656 return;
1657
1658 if (node->owner_id == id())
1659 node->data.is_currently_animating = is_currently_animating;
1660 }
1661
1662 void Layer::OnTransformIsPotentiallyAnimatingChanged(
1663 bool has_potential_animation) {
1650 if (!layer_tree_host_) 1664 if (!layer_tree_host_)
1651 return; 1665 return;
1652 TransformTree& transform_tree = 1666 TransformTree& transform_tree =
1653 layer_tree_host_->property_trees()->transform_tree; 1667 layer_tree_host_->property_trees()->transform_tree;
1654 TransformNode* node = transform_tree.Node(transform_tree_index()); 1668 TransformNode* node = transform_tree.Node(transform_tree_index());
1655 if (!node) 1669 if (!node)
1656 return; 1670 return;
1657 1671
1658 if (node->owner_id == id()) { 1672 if (node->owner_id == id()) {
1659 node->data.is_animated = is_animating; 1673 node->data.has_potential_animation = has_potential_animation;
1660 if (is_animating) { 1674 if (has_potential_animation) {
1661 float maximum_target_scale = 0.f; 1675 float maximum_target_scale = 0.f;
1662 node->data.local_maximum_animation_target_scale = 1676 node->data.local_maximum_animation_target_scale =
1663 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale 1677 MaximumTargetScale(&maximum_target_scale) ? maximum_target_scale
1664 : 0.f; 1678 : 0.f;
1665 1679
1666 float animation_start_scale = 0.f; 1680 float animation_start_scale = 0.f;
1667 node->data.local_starting_animation_scale = 1681 node->data.local_starting_animation_scale =
1668 AnimationStartScale(&animation_start_scale) ? animation_start_scale 1682 AnimationStartScale(&animation_start_scale) ? animation_start_scale
1669 : 0.f; 1683 : 0.f;
1670 1684
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1797 ->data.num_copy_requests_in_subtree; 1811 ->data.num_copy_requests_in_subtree;
1798 } 1812 }
1799 1813
1800 gfx::Transform Layer::screen_space_transform() const { 1814 gfx::Transform Layer::screen_space_transform() const {
1801 DCHECK_NE(transform_tree_index_, -1); 1815 DCHECK_NE(transform_tree_index_, -1);
1802 return draw_property_utils::ScreenSpaceTransform( 1816 return draw_property_utils::ScreenSpaceTransform(
1803 this, layer_tree_host_->property_trees()->transform_tree); 1817 this, layer_tree_host_->property_trees()->transform_tree);
1804 } 1818 }
1805 1819
1806 } // namespace cc 1820 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698