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

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 4 years, 11 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
« 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/mutable_properties.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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 const bool has_potentially_animated_transform = 216 const bool has_potentially_animated_transform =
216 layer->HasPotentiallyRunningTransformAnimation(); 217 layer->HasPotentiallyRunningTransformAnimation();
217 218
218 // A transform node is needed even for a finished animation, since differences 219 // A transform node is needed even for a finished animation, since differences
219 // in the timing of animation state updates can mean that an animation that's 220 // in the timing of animation state updates can mean that an animation that's
220 // in the Finished state at tree-building time on the main thread is still in 221 // in the Finished state at tree-building time on the main thread is still in
221 // the Running state right after commit on the compositor thread. 222 // the Running state right after commit on the compositor thread.
222 const bool has_any_transform_animation = 223 const bool has_any_transform_animation =
223 layer->HasAnyAnimationTargetingProperty(Animation::TRANSFORM); 224 layer->HasAnyAnimationTargetingProperty(Animation::TRANSFORM);
224 225
226 const bool has_proxied_transform_related_property =
227 layer->mutable_properties() & kMutablePropertyTransformRelated;
228
225 const bool has_surface = created_render_surface; 229 const bool has_surface = created_render_surface;
226 230
227 bool requires_node = is_root || is_scrollable || has_significant_transform || 231 bool requires_node = is_root || is_scrollable || has_significant_transform ||
228 has_any_transform_animation || has_surface || is_fixed || 232 has_any_transform_animation || has_surface || is_fixed ||
229 is_page_scale_layer || is_overscroll_elasticity_layer; 233 is_page_scale_layer || is_overscroll_elasticity_layer ||
234 has_proxied_transform_related_property;
230 235
231 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer); 236 LayerType* transform_parent = GetTransformParent(data_from_ancestor, layer);
232 DCHECK(is_root || transform_parent); 237 DCHECK(is_root || transform_parent);
233 238
234 int parent_index = kRootPropertyTreeNodeId; 239 int parent_index = kRootPropertyTreeNodeId;
235 if (transform_parent) 240 if (transform_parent)
236 parent_index = transform_parent->transform_tree_index(); 241 parent_index = transform_parent->transform_tree_index();
237 242
238 int source_index = parent_index; 243 int source_index = parent_index;
239 244
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 } 548 }
544 549
545 template <typename LayerType> 550 template <typename LayerType>
546 bool AddEffectNodeIfNeeded( 551 bool AddEffectNodeIfNeeded(
547 const DataForRecursion<LayerType>& data_from_ancestor, 552 const DataForRecursion<LayerType>& data_from_ancestor,
548 LayerType* layer, 553 LayerType* layer,
549 DataForRecursion<LayerType>* data_for_children) { 554 DataForRecursion<LayerType>* data_for_children) {
550 const bool is_root = !layer->parent(); 555 const bool is_root = !layer->parent();
551 const bool has_transparency = layer->opacity() != 1.f; 556 const bool has_transparency = layer->opacity() != 1.f;
552 const bool has_animated_opacity = IsAnimatingOpacity(layer); 557 const bool has_animated_opacity = IsAnimatingOpacity(layer);
558 const bool has_proxied_opacity =
559 layer->mutable_properties() & kMutablePropertyOpacity;
553 const bool should_create_render_surface = ShouldCreateRenderSurface( 560 const bool should_create_render_surface = ShouldCreateRenderSurface(
554 layer, data_from_ancestor.compound_transform_since_render_target, 561 layer, data_from_ancestor.compound_transform_since_render_target,
555 data_from_ancestor.axis_align_since_render_target); 562 data_from_ancestor.axis_align_since_render_target);
556 data_for_children->axis_align_since_render_target &= 563 data_for_children->axis_align_since_render_target &=
557 layer->AnimationsPreserveAxisAlignment(); 564 layer->AnimationsPreserveAxisAlignment();
558 565
559 bool requires_node = is_root || has_transparency || has_animated_opacity || 566 bool requires_node = is_root || has_transparency || has_animated_opacity ||
560 should_create_render_surface; 567 has_proxied_opacity || should_create_render_surface;
561 568
562 int parent_id = data_from_ancestor.effect_tree_parent; 569 int parent_id = data_from_ancestor.effect_tree_parent;
563 570
564 if (!requires_node) { 571 if (!requires_node) {
565 layer->SetEffectTreeIndex(parent_id); 572 layer->SetEffectTreeIndex(parent_id);
566 data_for_children->effect_tree_parent = parent_id; 573 data_for_children->effect_tree_parent = parent_id;
567 data_for_children->compound_transform_since_render_target *= 574 data_for_children->compound_transform_since_render_target *=
568 layer->transform(); 575 layer->transform();
569 return false; 576 return false;
570 } 577 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 const gfx::Transform& device_transform, 802 const gfx::Transform& device_transform,
796 PropertyTrees* property_trees) { 803 PropertyTrees* property_trees) {
797 BuildPropertyTreesTopLevelInternal( 804 BuildPropertyTreesTopLevelInternal(
798 root_layer, page_scale_layer, inner_viewport_scroll_layer, 805 root_layer, page_scale_layer, inner_viewport_scroll_layer,
799 outer_viewport_scroll_layer, overscroll_elasticity_layer, 806 outer_viewport_scroll_layer, overscroll_elasticity_layer,
800 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 807 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
801 device_transform, property_trees); 808 device_transform, property_trees);
802 } 809 }
803 810
804 } // namespace cc 811 } // 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