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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 295193002: Get rid of graphics layer anchor points, and replace with transform origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/damage_tracker_unittest.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 34f45530ff38f1340925bdbb5e80e2a32d66b439..2335f4e0315b29726af6279526ed3c26955ca29f 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -1651,25 +1651,21 @@ static void CalculateDrawPropertiesInternal(
animating_transform_to_screen |=
layer->parent()->screen_space_transform_is_animating();
}
-
- gfx::Size bounds = layer->bounds();
- gfx::PointF anchor_point = layer->anchor_point();
+ gfx::Point3F transform_origin = layer->transform_origin();
gfx::Vector2dF scroll_offset = GetEffectiveTotalScrollOffset(layer);
gfx::PointF position = layer->position() - scroll_offset;
-
gfx::Transform combined_transform = data_from_ancestor.parent_matrix;
if (!layer->transform().IsIdentity()) {
- // LT = Tr[origin] * Tr[origin2anchor]
- combined_transform.Translate3d(
- position.x() + anchor_point.x() * bounds.width(),
- position.y() + anchor_point.y() * bounds.height(),
- layer->anchor_point_z());
- // LT = Tr[origin] * Tr[origin2anchor] * M[layer]
+ // LT = Tr[origin] * Tr[origin2transformOrigin]
+ combined_transform.Translate3d(position.x() + transform_origin.x(),
+ position.y() + transform_origin.y(),
+ transform_origin.z());
+ // LT = Tr[origin] * Tr[origin2origin] * M[layer]
combined_transform.PreconcatTransform(layer->transform());
- // LT = Tr[origin] * Tr[origin2anchor] * M[layer] * Tr[anchor2origin]
- combined_transform.Translate3d(-anchor_point.x() * bounds.width(),
- -anchor_point.y() * bounds.height(),
- -layer->anchor_point_z());
+ // LT = Tr[origin] * Tr[origin2origin] * M[layer] *
+ // Tr[transformOrigin2origin]
+ combined_transform.Translate3d(
+ -transform_origin.x(), -transform_origin.y(), -transform_origin.z());
} else {
combined_transform.Translate(position.x(), position.y());
}
@@ -2250,14 +2246,14 @@ static void CalculateDrawPropertiesInternal(
render_surface_sublayer_scale.x(), render_surface_sublayer_scale.y());
surface_origin_to_replica_origin_transform.Translate(
layer->replica_layer()->position().x() +
- layer->replica_layer()->anchor_point().x() * bounds.width(),
+ layer->replica_layer()->transform_origin().x(),
layer->replica_layer()->position().y() +
- layer->replica_layer()->anchor_point().y() * bounds.height());
+ layer->replica_layer()->transform_origin().y());
surface_origin_to_replica_origin_transform.PreconcatTransform(
layer->replica_layer()->transform());
surface_origin_to_replica_origin_transform.Translate(
- -layer->replica_layer()->anchor_point().x() * bounds.width(),
- -layer->replica_layer()->anchor_point().y() * bounds.height());
+ -layer->replica_layer()->transform_origin().x(),
+ -layer->replica_layer()->transform_origin().y());
surface_origin_to_replica_origin_transform.Scale(
1.0 / render_surface_sublayer_scale.x(),
1.0 / render_surface_sublayer_scale.y());
« no previous file with comments | « cc/trees/damage_tracker_unittest.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698