| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 const TransformNode* dest_node = Node(dest_id); | 166 const TransformNode* dest_node = Node(dest_id); |
| 167 if (!dest_node->needs_sublayer_scale) | 167 if (!dest_node->needs_sublayer_scale) |
| 168 return success; | 168 return success; |
| 169 | 169 |
| 170 transform->matrix().postScale(dest_node->sublayer_scale.x(), | 170 transform->matrix().postScale(dest_node->sublayer_scale.x(), |
| 171 dest_node->sublayer_scale.y(), 1.f); | 171 dest_node->sublayer_scale.y(), 1.f); |
| 172 return success; | 172 return success; |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool TransformTree::ComputeTransformWithSourceSublayerScale( | |
| 176 int source_id, | |
| 177 int dest_id, | |
| 178 gfx::Transform* transform) const { | |
| 179 bool success = ComputeTransform(source_id, dest_id, transform); | |
| 180 | |
| 181 const TransformNode* source_node = Node(source_id); | |
| 182 if (!source_node->needs_sublayer_scale) | |
| 183 return success; | |
| 184 | |
| 185 if (source_node->sublayer_scale.x() == 0 || | |
| 186 source_node->sublayer_scale.y() == 0) | |
| 187 return false; | |
| 188 | |
| 189 transform->Scale(1.f / source_node->sublayer_scale.x(), | |
| 190 1.f / source_node->sublayer_scale.y()); | |
| 191 return success; | |
| 192 } | |
| 193 | |
| 194 bool TransformTree::Are2DAxisAligned(int source_id, int dest_id) const { | 175 bool TransformTree::Are2DAxisAligned(int source_id, int dest_id) const { |
| 195 gfx::Transform transform; | 176 gfx::Transform transform; |
| 196 return ComputeTransform(source_id, dest_id, &transform) && | 177 return ComputeTransform(source_id, dest_id, &transform) && |
| 197 transform.Preserves2dAxisAlignment(); | 178 transform.Preserves2dAxisAlignment(); |
| 198 } | 179 } |
| 199 | 180 |
| 200 bool TransformTree::NeedsSourceToParentUpdate(TransformNode* node) { | 181 bool TransformTree::NeedsSourceToParentUpdate(TransformNode* node) { |
| 201 return (source_to_parent_updates_allowed() && | 182 return (source_to_parent_updates_allowed() && |
| 202 node->parent_id != node->source_node_id); | 183 node->parent_id != node->source_node_id); |
| 203 } | 184 } |
| (...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1884 cached_data_.property_tree_update_number = 0; | 1865 cached_data_.property_tree_update_number = 0; |
| 1885 cached_data_.animation_scales = std::vector<AnimationScaleData>( | 1866 cached_data_.animation_scales = std::vector<AnimationScaleData>( |
| 1886 transform_tree.nodes().size(), AnimationScaleData()); | 1867 transform_tree.nodes().size(), AnimationScaleData()); |
| 1887 } | 1868 } |
| 1888 | 1869 |
| 1889 void PropertyTrees::UpdateCachedNumber() { | 1870 void PropertyTrees::UpdateCachedNumber() { |
| 1890 cached_data_.property_tree_update_number++; | 1871 cached_data_.property_tree_update_number++; |
| 1891 } | 1872 } |
| 1892 | 1873 |
| 1893 } // namespace cc | 1874 } // namespace cc |
| OLD | NEW |