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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2147283002: cc : Fix occlusion tracking bug for contributing surface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mask test Created 4 years, 5 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_common_unittest.cc ('k') | cc/trees/occlusion_tracker.h » ('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 2c8fbb82b5d1e26fe3cbaf0d547f46bacc1bfebe..e97ee7f74d9b7a6e812f816b8ca43401673eb786 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -958,9 +958,30 @@ bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) {
if (it.represents_contributing_render_surface()) {
// Surfaces aren't used by the tile raster code, so they can have
// occlusion regardless of replicas.
+ const RenderSurfaceImpl* occlusion_surface =
+ occlusion_tracker.OcclusionSurfaceForContributingSurface();
+ gfx::Transform draw_transform;
+ if (occlusion_surface) {
+ // We are calculating transform between two render surfaces. So, we
+ // need to apply the sublayer scale at target and remove the sublayer
+ // scale at source.
+ property_trees()->transform_tree.ComputeTransform(
+ it->render_surface()->TransformTreeIndex(),
+ occlusion_surface->TransformTreeIndex(), &draw_transform);
+ // We don't have to apply sublayer scale when target is root.
+ if (occlusion_surface->TransformTreeIndex() != 0) {
+ draw_property_utils::PostConcatSublayerScale(
+ occlusion_surface->EffectTreeIndex(),
+ property_trees()->effect_tree, &draw_transform);
+ }
+ draw_property_utils::ConcatInverseSublayerScale(
+ it->render_surface()->EffectTreeIndex(),
+ property_trees()->effect_tree, &draw_transform);
+ }
+
Occlusion occlusion =
occlusion_tracker.GetCurrentOcclusionForContributingSurface(
- it->render_surface()->draw_transform());
+ draw_transform);
it->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
@@ -970,8 +991,7 @@ bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) {
inside_replica
? Occlusion()
: occlusion_tracker.GetCurrentOcclusionForContributingSurface(
- it->render_surface()->draw_transform() *
- it->DrawTransform());
+ draw_transform * it->DrawTransform());
mask->draw_properties().occlusion_in_content_space = mask_occlusion;
}
if (LayerImpl* replica_mask =
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/occlusion_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698