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

Unified Diff: cc/trees/draw_property_utils.cc

Issue 1060413002: cc: Re-use transforms from transform nodes when computing visible rects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 8 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 | « no previous file | cc/trees/property_tree.h » ('j') | cc/trees/property_tree.cc » ('J')
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 322d57e7a9a52d09e1ca2503a65c641bd34679be..b4a268fe21f6cf7f9d4cae6c3493cf0e4c3b1855 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -45,12 +45,7 @@ void CalculateVisibleRects(
target_is_root_surface ? 0 : transform_node->data.content_target_id;
const TransformNode* target_node = transform_tree.Node(target_id);
- // TODO(ajuma): Try to re-use transforms already stored in the transform
- // tree instead of computing transforms below.
- gfx::Transform content_to_target;
- bool success = transform_tree.ComputeTransform(
- transform_node->id, target_node->id, &content_to_target);
- DCHECK(success);
+ gfx::Transform content_to_target = transform_node->data.to_target;
content_to_target.Translate(layer->offset_to_transform_parent().x(),
layer->offset_to_transform_parent().y());
@@ -58,8 +53,14 @@ void CalculateVisibleRects(
gfx::Rect clip_rect_in_target_space;
gfx::Transform clip_to_target;
- success = transform_tree.ComputeTransform(
- clip_transform_node->id, target_node->id, &clip_to_target);
+ bool success = true;
+ if (clip_transform_node->data.target_id == target_node->id) {
+ clip_to_target = clip_transform_node->data.to_target;
+ } else {
+ success = transform_tree.ComputeTransformWithDestinationSublayerScale(
+ clip_transform_node->id, target_node->id, &clip_to_target);
+ }
+
if (target_node->id > clip_node->data.transform_id) {
if (!success) {
DCHECK(target_node->data.to_screen_is_animated);
@@ -96,8 +97,14 @@ void CalculateVisibleRects(
gfx::Transform target_to_content;
gfx::Transform target_to_layer;
- success = transform_tree.ComputeTransform(
- target_node->id, transform_node->id, &target_to_layer);
+ if (transform_node->data.ancestors_are_invertible) {
+ target_to_layer = transform_node->data.from_target;
+ success = true;
+ } else {
+ success = transform_tree.ComputeTransformWithSourceSublayerScale(
+ target_node->id, transform_node->id, &target_to_layer);
+ }
+
if (!success) {
DCHECK(transform_node->data.to_screen_is_animated);
« no previous file with comments | « no previous file | cc/trees/property_tree.h » ('j') | cc/trees/property_tree.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698