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

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 217313003: Stop displaying layers with non-invertible transforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 bool can_accept_input = !layer->touch_event_handler_region().IsEmpty() || 471 bool can_accept_input = !layer->touch_event_handler_region().IsEmpty() ||
472 layer->have_wheel_event_handlers(); 472 layer->have_wheel_event_handlers();
473 if (!layer->DrawsContent() && !can_accept_input) 473 if (!layer->DrawsContent() && !can_accept_input)
474 return true; 474 return true;
475 475
476 return false; 476 return false;
477 } 477 }
478 478
479 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer, 479 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer,
480 bool layer_is_drawn) { 480 bool layer_is_drawn) {
481 // If the layer transform is not invertible, it should not be drawn.
482 if (!layer->transform_is_invertible())
ajuma 2014/03/28 18:49:07 Can this early-out interact negatively with readba
avallee 2014/04/15 18:53:25 Yes, we do. The spec is all about requiring that i
ajuma 2014/04/15 19:45:10 I agree with not drawing it, but I'm worried that
avallee 2014/04/16 18:20:56 Done. Won't skip on animated transform. Fix for se
483 return true;
484
481 // When we need to do a readback/copy of a layer's output, we can not skip 485 // When we need to do a readback/copy of a layer's output, we can not skip
482 // it or any of its ancestors. 486 // it or any of its ancestors.
483 if (layer->draw_properties().layer_or_descendant_has_copy_request) 487 if (layer->draw_properties().layer_or_descendant_has_copy_request)
484 return false; 488 return false;
485 489
486 // If the layer is not drawn, then skip it and its subtree. 490 // If the layer is not drawn, then skip it and its subtree.
487 if (!layer_is_drawn) 491 if (!layer_is_drawn)
488 return true; 492 return true;
489 493
490 // If layer is on the pending tree and opacity is being animated then 494 // If layer is on the pending tree and opacity is being animated then
491 // this subtree can't be skipped as we need to create, prioritize and 495 // this subtree can't be skipped as we need to create, prioritize and
492 // include tiles for this layer when deciding if tree can be activated. 496 // include tiles for this layer when deciding if tree can be activated.
493 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating()) 497 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating())
494 return false; 498 return false;
495 499
496 // The opacity of a layer always applies to its children (either implicitly 500 // The opacity of a layer always applies to its children (either implicitly
497 // via a render surface or explicitly if the parent preserves 3D), so the 501 // via a render surface or explicitly if the parent preserves 3D), so the
498 // entire subtree can be skipped if this layer is fully transparent. 502 // entire subtree can be skipped if this layer is fully transparent.
499 // TODO(sad): Don't skip layers used for hit testing crbug.com/295295. 503 // TODO(sad): Don't skip layers used for hit testing crbug.com/295295.
500 return !layer->opacity(); 504 return !layer->opacity();
501 } 505 }
502 506
503 static inline bool SubtreeShouldBeSkipped(Layer* layer, bool layer_is_drawn) { 507 static inline bool SubtreeShouldBeSkipped(Layer* layer, bool layer_is_drawn) {
508 // If the layer transform is not invertible, it should not be drawn.
509 if (!layer->transform_is_invertible())
ajuma 2014/03/28 18:49:07 Same questions as above about readback and animati
avallee 2014/04/15 18:53:25 See above.
510 return true;
511
504 // When we need to do a readback/copy of a layer's output, we can not skip 512 // When we need to do a readback/copy of a layer's output, we can not skip
505 // it or any of its ancestors. 513 // it or any of its ancestors.
506 if (layer->draw_properties().layer_or_descendant_has_copy_request) 514 if (layer->draw_properties().layer_or_descendant_has_copy_request)
507 return false; 515 return false;
508 516
509 // If the layer is not drawn, then skip it and its subtree. 517 // If the layer is not drawn, then skip it and its subtree.
510 if (!layer_is_drawn) 518 if (!layer_is_drawn)
511 return true; 519 return true;
512 520
513 // If the opacity is being animated then the opacity on the main thread is 521 // If the opacity is being animated then the opacity on the main thread is
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 1071
1064 // Recursively walks the layer tree to compute any information that is needed 1072 // Recursively walks the layer tree to compute any information that is needed
1065 // before doing the main recursion. 1073 // before doing the main recursion.
1066 template <typename LayerType> 1074 template <typename LayerType>
1067 static void PreCalculateMetaInformation( 1075 static void PreCalculateMetaInformation(
1068 LayerType* layer, 1076 LayerType* layer,
1069 PreCalculateMetaInformationRecursiveData* recursive_data) { 1077 PreCalculateMetaInformationRecursiveData* recursive_data) {
1070 bool has_delegated_content = layer->HasDelegatedContent(); 1078 bool has_delegated_content = layer->HasDelegatedContent();
1071 int num_descendants_that_draw_content = 0; 1079 int num_descendants_that_draw_content = 0;
1072 1080
1081 if (!layer->transform_is_invertible()) {
ajuma 2014/03/28 18:49:07 Should we check if transform is animating? (e.g. S
avallee 2014/04/15 18:53:25 Yes we do.
ajuma 2014/04/15 19:45:10 We do want to skip, or we do check? (I don't see t
avallee 2014/04/16 18:20:56 Let's check for now and this will need to be chang
1082 // Layers with singular transforms should not be drawn, the whole subtree
1083 // can be skipped.
1084 return;
1085 }
1086
1073 if (has_delegated_content) { 1087 if (has_delegated_content) {
1074 // Layers with delegated content need to be treated as if they have as 1088 // Layers with delegated content need to be treated as if they have as
1075 // many children as the number of layers they own delegated quads for. 1089 // many children as the number of layers they own delegated quads for.
1076 // Since we don't know this number right now, we choose one that acts like 1090 // Since we don't know this number right now, we choose one that acts like
1077 // infinity for our purposes. 1091 // infinity for our purposes.
1078 num_descendants_that_draw_content = 1000; 1092 num_descendants_that_draw_content = 1000;
1079 } 1093 }
1080 1094
1081 layer->draw_properties().sorted_for_recursion = false; 1095 layer->draw_properties().sorted_for_recursion = false;
1082 layer->draw_properties().has_child_with_a_scroll_parent = false; 1096 layer->draw_properties().has_child_with_a_scroll_parent = false;
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 // At this point, we think the point does hit the touch event handler region 2411 // At this point, we think the point does hit the touch event handler region
2398 // on the layer, but we need to walk up the parents to ensure that the layer 2412 // on the layer, but we need to walk up the parents to ensure that the layer
2399 // was not clipped in such a way that the hit point actually should not hit 2413 // was not clipped in such a way that the hit point actually should not hit
2400 // the layer. 2414 // the layer.
2401 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) 2415 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl))
2402 return false; 2416 return false;
2403 2417
2404 return true; 2418 return true;
2405 } 2419 }
2406 } // namespace cc 2420 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698