| 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 <set> | 5 #include <set> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/trees/property_tree.h" | 10 #include "cc/trees/property_tree.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 const gfx::PointF& position, | 87 const gfx::PointF& position, |
| 88 const gfx::Point3F& transform_origin) { | 88 const gfx::Point3F& transform_origin) { |
| 89 post_local.MakeIdentity(); | 89 post_local.MakeIdentity(); |
| 90 post_local.Scale(post_local_scale_factor, post_local_scale_factor); | 90 post_local.Scale(post_local_scale_factor, post_local_scale_factor); |
| 91 post_local.Translate3d( | 91 post_local.Translate3d( |
| 92 position.x() + source_offset.x() + transform_origin.x(), | 92 position.x() + source_offset.x() + transform_origin.x(), |
| 93 position.y() + source_offset.y() + transform_origin.y(), | 93 position.y() + source_offset.y() + transform_origin.y(), |
| 94 transform_origin.z()); | 94 transform_origin.z()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 ClipNodeData::ClipNodeData() : transform_id(-1), target_id(-1) { | 97 ClipNodeData::ClipNodeData() |
| 98 } | 98 : transform_id(-1), |
| 99 target_id(-1), |
| 100 inherit_parent_target_space_clip(false) {} |
| 99 | 101 |
| 100 OpacityNodeData::OpacityNodeData() : opacity(1.f), screen_space_opacity(1.f) { | 102 OpacityNodeData::OpacityNodeData() : opacity(1.f), screen_space_opacity(1.f) { |
| 101 } | 103 } |
| 102 | 104 |
| 103 void TransformTree::clear() { | 105 void TransformTree::clear() { |
| 104 PropertyTree<TransformNode>::clear(); | 106 PropertyTree<TransformNode>::clear(); |
| 105 | 107 |
| 106 nodes_affected_by_inner_viewport_bounds_delta_.clear(); | 108 nodes_affected_by_inner_viewport_bounds_delta_.clear(); |
| 107 nodes_affected_by_outer_viewport_bounds_delta_.clear(); | 109 nodes_affected_by_outer_viewport_bounds_delta_.clear(); |
| 108 } | 110 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 bool TransformTree::ComputeTransformWithSourceSublayerScale( | 142 bool TransformTree::ComputeTransformWithSourceSublayerScale( |
| 141 int source_id, | 143 int source_id, |
| 142 int dest_id, | 144 int dest_id, |
| 143 gfx::Transform* transform) const { | 145 gfx::Transform* transform) const { |
| 144 bool success = ComputeTransform(source_id, dest_id, transform); | 146 bool success = ComputeTransform(source_id, dest_id, transform); |
| 145 | 147 |
| 146 const TransformNode* source_node = Node(source_id); | 148 const TransformNode* source_node = Node(source_id); |
| 147 if (!source_node->data.needs_sublayer_scale) | 149 if (!source_node->data.needs_sublayer_scale) |
| 148 return success; | 150 return success; |
| 149 | 151 |
| 152 if (source_node->data.sublayer_scale.x() == 0 || |
| 153 source_node->data.sublayer_scale.y() == 0) |
| 154 return false; |
| 155 |
| 150 transform->Scale(1.f / source_node->data.sublayer_scale.x(), | 156 transform->Scale(1.f / source_node->data.sublayer_scale.x(), |
| 151 1.f / source_node->data.sublayer_scale.y()); | 157 1.f / source_node->data.sublayer_scale.y()); |
| 152 return success; | 158 return success; |
| 153 } | 159 } |
| 154 | 160 |
| 155 bool TransformTree::Are2DAxisAligned(int source_id, int dest_id) const { | 161 bool TransformTree::Are2DAxisAligned(int source_id, int dest_id) const { |
| 156 gfx::Transform transform; | 162 gfx::Transform transform; |
| 157 return ComputeTransform(source_id, dest_id, &transform) && | 163 return ComputeTransform(source_id, dest_id, &transform) && |
| 158 transform.Preserves2dAxisAlignment(); | 164 transform.Preserves2dAxisAlignment(); |
| 159 } | 165 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 if (parent_node) | 502 if (parent_node) |
| 497 node->data.node_and_ancestors_have_only_integer_translation = | 503 node->data.node_and_ancestors_have_only_integer_translation = |
| 498 node->data.node_and_ancestors_have_only_integer_translation && | 504 node->data.node_and_ancestors_have_only_integer_translation && |
| 499 parent_node->data.node_and_ancestors_have_only_integer_translation; | 505 parent_node->data.node_and_ancestors_have_only_integer_translation; |
| 500 } | 506 } |
| 501 | 507 |
| 502 PropertyTrees::PropertyTrees() : needs_rebuild(true), sequence_number(0) { | 508 PropertyTrees::PropertyTrees() : needs_rebuild(true), sequence_number(0) { |
| 503 } | 509 } |
| 504 | 510 |
| 505 } // namespace cc | 511 } // namespace cc |
| OLD | NEW |