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

Side by Side Diff: cc/trees/property_tree.cc

Issue 2148383005: cc: Use sublayer scale from effect tree (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698