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

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

Issue 2423483003: cc: Make visible rect computation aware of pixel-moving filters (Closed)
Patch Set: Rebase Created 4 years, 1 month 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>
11 11
12 #include "base/memory/ptr_util.h"
12 #include "cc/animation/animation_host.h" 13 #include "cc/animation/animation_host.h"
13 #include "cc/animation/mutable_properties.h" 14 #include "cc/animation/mutable_properties.h"
14 #include "cc/base/math_util.h" 15 #include "cc/base/math_util.h"
15 #include "cc/layers/layer.h" 16 #include "cc/layers/layer.h"
16 #include "cc/layers/layer_impl.h" 17 #include "cc/layers/layer_impl.h"
17 #include "cc/output/copy_output_request.h" 18 #include "cc/output/copy_output_request.h"
18 #include "cc/trees/clip_node.h" 19 #include "cc/trees/clip_node.h"
19 #include "cc/trees/draw_property_utils.h" 20 #include "cc/trees/draw_property_utils.h"
20 #include "cc/trees/effect_node.h" 21 #include "cc/trees/effect_node.h"
21 #include "cc/trees/layer_tree_impl.h" 22 #include "cc/trees/layer_tree_impl.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 219 }
219 220
220 static size_t NumUnclippedDescendants(Layer* layer) { 221 static size_t NumUnclippedDescendants(Layer* layer) {
221 return layer->num_unclipped_descendants(); 222 return layer->num_unclipped_descendants();
222 } 223 }
223 224
224 static size_t NumUnclippedDescendants(LayerImpl* layer) { 225 static size_t NumUnclippedDescendants(LayerImpl* layer) {
225 return layer->test_properties()->num_unclipped_descendants; 226 return layer->test_properties()->num_unclipped_descendants;
226 } 227 }
227 228
229 static inline const FilterOperations& Filters(Layer* layer) {
230 return layer->filters();
231 }
232
233 static inline const FilterOperations& Filters(LayerImpl* layer) {
234 return layer->test_properties()->filters;
235 }
236
228 static Layer* MaskLayer(Layer* layer) { 237 static Layer* MaskLayer(Layer* layer) {
229 return layer->mask_layer(); 238 return layer->mask_layer();
230 } 239 }
231 240
232 static LayerImpl* MaskLayer(LayerImpl* layer) { 241 static LayerImpl* MaskLayer(LayerImpl* layer) {
233 return layer->test_properties()->mask_layer; 242 return layer->test_properties()->mask_layer;
234 } 243 }
235 244
236 static const gfx::Transform& Transform(Layer* layer) { 245 static const gfx::Transform& Transform(Layer* layer) {
237 return layer->transform(); 246 return layer->transform();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // clipping state from ancestors must continue to get propagated. 431 // clipping state from ancestors must continue to get propagated.
423 node.layer_clipping_uses_only_local_clip = 432 node.layer_clipping_uses_only_local_clip =
424 (created_render_surface && NumUnclippedDescendants(layer) == 0) || 433 (created_render_surface && NumUnclippedDescendants(layer) == 0) ||
425 !ancestor_clips_subtree; 434 !ancestor_clips_subtree;
426 } else { 435 } else {
427 // Otherwise, we're either unclipped, or exist only in order to apply our 436 // Otherwise, we're either unclipped, or exist only in order to apply our
428 // parent's clips in our space. 437 // parent's clips in our space.
429 node.layer_clipping_uses_only_local_clip = false; 438 node.layer_clipping_uses_only_local_clip = false;
430 } 439 }
431 440
432 if (layer_clips_subtree) 441 if (layer_clips_subtree) {
433 node.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP; 442 node.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP;
434 else 443 } else if (Filters(layer).HasFilterThatMovesPixels()) {
444 node.clip_type = ClipNode::ClipType::EXPANDS_CLIP;
445 node.clip_expander = base::MakeUnique<ClipExpander>(
446 ClipExpander::ExpanderType::FILTER, layer->effect_tree_index());
447 } else {
435 node.clip_type = ClipNode::ClipType::NONE; 448 node.clip_type = ClipNode::ClipType::NONE;
449 }
436 node.resets_clip = has_unclipped_surface; 450 node.resets_clip = has_unclipped_surface;
437 node.target_is_clipped = data_for_children->target_is_clipped; 451 node.target_is_clipped = data_for_children->target_is_clipped;
438 node.layers_are_clipped = layers_are_clipped; 452 node.layers_are_clipped = layers_are_clipped;
439 node.layers_are_clipped_when_surfaces_disabled = 453 node.layers_are_clipped_when_surfaces_disabled =
440 layers_are_clipped_when_surfaces_disabled; 454 layers_are_clipped_when_surfaces_disabled;
441 455
442 data_for_children->clip_tree_parent = 456 data_for_children->clip_tree_parent =
443 data_for_children->property_trees->clip_tree.Insert(node, parent_id); 457 data_for_children->property_trees->clip_tree.Insert(node, parent_id);
444 data_for_children->property_trees->clip_id_to_index_map[layer->id()] = 458 data_for_children->property_trees->clip_id_to_index_map[layer->id()] =
445 data_for_children->clip_tree_parent; 459 data_for_children->clip_tree_parent;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 } 817 }
804 818
805 static inline SkXfermode::Mode BlendMode(Layer* layer) { 819 static inline SkXfermode::Mode BlendMode(Layer* layer) {
806 return layer->blend_mode(); 820 return layer->blend_mode();
807 } 821 }
808 822
809 static inline SkXfermode::Mode BlendMode(LayerImpl* layer) { 823 static inline SkXfermode::Mode BlendMode(LayerImpl* layer) {
810 return layer->test_properties()->blend_mode; 824 return layer->test_properties()->blend_mode;
811 } 825 }
812 826
813 static inline const FilterOperations& Filters(Layer* layer) {
814 return layer->filters();
815 }
816
817 static inline const gfx::PointF FiltersOrigin(Layer* layer) { 827 static inline const gfx::PointF FiltersOrigin(Layer* layer) {
818 return layer->filters_origin(); 828 return layer->filters_origin();
819 } 829 }
820 830
821 static inline const gfx::PointF FiltersOrigin(LayerImpl* layer) { 831 static inline const gfx::PointF FiltersOrigin(LayerImpl* layer) {
822 return layer->test_properties()->filters_origin; 832 return layer->test_properties()->filters_origin;
823 } 833 }
824 834
825 static inline const FilterOperations& Filters(LayerImpl* layer) {
826 return layer->test_properties()->filters;
827 }
828
829 static inline const FilterOperations& BackgroundFilters(Layer* layer) { 835 static inline const FilterOperations& BackgroundFilters(Layer* layer) {
830 return layer->background_filters(); 836 return layer->background_filters();
831 } 837 }
832 838
833 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) { 839 static inline const FilterOperations& BackgroundFilters(LayerImpl* layer) {
834 return layer->test_properties()->background_filters; 840 return layer->test_properties()->background_filters;
835 } 841 }
836 842
837 static inline bool HideLayerAndSubtree(Layer* layer) { 843 static inline bool HideLayerAndSubtree(Layer* layer) {
838 return layer->hide_layer_and_subtree(); 844 return layer->hide_layer_and_subtree();
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 color = SkColorSetA(color, 255); 1497 color = SkColorSetA(color, 255);
1492 BuildPropertyTreesTopLevelInternal( 1498 BuildPropertyTreesTopLevelInternal(
1493 root_layer, page_scale_layer, inner_viewport_scroll_layer, 1499 root_layer, page_scale_layer, inner_viewport_scroll_layer,
1494 outer_viewport_scroll_layer, overscroll_elasticity_layer, 1500 outer_viewport_scroll_layer, overscroll_elasticity_layer,
1495 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 1501 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
1496 device_transform, property_trees, color); 1502 device_transform, property_trees, color);
1497 property_trees->ResetCachedData(); 1503 property_trees->ResetCachedData();
1498 } 1504 }
1499 1505
1500 } // namespace cc 1506 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698