| OLD | NEW |
| 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/draw_property_utils.h" | 5 #include "cc/trees/draw_property_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 static bool IsRootLayer(const Layer* layer) { | 27 static bool IsRootLayer(const Layer* layer) { |
| 28 return !layer->parent(); | 28 return !layer->parent(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 static bool IsRootLayer(const LayerImpl* layer) { | 31 static bool IsRootLayer(const LayerImpl* layer) { |
| 32 return layer->layer_tree_impl()->IsRootLayer(layer); | 32 return layer->layer_tree_impl()->IsRootLayer(layer); |
| 33 } | 33 } |
| 34 | 34 |
| 35 #if DCHECK_IS_ON() | 35 #if DCHECK_IS_ON() |
| 36 static LayerImpl* EffectNodeOwner(LayerImpl* layer) { | |
| 37 EffectNode* node = | |
| 38 layer->layer_tree_impl()->property_trees()->effect_tree.Node( | |
| 39 layer->effect_tree_index()); | |
| 40 return layer->layer_tree_impl()->LayerById(node->owner_id); | |
| 41 } | |
| 42 | |
| 43 static void ValidateRenderSurfaceForLayer(LayerImpl* layer) { | 36 static void ValidateRenderSurfaceForLayer(LayerImpl* layer) { |
| 44 // This test verifies that there are no cases where a LayerImpl needs | 37 // This test verifies that there are no cases where a LayerImpl needs |
| 45 // a render surface, but doesn't have one. | 38 // a render surface, but doesn't have one. |
| 46 if (layer->has_render_surface()) | 39 if (layer->has_render_surface()) |
| 47 return; | 40 return; |
| 48 | 41 |
| 49 DCHECK(layer->filters().IsEmpty()) << "layer: " << layer->id(); | 42 DCHECK(layer->filters().IsEmpty()) << "layer: " << layer->id(); |
| 50 DCHECK(layer->background_filters().IsEmpty()) << "layer: " << layer->id(); | 43 DCHECK(layer->background_filters().IsEmpty()) << "layer: " << layer->id(); |
| 51 DCHECK(!IsRootLayer(layer)) << "layer: " << layer->id(); | 44 DCHECK(!IsRootLayer(layer)) << "layer: " << layer->id(); |
| 52 if (EffectNodeOwner(layer)->replica_layer() == layer) | 45 EffectNode* effect_node = |
| 46 layer->layer_tree_impl()->property_trees()->effect_tree.Node( |
| 47 layer->effect_tree_index()); |
| 48 if (effect_node->owner_id != layer->id()) |
| 53 return; | 49 return; |
| 54 DCHECK(!layer->mask_layer()) << "layer: " << layer->id(); | 50 DCHECK_EQ(effect_node->data.mask_layer_id, -1) << "layer: " << layer->id(); |
| 55 DCHECK(!layer->replica_layer()) << "layer: " << layer->id(); | 51 DCHECK_EQ(effect_node->data.replica_layer_id, -1) << "layer: " << layer->id(); |
| 56 } | 52 } |
| 57 | 53 |
| 58 #endif | 54 #endif |
| 59 | 55 |
| 60 template <typename LayerType> | 56 template <typename LayerType> |
| 61 bool ComputeClipRectInTargetSpace(const LayerType* layer, | 57 bool ComputeClipRectInTargetSpace(const LayerType* layer, |
| 62 const ClipNode* clip_node, | 58 const ClipNode* clip_node, |
| 63 const TransformTree& transform_tree, | 59 const TransformTree& transform_tree, |
| 64 int target_node_id, | 60 int target_node_id, |
| 65 gfx::RectF* clip_rect_in_target_space) { | 61 gfx::RectF* clip_rect_in_target_space) { |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 void UpdateElasticOverscroll(PropertyTrees* property_trees, | 1318 void UpdateElasticOverscroll(PropertyTrees* property_trees, |
| 1323 const Layer* overscroll_elasticity_layer, | 1319 const Layer* overscroll_elasticity_layer, |
| 1324 const gfx::Vector2dF& elastic_overscroll) { | 1320 const gfx::Vector2dF& elastic_overscroll) { |
| 1325 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, | 1321 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, |
| 1326 elastic_overscroll); | 1322 elastic_overscroll); |
| 1327 } | 1323 } |
| 1328 | 1324 |
| 1329 } // namespace draw_property_utils | 1325 } // namespace draw_property_utils |
| 1330 | 1326 |
| 1331 } // namespace cc | 1327 } // namespace cc |
| OLD | NEW |