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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2690753002: cc: Move render surface ownership from layers to the effect tree (Closed)
Patch Set: Only update surfaces when can_render_to_separate_surface changes Created 3 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/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/occlusion_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index ca0f8587a82bc6c479ad0066a2876913db19e478..1b63a43c9978a4cf939139f3ab0e2b371797e2a9 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -380,11 +380,14 @@ static void UpdateClipTreeForBoundsDeltaOnLayer(LayerImpl* layer,
}
void LayerTreeImpl::SetPropertyTrees(PropertyTrees* property_trees) {
- EffectTree::StableIdRenderSurfaceList stable_id_render_surface_list =
- property_trees_.effect_tree.CreateStableIdRenderSurfaceList();
+ std::vector<std::unique_ptr<RenderSurfaceImpl>> old_render_surfaces;
+ property_trees_.effect_tree.TakeRenderSurfaces(&old_render_surfaces);
property_trees_ = *property_trees;
- property_trees_.effect_tree.UpdateRenderSurfaceEffectIds(
- stable_id_render_surface_list, this);
+ bool render_surfaces_changed =
+ property_trees_.effect_tree.CreateOrReuseRenderSurfaces(
+ &old_render_surfaces, this);
+ if (render_surfaces_changed)
+ set_needs_update_draw_properties();
property_trees->effect_tree.PushCopyRequestsTo(&property_trees_.effect_tree);
property_trees_.is_main_thread = false;
property_trees_.is_active = IsActiveTree();
@@ -504,9 +507,13 @@ void LayerTreeImpl::MoveChangeTrackingToLayers() {
for (auto* layer : *this) {
if (layer->LayerPropertyChanged())
layer->NoteLayerPropertyChanged();
- if (layer->render_surface() &&
- layer->render_surface()->AncestorPropertyChanged())
- layer->render_surface()->NoteAncestorPropertyChanged();
+ }
+ EffectTree& effect_tree = property_trees_.effect_tree;
+ for (int id = EffectTree::kContentsRootNodeId;
+ id < static_cast<int>(effect_tree.size()); ++id) {
+ RenderSurfaceImpl* render_surface = effect_tree.GetRenderSurface(id);
+ if (render_surface && render_surface->AncestorPropertyChanged())
+ render_surface->NoteAncestorPropertyChanged();
}
}
@@ -1048,15 +1055,16 @@ bool LayerTreeImpl::UpdateDrawProperties(
const RenderSurfaceImpl* occlusion_surface =
occlusion_tracker.OcclusionSurfaceForContributingSurface();
gfx::Transform draw_transform;
+ RenderSurfaceImpl* render_surface = it->render_surface();
if (occlusion_surface) {
// We are calculating transform between two render surfaces. So, we
// need to apply the surface contents scale at target and remove the
// surface contents scale at source.
- property_trees()->GetToTarget(
- it->render_surface()->TransformTreeIndex(),
- occlusion_surface->EffectTreeIndex(), &draw_transform);
+ property_trees()->GetToTarget(render_surface->TransformTreeIndex(),
+ occlusion_surface->EffectTreeIndex(),
+ &draw_transform);
const EffectNode* effect_node = property_trees()->effect_tree.Node(
- it->render_surface()->EffectTreeIndex());
+ render_surface->EffectTreeIndex());
draw_property_utils::ConcatInverseSurfaceContentsScale(
effect_node, &draw_transform);
}
@@ -1064,11 +1072,11 @@ bool LayerTreeImpl::UpdateDrawProperties(
Occlusion occlusion =
occlusion_tracker.GetCurrentOcclusionForContributingSurface(
draw_transform);
- it->render_surface()->set_occlusion_in_content_space(occlusion);
+ render_surface->set_occlusion_in_content_space(occlusion);
// Masks are used to draw the contributing surface, so should have
// the same occlusion as the surface (nothing inside the surface
// occludes them).
- if (LayerImpl* mask = it->render_surface()->MaskLayer()) {
+ if (LayerImpl* mask = render_surface->MaskLayer()) {
mask->draw_properties().occlusion_in_content_space =
occlusion_tracker.GetCurrentOcclusionForContributingSurface(
draw_transform * it->DrawTransform());
@@ -1768,13 +1776,14 @@ static const gfx::Transform SurfaceScreenSpaceTransform(
const LayerImpl* layer) {
const PropertyTrees* property_trees =
layer->layer_tree_impl()->property_trees();
- DCHECK(layer->render_surface());
+ RenderSurfaceImpl* render_surface = layer->render_surface();
+ DCHECK(render_surface);
return layer->is_drawn_render_surface_layer_list_member()
- ? layer->render_surface()->screen_space_transform()
+ ? render_surface->screen_space_transform()
: property_trees
->ToScreenSpaceTransformWithoutSurfaceContentsScale(
- layer->render_surface()->TransformTreeIndex(),
- layer->render_surface()->EffectTreeIndex());
+ render_surface->TransformTreeIndex(),
+ render_surface->EffectTreeIndex());
}
static bool PointIsClippedByAncestorClipNode(
@@ -1812,10 +1821,11 @@ static bool PointIsClippedByAncestorClipNode(
}
const LayerImpl* clip_node_owner =
layer->layer_tree_impl()->LayerById(clip_node->owning_layer_id);
- if (clip_node_owner->render_surface() &&
- !PointHitsRect(
- screen_space_point, SurfaceScreenSpaceTransform(clip_node_owner),
- clip_node_owner->render_surface()->content_rect(), NULL)) {
+ RenderSurfaceImpl* render_surface = clip_node_owner->render_surface();
+ if (render_surface &&
+ !PointHitsRect(screen_space_point,
+ SurfaceScreenSpaceTransform(clip_node_owner),
+ render_surface->content_rect(), NULL)) {
return true;
}
}
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/occlusion_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698