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

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

Issue 1547893003: WIP - compositor worker mega patch. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 11
12 #include "cc/animation/layer_tree_mutation.h"
12 #include "cc/base/math_util.h" 13 #include "cc/base/math_util.h"
13 #include "cc/layers/layer.h" 14 #include "cc/layers/layer.h"
14 #include "cc/layers/layer_impl.h" 15 #include "cc/layers/layer_impl.h"
15 #include "cc/trees/draw_property_utils.h" 16 #include "cc/trees/draw_property_utils.h"
16 #include "cc/trees/layer_tree_host.h" 17 #include "cc/trees/layer_tree_host.h"
17 #include "ui/gfx/geometry/point_f.h" 18 #include "ui/gfx/geometry/point_f.h"
18 #include "ui/gfx/geometry/vector2d_conversions.h" 19 #include "ui/gfx/geometry/vector2d_conversions.h"
19 20
20 namespace cc { 21 namespace cc {
21 22
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 const bool has_potentially_animated_transform = 232 const bool has_potentially_animated_transform =
232 layer->HasPotentiallyRunningTransformAnimation(); 233 layer->HasPotentiallyRunningTransformAnimation();
233 234
234 // A transform node is needed even for a finished animation, since differences 235 // A transform node is needed even for a finished animation, since differences
235 // in the timing of animation state updates can mean that an animation that's 236 // in the timing of animation state updates can mean that an animation that's
236 // in the Finished state at tree-building time on the main thread is still in 237 // in the Finished state at tree-building time on the main thread is still in
237 // the Running state right after commit on the compositor thread. 238 // the Running state right after commit on the compositor thread.
238 const bool has_any_transform_animation = 239 const bool has_any_transform_animation =
239 layer->HasAnyAnimationTargetingProperty(Animation::TRANSFORM); 240 layer->HasAnyAnimationTargetingProperty(Animation::TRANSFORM);
240 241
242 const bool has_proxied_transform_related_property =
243 layer->mutable_properties() &
244 LayerTreeMutation::MUTATION_TRANSFORM_RELATED;
245
241 const bool has_surface = created_render_surface; 246 const bool has_surface = created_render_surface;
242 247
243 bool requires_node = is_root || is_scrollable || has_significant_transform || 248 bool requires_node = is_root || is_scrollable || has_significant_transform ||
244 has_any_transform_animation || has_surface || is_fixed || 249 has_any_transform_animation || has_surface || is_fixed ||
245 is_page_scale_layer || is_overscroll_elasticity_layer; 250 is_page_scale_layer || is_overscroll_elasticity_layer ||
251 has_proxied_transform_related_property;
246 252
247 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); 253 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer);
248 DCHECK(is_root || transform_parent); 254 DCHECK(is_root || transform_parent);
249 255
250 int parent_index = kRootPropertyTreeNodeId; 256 int parent_index = kRootPropertyTreeNodeId;
251 if (transform_parent) 257 if (transform_parent)
252 parent_index = transform_parent->transform_tree_index(); 258 parent_index = transform_parent->transform_tree_index();
253 259
254 int source_index = parent_index; 260 int source_index = parent_index;
255 261
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } 562 }
557 563
558 template <typename LayerType> 564 template <typename LayerType>
559 bool AddEffectNodeIfNeeded( 565 bool AddEffectNodeIfNeeded(
560 const DataForRecursion<LayerType>& data_from_ancestor, 566 const DataForRecursion<LayerType>& data_from_ancestor,
561 LayerType* layer, 567 LayerType* layer,
562 DataForRecursion<LayerType>* data_for_children) { 568 DataForRecursion<LayerType>* data_for_children) {
563 const bool is_root = !layer->parent(); 569 const bool is_root = !layer->parent();
564 const bool has_transparency = layer->opacity() != 1.f; 570 const bool has_transparency = layer->opacity() != 1.f;
565 const bool has_animated_opacity = IsAnimatingOpacity(layer); 571 const bool has_animated_opacity = IsAnimatingOpacity(layer);
572 const bool has_proxied_opacity =
573 layer->mutable_properties() & LayerTreeMutation::MUTATION_OPACITY;
566 const bool should_create_render_surface = ShouldCreateRenderSurface( 574 const bool should_create_render_surface = ShouldCreateRenderSurface(
567 layer, data_from_ancestor.compound_transform_since_render_target, 575 layer, data_from_ancestor.compound_transform_since_render_target,
568 data_from_ancestor.axis_align_since_render_target); 576 data_from_ancestor.axis_align_since_render_target);
569 data_for_children->axis_align_since_render_target &= 577 data_for_children->axis_align_since_render_target &=
570 layer->AnimationsPreserveAxisAlignment(); 578 layer->AnimationsPreserveAxisAlignment();
571 579
572 bool requires_node = is_root || has_transparency || has_animated_opacity || 580 bool requires_node = is_root || has_transparency || has_animated_opacity ||
573 should_create_render_surface; 581 has_proxied_opacity || should_create_render_surface;
574 582
575 int parent_id = data_from_ancestor.effect_tree_parent; 583 int parent_id = data_from_ancestor.effect_tree_parent;
576 584
577 if (!requires_node) { 585 if (!requires_node) {
578 layer->SetEffectTreeIndex(parent_id); 586 layer->SetEffectTreeIndex(parent_id);
579 data_for_children->effect_tree_parent = parent_id; 587 data_for_children->effect_tree_parent = parent_id;
580 data_for_children->compound_transform_since_render_target *= 588 data_for_children->compound_transform_since_render_target *=
581 layer->transform(); 589 layer->transform();
582 return false; 590 return false;
583 } 591 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 const gfx::Transform& device_transform, 793 const gfx::Transform& device_transform,
786 PropertyTrees* property_trees) { 794 PropertyTrees* property_trees) {
787 BuildPropertyTreesTopLevelInternal( 795 BuildPropertyTreesTopLevelInternal(
788 root_layer, page_scale_layer, inner_viewport_scroll_layer, 796 root_layer, page_scale_layer, inner_viewport_scroll_layer,
789 outer_viewport_scroll_layer, overscroll_elasticity_layer, 797 outer_viewport_scroll_layer, overscroll_elasticity_layer,
790 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 798 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
791 device_transform, property_trees); 799 device_transform, property_trees);
792 } 800 }
793 801
794 } // namespace cc 802 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698