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

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

Issue 1912893002: cc : Stop pushing properties not used by LayerImpl to LayerImpl. (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/property_tree_builder.h" 5 #include "cc/trees/property_tree_builder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 464
465 bool IsAnimatingOpacity(Layer* layer) { 465 bool IsAnimatingOpacity(Layer* layer) {
466 return layer->HasPotentiallyRunningOpacityAnimation() || 466 return layer->HasPotentiallyRunningOpacityAnimation() ||
467 layer->OpacityCanAnimateOnImplThread(); 467 layer->OpacityCanAnimateOnImplThread();
468 } 468 }
469 469
470 bool IsAnimatingOpacity(LayerImpl* layer) { 470 bool IsAnimatingOpacity(LayerImpl* layer) {
471 return layer->HasPotentiallyRunningOpacityAnimation(); 471 return layer->HasPotentiallyRunningOpacityAnimation();
472 } 472 }
473 473
474 static inline bool DoubleSided(Layer* layer) {
475 return layer->double_sided();
476 }
477
478 static inline bool DoubleSided(LayerImpl* layer) {
479 return layer->test_properties()->double_sided;
480 }
481
482 static inline bool ForceRenderSurface(Layer* layer) {
483 return layer->force_render_surface();
484 }
485
486 static inline bool ForceRenderSurface(LayerImpl* layer) {
487 return layer->test_properties()->force_render_surface;
488 }
489
474 template <typename LayerType> 490 template <typename LayerType>
475 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { 491 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) {
476 return layer->Is3dSorted() && layer->parent() && 492 return layer->Is3dSorted() && layer->parent() &&
477 layer->parent()->Is3dSorted() && 493 layer->parent()->Is3dSorted() &&
478 (layer->parent()->sorting_context_id() == layer->sorting_context_id()); 494 (layer->parent()->sorting_context_id() == layer->sorting_context_id());
479 } 495 }
480 496
481 template <typename LayerType> 497 template <typename LayerType>
482 bool ShouldCreateRenderSurface(LayerType* layer, 498 bool ShouldCreateRenderSurface(LayerType* layer,
483 gfx::Transform current_transform, 499 gfx::Transform current_transform,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // (layer has transparent background or descendants overflow). 585 // (layer has transparent background or descendants overflow).
570 // https://code.google.com/p/chromium/issues/detail?id=301738 586 // https://code.google.com/p/chromium/issues/detail?id=301738
571 if (layer->is_root_for_isolated_group()) { 587 if (layer->is_root_for_isolated_group()) {
572 TRACE_EVENT_INSTANT0( 588 TRACE_EVENT_INSTANT0(
573 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface isolation", 589 "cc", "PropertyTreeBuilder::ShouldCreateRenderSurface isolation",
574 TRACE_EVENT_SCOPE_THREAD); 590 TRACE_EVENT_SCOPE_THREAD);
575 return true; 591 return true;
576 } 592 }
577 593
578 // If we force it. 594 // If we force it.
579 if (layer->force_render_surface()) 595 if (ForceRenderSurface(layer))
580 return true; 596 return true;
581 597
582 // If we'll make a copy of the layer's contents. 598 // If we'll make a copy of the layer's contents.
583 if (layer->HasCopyRequest()) 599 if (layer->HasCopyRequest())
584 return true; 600 return true;
585 601
586 return false; 602 return false;
587 } 603 }
588 604
589 template <typename LayerType> 605 template <typename LayerType>
(...skipping 23 matching lines...) Expand all
613 return false; 629 return false;
614 } 630 }
615 631
616 EffectNode node; 632 EffectNode node;
617 node.owner_id = layer->id(); 633 node.owner_id = layer->id();
618 node.data.opacity = layer->EffectiveOpacity(); 634 node.data.opacity = layer->EffectiveOpacity();
619 node.data.has_render_surface = should_create_render_surface; 635 node.data.has_render_surface = should_create_render_surface;
620 node.data.has_copy_request = layer->HasCopyRequest(); 636 node.data.has_copy_request = layer->HasCopyRequest();
621 node.data.has_background_filters = !layer->background_filters().IsEmpty(); 637 node.data.has_background_filters = !layer->background_filters().IsEmpty();
622 node.data.has_animated_opacity = has_animated_opacity; 638 node.data.has_animated_opacity = has_animated_opacity;
623 node.data.double_sided = layer->double_sided(); 639 node.data.double_sided = DoubleSided(layer);
624 640
625 if (!is_root) { 641 if (!is_root) {
626 // The effect node's transform id is used only when we create a render 642 // The effect node's transform id is used only when we create a render
627 // surface. So, we can leave the default value when we don't create a render 643 // surface. So, we can leave the default value when we don't create a render
628 // surface. 644 // surface.
629 if (should_create_render_surface) { 645 if (should_create_render_surface) {
630 // In this case, we will create a transform node, so it's safe to use the 646 // In this case, we will create a transform node, so it's safe to use the
631 // next available id from the transform tree as this effect node's 647 // next available id from the transform tree as this effect node's
632 // transform id. 648 // transform id.
633 node.data.transform_id = 649 node.data.transform_id =
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 // should be determined differently depending on whether the layer is in a 767 // should be determined differently depending on whether the layer is in a
752 // "3d rendering context" or not. For Chromium code, we can determine 768 // "3d rendering context" or not. For Chromium code, we can determine
753 // whether we are in a 3d rendering context by checking if the parent 769 // whether we are in a 3d rendering context by checking if the parent
754 // preserves 3d. 770 // preserves 3d.
755 const bool use_local_transform = 771 const bool use_local_transform =
756 !layer->Is3dSorted() || 772 !layer->Is3dSorted() ||
757 (layer->Is3dSorted() && is_at_boundary_of_3d_rendering_context); 773 (layer->Is3dSorted() && is_at_boundary_of_3d_rendering_context);
758 layer->SetUseLocalTransformForBackfaceVisibility(use_local_transform); 774 layer->SetUseLocalTransformForBackfaceVisibility(use_local_transform);
759 775
760 // A double-sided layer's backface can been shown when its visibile. 776 // A double-sided layer's backface can been shown when its visibile.
761 if (layer->double_sided()) 777 if (DoubleSided(layer))
762 layer->SetShouldCheckBackfaceVisibility(false); 778 layer->SetShouldCheckBackfaceVisibility(false);
763 // The backface of a layer that uses local transform for backface visibility 779 // The backface of a layer that uses local transform for backface visibility
764 // is not visible when it does not create a transform node as its local 780 // is not visible when it does not create a transform node as its local
765 // transform is identity or 2d translation and is not animating. 781 // transform is identity or 2d translation and is not animating.
766 else if (use_local_transform && !created_transform_node) 782 else if (use_local_transform && !created_transform_node)
767 layer->SetShouldCheckBackfaceVisibility(false); 783 layer->SetShouldCheckBackfaceVisibility(false);
768 else 784 else
769 layer->SetShouldCheckBackfaceVisibility(true); 785 layer->SetShouldCheckBackfaceVisibility(true);
770 } 786 }
771 } 787 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 if (SkColorGetA(color) != 255) 1020 if (SkColorGetA(color) != 255)
1005 color = SkColorSetA(color, 255); 1021 color = SkColorSetA(color, 255);
1006 BuildPropertyTreesTopLevelInternal( 1022 BuildPropertyTreesTopLevelInternal(
1007 root_layer, page_scale_layer, inner_viewport_scroll_layer, 1023 root_layer, page_scale_layer, inner_viewport_scroll_layer,
1008 outer_viewport_scroll_layer, overscroll_elasticity_layer, 1024 outer_viewport_scroll_layer, overscroll_elasticity_layer,
1009 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 1025 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
1010 device_transform, property_trees, color); 1026 device_transform, property_trees, color);
1011 } 1027 }
1012 1028
1013 } // namespace cc 1029 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698