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

Unified Diff: cc/trees/draw_property_utils.cc

Issue 2112973003: cc: Add verify transform tree calculations to LayerTreeSettings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "TODO" Created 4 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/draw_property_utils.h ('k') | cc/trees/layer_tree_host_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/draw_property_utils.cc
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index d46151d683598cdf8f0e0e53c3f8ae36c3585c0e..2199e085dbb2ee39f17141c9ae1ad87fb7328360 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -888,6 +888,45 @@ static void ComputeLayerClipRect(const PropertyTrees* property_trees,
}
}
+static int FindTargetTransformTreeIndexFromEffectTree(
+ const EffectTree& effect_tree,
+ const int effect_tree_index) {
+ const EffectNode* node = effect_tree.Node(effect_tree_index);
+ if (node->data.has_render_surface)
+ return node->data.transform_id;
+ node = effect_tree.Node(node->data.target_id);
+ return node->data.transform_id;
+}
+
+static void VerifyDrawTransformsMatch(LayerImpl* layer,
+ PropertyTrees* property_trees) {
+ const int source_id = layer->transform_tree_index();
+ int destination_id = FindTargetTransformTreeIndexFromEffectTree(
+ property_trees->effect_tree, layer->effect_tree_index());
+ // TODO(jaydasika) : Remove this after sorting out how sublayer scale works
+ // for these ids.
+ if (destination_id == 0 || destination_id == 1)
+ return;
+ gfx::Transform draw_transform;
+ property_trees->transform_tree.ComputeTransform(source_id, destination_id,
+ &draw_transform);
+ TransformNode* target_node =
+ property_trees->transform_tree.Node(destination_id);
+ draw_transform.matrix().postScale(target_node->data.sublayer_scale.x(),
+ target_node->data.sublayer_scale.y(), 1.f);
+ if (layer->should_flatten_transform_from_property_tree())
+ draw_transform.FlattenTo2d();
+ draw_transform.Translate(layer->offset_to_transform_parent().x(),
+ layer->offset_to_transform_parent().y());
+ DCHECK(draw_transform.ApproximatelyEqual(
+ DrawTransform(layer, property_trees->transform_tree)))
+ << " layer: " << layer->id() << " source transform id: " << source_id
+ << " destination transform id: " << destination_id
+ << " draw transform from transform tree: "
+ << DrawTransform(layer, property_trees->transform_tree).ToString()
+ << " v.s." << draw_transform.ToString();
+}
+
static void ComputeVisibleRectsInternal(
LayerImpl* root_layer,
PropertyTrees* property_trees,
@@ -980,6 +1019,12 @@ void VerifyClipTreeCalculations(const LayerImplList& layer_list,
ComputeLayerClipRect(property_trees, layer);
}
+void VerifyTransformTreeCalculations(const LayerImplList& layer_list,
+ PropertyTrees* property_trees) {
+ for (auto layer : layer_list)
+ VerifyDrawTransformsMatch(layer, property_trees);
+}
+
void ComputeVisibleRects(LayerImpl* root_layer,
PropertyTrees* property_trees,
bool can_render_to_separate_surface,
« no previous file with comments | « cc/trees/draw_property_utils.h ('k') | cc/trees/layer_tree_host_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698