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

Unified Diff: cc/layers/layer.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/layers/layer.h ('k') | cc/layers/layer_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 01e67c5edc6d586ba12b677cfa11e33f8e9fb429..19b505b49618f20930f7d55212eb63f072d5349a 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -1108,7 +1108,8 @@ bool Layer::IsSuitableForGpuRasterization() const {
return true;
}
-scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() {
+scoped_refptr<base::trace_event::ConvertableToTraceFormat>
+Layer::TakeDebugInfo() {
if (client_)
return client_->TakeDebugInfo();
else
@@ -1298,13 +1299,24 @@ gfx::Transform Layer::screen_space_transform_from_property_trees(
gfx::Transform Layer::draw_transform_from_property_trees(
const TransformTree& tree) const {
- gfx::Transform xform(1, 0, 0, 1, offset_to_transform_parent().x(),
- offset_to_transform_parent().y());
- if (transform_tree_index() >= 0) {
- const TransformNode* node = tree.Node(transform_tree_index());
- gfx::Transform ssxform;
- tree.ComputeTransform(node->id, node->data.target_id, &ssxform);
- xform.ConcatTransform(ssxform);
+ const TransformNode* node = tree.Node(transform_tree_index());
+ // TODO(vollick): ultimately we'll need to find this information (whether or
+ // not we establish a render surface) somewhere other than the layer.
+ const TransformNode* target_node =
+ has_render_surface_ ? node : tree.Node(node->data.content_target_id);
+
+ gfx::Transform xform;
+ const bool owns_non_root_surface = parent() && render_surface();
+ if (!owns_non_root_surface) {
+ // If you're not the root, or you don't own a surface, you need to apply
+ // your local offset.
+ xform = node->data.to_target;
+ xform.Translate(offset_to_transform_parent().x(),
+ offset_to_transform_parent().y());
+ } else {
+ // Surfaces need to apply their sublayer scale.
+ xform.Scale(target_node->data.sublayer_scale.x(),
+ target_node->data.sublayer_scale.y());
}
xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y());
return xform;
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698