| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 CombineTransformsBetween(source_id, dest_id, transform); | 154 CombineTransformsBetween(source_id, dest_id, transform); |
| 155 return true; | 155 return true; |
| 156 } | 156 } |
| 157 | 157 |
| 158 return CombineInversesBetween(source_id, dest_id, transform); | 158 return CombineInversesBetween(source_id, dest_id, transform); |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool TransformTree::ComputeTranslation(int source_id, | 161 bool TransformTree::ComputeTranslation(int source_id, |
| 162 int dest_id, | 162 int dest_id, |
| 163 gfx::Transform* transform) const { | 163 gfx::Transform* transform) const { |
| 164 // Since the transform between source and destination is at most translation, | 164 bool success = ComputeTransform(source_id, dest_id, transform); |
| 165 // flattenning will not affect the result and we can use the screen space | |
| 166 // transforms. | |
| 167 transform->MakeIdentity(); | |
| 168 if (source_id == dest_id) | |
| 169 return true; | |
| 170 | |
| 171 const TransformNode* dest = Node(dest_id); | |
| 172 if (dest->ancestors_are_invertible) { | |
| 173 if (source_id != kInvalidNodeId) | |
| 174 transform->ConcatTransform(ToScreen(source_id)); | |
| 175 if (dest_id != kInvalidNodeId) | |
| 176 transform->ConcatTransform(FromScreen(dest_id)); | |
| 177 } else { | |
| 178 return false; | |
| 179 } | |
| 180 DCHECK( | 165 DCHECK( |
| 181 transform->IsApproximatelyIdentityOrTranslation(SkDoubleToMScalar(1e-4))); | 166 transform->IsApproximatelyIdentityOrTranslation(SkDoubleToMScalar(1e-4))); |
| 182 return true; | 167 return success; |
| 183 } | 168 } |
| 184 | 169 |
| 185 bool TransformTree::NeedsSourceToParentUpdate(TransformNode* node) { | 170 bool TransformTree::NeedsSourceToParentUpdate(TransformNode* node) { |
| 186 return (source_to_parent_updates_allowed() && | 171 return (source_to_parent_updates_allowed() && |
| 187 node->parent_id != node->source_node_id); | 172 node->parent_id != node->source_node_id); |
| 188 } | 173 } |
| 189 | 174 |
| 190 void TransformTree::ResetChangeTracking() { | 175 void TransformTree::ResetChangeTracking() { |
| 191 for (int id = 1; id < static_cast<int>(size()); ++id) { | 176 for (int id = 1; id < static_cast<int>(size()); ++id) { |
| 192 TransformNode* node = Node(id); | 177 TransformNode* node = Node(id); |
| (...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2019 DCHECK(effect_node->has_render_surface || | 2004 DCHECK(effect_node->has_render_surface || |
| 2020 effect_node->id == EffectTree::kRootNodeId); | 2005 effect_node->id == EffectTree::kRootNodeId); |
| 2021 target_transform_id = effect_node->transform_id; | 2006 target_transform_id = effect_node->transform_id; |
| 2022 } | 2007 } |
| 2023 | 2008 |
| 2024 return transform_tree.ComputeTransform(target_transform_id, transform_id, | 2009 return transform_tree.ComputeTransform(target_transform_id, transform_id, |
| 2025 transform); | 2010 transform); |
| 2026 } | 2011 } |
| 2027 | 2012 |
| 2028 } // namespace cc | 2013 } // namespace cc |
| OLD | NEW |