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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed src/webkit/renderer/compositor_bindings Created 7 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 0f31038f4990f5920fea4d320e691bfacdb978af..180f33251ccb5958f3c2c3979a8dae4326ad85ac 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -587,6 +587,32 @@ static bool SubtreeShouldRenderToSeparateSurface(
return true;
}
+ // If the layer has blending.
+ // TODO(rosca): this is temporary, until blending is implemented for other
+ // types of quads than RenderPassQuad. Layers having descendants that draw
danakj 2013/11/13 21:02:03 RenderPassDrawQuad
rosca 2013/11/14 21:56:34 Done.
+ // content will still create a separate rendering surface.
+ if (!layer->uses_default_blend_mode()) {
+ TRACE_EVENT_INSTANT0(
+ "cc",
+ "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface blending",
+ TRACE_EVENT_SCOPE_THREAD);
+ DCHECK(!is_root);
+ return true;
+ }
+
+ // If the layer has isolation.
+ // TODO(rosca): to be optimized - create separate rendering surface only when
+ // the blending descendants might have access to the content behind this layer
+ // (layer has transparent background or descendants overflow)
danakj 2013/11/13 21:02:03 period at the end.
rosca 2013/11/14 21:56:34 Done.
+ // https://code.google.com/p/chromium/issues/detail?id=301738
+ if (layer->is_root_for_isolated_group()) {
+ TRACE_EVENT_INSTANT0(
+ "cc",
+ "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface isolation",
+ TRACE_EVENT_SCOPE_THREAD);
+ return true;
danakj 2013/11/13 21:02:03 Can you move this down before the if (is_root) cas
rosca 2013/11/14 21:56:34 Done.
+ }
+
// If the layer clips its descendants but it is not axis-aligned with respect
// to its parent.
bool layer_clips_external_content =
@@ -2048,6 +2074,16 @@ static void CalculateDrawPropertiesInternal(
return;
}
+ // Layers having a non-default blend mode will blend with the content
+ // inside its parent's render target. This render target should be
+ // either root_for_isolated_group, or the root of the layer tree.
+ // Otherwise, this layer will use an incomplete backdrop, limited to its
+ // render target and the blending result will be incorrect.
+ DCHECK(layer->uses_default_blend_mode() || !layer->parent() ||
danakj 2013/11/13 21:02:03 Can you add DCHECK(...) << each << of << the << va
rosca 2013/11/14 21:56:34 They are disjunctions, so it will fail only when a
danakj 2013/11/20 03:32:50 Oh, no you're right :) I just knee-jerk when I see
+ !layer->parent()->render_target() ||
+ IsRootLayer(layer->parent()->render_target()) ||
+ layer->parent()->render_target()->is_root_for_isolated_group());
+
render_surface->SetContentRect(clipped_content_rect);
// The owning layer's screen_space_transform has a scale from content to

Powered by Google App Engine
This is Rietveld 408576698