Index: cc/layers/render_surface_impl.cc |
diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc |
index 4ca32253782e1f7839f5310f3e5df23e46c1de04..c5a8275a680193259be726f58169a7f8a1d3de77 100644 |
--- a/cc/layers/render_surface_impl.cc |
+++ b/cc/layers/render_surface_impl.cc |
@@ -40,6 +40,28 @@ RenderSurfaceImpl::RenderSurfaceImpl(LayerImpl* owning_layer) |
RenderSurfaceImpl::~RenderSurfaceImpl() {} |
+RenderSurfaceImpl* RenderSurfaceImpl::render_target() { |
+ EffectTree& effect_tree = |
+ owning_layer_->layer_tree_impl()->property_trees()->effect_tree; |
+ EffectNode* node = effect_tree.Node(EffectTreeIndex()); |
+ EffectNode* target_node = effect_tree.Node(node->data.target_id); |
+ if (target_node->id != 0) |
+ return target_node->data.render_surface; |
+ else |
+ return this; |
+} |
+ |
+const RenderSurfaceImpl* RenderSurfaceImpl::render_target() const { |
+ const EffectTree& effect_tree = |
+ owning_layer_->layer_tree_impl()->property_trees()->effect_tree; |
+ const EffectNode* node = effect_tree.Node(EffectTreeIndex()); |
+ const EffectNode* target_node = effect_tree.Node(node->data.target_id); |
+ if (target_node->id != 0) |
+ return target_node->data.render_surface; |
+ else |
+ return this; |
+} |
+ |
RenderSurfaceImpl::DrawProperties::DrawProperties() { |
draw_opacity = 1.f; |
is_clipped = false; |
@@ -128,9 +150,31 @@ void RenderSurfaceImpl::SetContentRect(const gfx::Rect& content_rect) { |
draw_properties_.content_rect = content_rect; |
} |
-void RenderSurfaceImpl::SetAccumulatedContentRect( |
- const gfx::Rect& content_rect) { |
- accumulated_content_rect_ = content_rect; |
+void RenderSurfaceImpl::ClearAccumulatedContentRect() { |
+ accumulated_content_rect_ = gfx::Rect(); |
+} |
+ |
+void RenderSurfaceImpl::AccumulateContentRectFromContributingLayer( |
+ LayerImpl* layer) { |
+ DCHECK(layer->DrawsContent()); |
+ DCHECK_EQ(this, layer->render_target()); |
+ |
+ accumulated_content_rect_.Union(layer->drawable_content_rect()); |
+} |
+ |
+void RenderSurfaceImpl::AccumulateContentRectFromContributingRenderSurface( |
+ RenderSurfaceImpl* contributing_surface) { |
+ DCHECK_NE(this, contributing_surface); |
+ DCHECK_EQ(this, contributing_surface->render_target()); |
+ |
+ // The content rect of contributing surface is in its own space. Instead, we |
+ // will use contributing surface's DrawableContentRect which is in target |
+ // space (local space for this render surface) as required. We also need to |
+ // clip it with this render surface's clip if the target is clipped. |
+ accumulated_content_rect_.Union( |
+ gfx::ToEnclosedRect(contributing_surface->DrawableContentRect())); |
+ if (is_clipped()) |
+ accumulated_content_rect_.Intersect(clip_rect()); |
ajuma
2016/04/07 21:59:55
This clipping seems like something that can be rem
ajuma
2016/04/07 23:57:37
Thinking about this some more:
In the old code, th
|
} |
bool RenderSurfaceImpl::SurfacePropertyChanged() const { |