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

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

Issue 1479883002: cc: Fix draw transform computation for non-drawn layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove LayerImpl::draw_transform() Created 5 years 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
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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 // tile raster code does not know how to look for the replica and would 714 // tile raster code does not know how to look for the replica and would
715 // consider it occluded even though the replica is visible. 715 // consider it occluded even though the replica is visible.
716 // Since occlusion is only used for browser compositor (i.e. 716 // Since occlusion is only used for browser compositor (i.e.
717 // use_occlusion_for_tile_prioritization) and it won't use replicas, 717 // use_occlusion_for_tile_prioritization) and it won't use replicas,
718 // this should matter not. 718 // this should matter not.
719 719
720 if (it.represents_itself()) { 720 if (it.represents_itself()) {
721 Occlusion occlusion = 721 Occlusion occlusion =
722 inside_replica ? Occlusion() 722 inside_replica ? Occlusion()
723 : occlusion_tracker.GetCurrentOcclusionForLayer( 723 : occlusion_tracker.GetCurrentOcclusionForLayer(
724 it->draw_transform()); 724 it->DrawTransform());
725 it->draw_properties().occlusion_in_content_space = occlusion; 725 it->draw_properties().occlusion_in_content_space = occlusion;
726 } 726 }
727 727
728 if (it.represents_contributing_render_surface()) { 728 if (it.represents_contributing_render_surface()) {
729 // Surfaces aren't used by the tile raster code, so they can have 729 // Surfaces aren't used by the tile raster code, so they can have
730 // occlusion regardless of replicas. 730 // occlusion regardless of replicas.
731 Occlusion occlusion = 731 Occlusion occlusion =
732 occlusion_tracker.GetCurrentOcclusionForContributingSurface( 732 occlusion_tracker.GetCurrentOcclusionForContributingSurface(
733 it->render_surface()->draw_transform()); 733 it->render_surface()->draw_transform());
734 it->render_surface()->set_occlusion_in_content_space(occlusion); 734 it->render_surface()->set_occlusion_in_content_space(occlusion);
735 // Masks are used to draw the contributing surface, so should have 735 // Masks are used to draw the contributing surface, so should have
736 // the same occlusion as the surface (nothing inside the surface 736 // the same occlusion as the surface (nothing inside the surface
737 // occludes them). 737 // occludes them).
738 if (LayerImpl* mask = it->mask_layer()) { 738 if (LayerImpl* mask = it->mask_layer()) {
739 Occlusion mask_occlusion = 739 Occlusion mask_occlusion =
740 inside_replica 740 inside_replica
741 ? Occlusion() 741 ? Occlusion()
742 : occlusion_tracker.GetCurrentOcclusionForContributingSurface( 742 : occlusion_tracker.GetCurrentOcclusionForContributingSurface(
743 it->render_surface()->draw_transform() * 743 it->render_surface()->draw_transform() *
744 it->draw_transform()); 744 it->DrawTransform());
745 mask->draw_properties().occlusion_in_content_space = mask_occlusion; 745 mask->draw_properties().occlusion_in_content_space = mask_occlusion;
746 } 746 }
747 if (LayerImpl* replica = it->replica_layer()) { 747 if (LayerImpl* replica = it->replica_layer()) {
748 if (LayerImpl* mask = replica->mask_layer()) 748 if (LayerImpl* mask = replica->mask_layer())
749 mask->draw_properties().occlusion_in_content_space = Occlusion(); 749 mask->draw_properties().occlusion_in_content_space = Occlusion();
750 } 750 }
751 } 751 }
752 752
753 occlusion_tracker.LeaveLayer(it); 753 occlusion_tracker.LeaveLayer(it);
754 } 754 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 805
806 void LayerTreeImpl::BuildPropertyTreesForTesting() { 806 void LayerTreeImpl::BuildPropertyTreesForTesting() {
807 LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer_.get()); 807 LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer_.get());
808 PropertyTreeBuilder::BuildPropertyTrees( 808 PropertyTreeBuilder::BuildPropertyTrees(
809 root_layer_.get(), PageScaleLayer(), InnerViewportScrollLayer(), 809 root_layer_.get(), PageScaleLayer(), InnerViewportScrollLayer(),
810 OuterViewportScrollLayer(), current_page_scale_factor(), 810 OuterViewportScrollLayer(), current_page_scale_factor(),
811 device_scale_factor(), gfx::Rect(DrawViewportSize()), 811 device_scale_factor(), gfx::Rect(DrawViewportSize()),
812 layer_tree_host_impl_->DrawTransform(), &property_trees_); 812 layer_tree_host_impl_->DrawTransform(), &property_trees_);
813 } 813 }
814 814
815 void LayerTreeImpl::IncrementRenderSurfaceListIdForTesting() {
816 render_surface_layer_list_id_++;
817 }
818
815 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { 819 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const {
816 // If this assert triggers, then the list is dirty. 820 // If this assert triggers, then the list is dirty.
817 DCHECK(!needs_update_draw_properties_); 821 DCHECK(!needs_update_draw_properties_);
818 return render_surface_layer_list_; 822 return render_surface_layer_list_;
819 } 823 }
820 824
821 const Region& LayerTreeImpl::UnoccludedScreenSpaceRegion() const { 825 const Region& LayerTreeImpl::UnoccludedScreenSpaceRegion() const {
822 // If this assert triggers, then the render_surface_layer_list_ is dirty, so 826 // If this assert triggers, then the render_surface_layer_list_ is dirty, so
823 // the unoccluded_screen_space_region_ is not valid anymore. 827 // the unoccluded_screen_space_region_ is not valid anymore.
824 DCHECK(!needs_update_draw_properties_); 828 DCHECK(!needs_update_draw_properties_);
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 const gfx::BoxF& box, 1935 const gfx::BoxF& box,
1932 gfx::BoxF* bounds) const { 1936 gfx::BoxF* bounds) const {
1933 *bounds = gfx::BoxF(); 1937 *bounds = gfx::BoxF();
1934 return layer_tree_host_impl_->animation_host() 1938 return layer_tree_host_impl_->animation_host()
1935 ? layer_tree_host_impl_->animation_host() 1939 ? layer_tree_host_impl_->animation_host()
1936 ->TransformAnimationBoundsForBox(layer->id(), box, bounds) 1940 ->TransformAnimationBoundsForBox(layer->id(), box, bounds)
1937 : true; 1941 : true;
1938 } 1942 }
1939 1943
1940 } // namespace cc 1944 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698