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

Unified Diff: cc/layers/render_surface_impl.cc

Issue 1868003002: cc: Move RenderTarget Information to Effect Tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 | « cc/layers/render_surface_impl.h ('k') | cc/layers/render_surface_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..28db3a3cc83526f70c5b8071152ec5fbd9c9d194 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,38 @@ 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());
+
+ // Root render surface doesn't accumulate content rect, it always uses
+ // viewport for content rect.
+ if (render_target() == this)
+ return;
+
+ 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());
+
+ // Root render surface doesn't accumulate content rect, it always uses
+ // viewport for content rect.
+ if (render_target() == this)
+ return;
+
+ // 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.
+ accumulated_content_rect_.Union(
+ gfx::ToEnclosedRect(contributing_surface->DrawableContentRect()));
}
bool RenderSurfaceImpl::SurfacePropertyChanged() const {
« no previous file with comments | « cc/layers/render_surface_impl.h ('k') | cc/layers/render_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698