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

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

Issue 1457803003: cc:: Don't use cached screen space transform for layers not in RSLL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 } 541 }
542 542
543 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const { 543 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const {
544 if (!InnerViewportContainerLayer()) 544 if (!InnerViewportContainerLayer())
545 return gfx::SizeF(); 545 return gfx::SizeF();
546 546
547 return gfx::ScaleSize(InnerViewportContainerLayer()->BoundsForScrolling(), 547 return gfx::ScaleSize(InnerViewportContainerLayer()->BoundsForScrolling(),
548 1.0f / current_page_scale_factor()); 548 1.0f / current_page_scale_factor());
549 } 549 }
550 550
551 static const gfx::Transform LayerScreenSpaceTransform(
552 const LayerImpl* layer,
553 const TransformTree& transform_tree,
554 const bool use_property_trees) {
555 if (!use_property_trees)
556 return layer->screen_space_transform();
557 // When we use property trees, UpdateDrawProperties does not update the draw
558 // properties of a layer that is not in render surface layer list, so we need
559 // to compute the screen space transform.
560 return layer->IsDrawnRenderSurfaceLayerListMember()
561 ? layer->screen_space_transform()
562 : ScreenSpaceTransformFromPropertyTrees(layer, transform_tree);
563 }
564
551 gfx::Rect LayerTreeImpl::RootScrollLayerDeviceViewportBounds() const { 565 gfx::Rect LayerTreeImpl::RootScrollLayerDeviceViewportBounds() const {
552 LayerImpl* root_scroll_layer = OuterViewportScrollLayer() 566 LayerImpl* root_scroll_layer = OuterViewportScrollLayer()
553 ? OuterViewportScrollLayer() 567 ? OuterViewportScrollLayer()
554 : InnerViewportScrollLayer(); 568 : InnerViewportScrollLayer();
555 if (!root_scroll_layer || root_scroll_layer->children().empty()) 569 if (!root_scroll_layer || root_scroll_layer->children().empty())
556 return gfx::Rect(); 570 return gfx::Rect();
557 LayerImpl* layer = root_scroll_layer->children()[0].get(); 571 LayerImpl* layer = root_scroll_layer->children()[0].get();
558 return MathUtil::MapEnclosingClippedRect(layer->screen_space_transform(), 572 bool use_property_trees =
559 gfx::Rect(layer->bounds())); 573 settings().verify_property_trees || settings().use_property_trees;
574 return MathUtil::MapEnclosingClippedRect(
575 LayerScreenSpaceTransform(layer, property_trees_.transform_tree,
576 use_property_trees),
577 gfx::Rect(layer->bounds()));
560 } 578 }
561 579
562 void LayerTreeImpl::ApplySentScrollAndScaleDeltasFromAbortedCommit() { 580 void LayerTreeImpl::ApplySentScrollAndScaleDeltasFromAbortedCommit() {
563 DCHECK(IsActiveTree()); 581 DCHECK(IsActiveTree());
564 582
565 page_scale_factor()->AbortCommit(); 583 page_scale_factor()->AbortCommit();
566 top_controls_shown_ratio()->AbortCommit(); 584 top_controls_shown_ratio()->AbortCommit();
567 elastic_overscroll()->AbortCommit(); 585 elastic_overscroll()->AbortCommit();
568 586
569 if (!root_layer()) 587 if (!root_layer())
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 } 1401 }
1384 1402
1385 static const LayerImpl* GetNextClippingLayer(const LayerImpl* layer) { 1403 static const LayerImpl* GetNextClippingLayer(const LayerImpl* layer) {
1386 if (layer->scroll_parent()) 1404 if (layer->scroll_parent())
1387 return layer->scroll_parent(); 1405 return layer->scroll_parent();
1388 if (layer->clip_parent()) 1406 if (layer->clip_parent())
1389 return layer->clip_parent(); 1407 return layer->clip_parent();
1390 return layer->parent(); 1408 return layer->parent();
1391 } 1409 }
1392 1410
1393 static const gfx::Transform LayerScreenSpaceTransform(
1394 const LayerImpl* layer,
1395 const TransformTree& transform_tree,
1396 const bool use_property_trees) {
1397 if (!use_property_trees)
1398 return layer->screen_space_transform();
1399 // When we use property trees, UpdateDrawProperties does not update the draw
1400 // properties of a layer that is not in render surface layer list, so we need
1401 // to compute the screen space transform.
1402 return layer->IsDrawnRenderSurfaceLayerListMember()
1403 ? layer->screen_space_transform()
1404 : ScreenSpaceTransformFromPropertyTrees(layer, transform_tree);
1405 }
1406
1407 static const gfx::Transform SurfaceScreenSpaceTransform( 1411 static const gfx::Transform SurfaceScreenSpaceTransform(
1408 const LayerImpl* layer, 1412 const LayerImpl* layer,
1409 const TransformTree& transform_tree, 1413 const TransformTree& transform_tree,
1410 const bool use_property_trees) { 1414 const bool use_property_trees) {
1411 DCHECK(layer->render_surface()); 1415 DCHECK(layer->render_surface());
1412 if (!use_property_trees) 1416 if (!use_property_trees)
1413 return layer->render_surface()->screen_space_transform(); 1417 return layer->render_surface()->screen_space_transform();
1414 return layer->IsDrawnRenderSurfaceLayerListMember() 1418 return layer->IsDrawnRenderSurfaceLayerListMember()
1415 ? layer->render_surface()->screen_space_transform() 1419 ? layer->render_surface()->screen_space_transform()
1416 : SurfaceScreenSpaceTransformFromPropertyTrees( 1420 : SurfaceScreenSpaceTransformFromPropertyTrees(
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 const gfx::BoxF& box, 1931 const gfx::BoxF& box,
1928 gfx::BoxF* bounds) const { 1932 gfx::BoxF* bounds) const {
1929 *bounds = gfx::BoxF(); 1933 *bounds = gfx::BoxF();
1930 return layer_tree_host_impl_->animation_host() 1934 return layer_tree_host_impl_->animation_host()
1931 ? layer_tree_host_impl_->animation_host() 1935 ? layer_tree_host_impl_->animation_host()
1932 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) 1936 ->TransformAnimationBoundsForBox(layer->id(), box, bounds)
1933 : true; 1937 : true;
1934 } 1938 }
1935 1939
1936 } // namespace cc 1940 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698