| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 static gfx::Rect TranslateRectToTargetSpace(const LayerImpl& ancestor_layer, | 266 static gfx::Rect TranslateRectToTargetSpace(const LayerImpl& ancestor_layer, |
| 267 const LayerImpl& descendant_layer, | 267 const LayerImpl& descendant_layer, |
| 268 const gfx::Rect& rect, | 268 const gfx::Rect& rect, |
| 269 TranslateRectDirection direction) { | 269 TranslateRectDirection direction) { |
| 270 gfx::Vector2dF translation = | 270 gfx::Vector2dF translation = |
| 271 ComputeChangeOfBasisTranslation(ancestor_layer, descendant_layer); | 271 ComputeChangeOfBasisTranslation(ancestor_layer, descendant_layer); |
| 272 if (direction == TRANSLATE_RECT_DIRECTION_TO_DESCENDANT) | 272 if (direction == TRANSLATE_RECT_DIRECTION_TO_DESCENDANT) |
| 273 translation.Scale(-1.f); | 273 translation.Scale(-1.f); |
| 274 gfx::RectF rect_f = gfx::RectF(rect); |
| 274 return gfx::ToEnclosingRect( | 275 return gfx::ToEnclosingRect( |
| 275 gfx::RectF(rect.origin() + translation, rect.size())); | 276 gfx::RectF(rect_f.origin() + translation, rect_f.size())); |
| 276 } | 277 } |
| 277 | 278 |
| 278 // Attempts to update the clip rects for the given layer. If the layer has a | 279 // Attempts to update the clip rects for the given layer. If the layer has a |
| 279 // clip_parent, it may not inherit its immediate ancestor's clip. | 280 // clip_parent, it may not inherit its immediate ancestor's clip. |
| 280 static void UpdateClipRectsForClipChild( | 281 static void UpdateClipRectsForClipChild( |
| 281 const LayerImpl* layer, | 282 const LayerImpl* layer, |
| 282 gfx::Rect* clip_rect_in_parent_target_space, | 283 gfx::Rect* clip_rect_in_parent_target_space, |
| 283 bool* subtree_should_be_clipped) { | 284 bool* subtree_should_be_clipped) { |
| 284 // If the layer has no clip_parent, or the ancestor is the same as its actual | 285 // If the layer has no clip_parent, or the ancestor is the same as its actual |
| 285 // parent, then we don't need special clip rects. Bail now and leave the out | 286 // parent, then we don't need special clip rects. Bail now and leave the out |
| (...skipping 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2765 | 2766 |
| 2766 PropertyTrees* GetPropertyTrees(Layer* layer) { | 2767 PropertyTrees* GetPropertyTrees(Layer* layer) { |
| 2767 return layer->layer_tree_host()->property_trees(); | 2768 return layer->layer_tree_host()->property_trees(); |
| 2768 } | 2769 } |
| 2769 | 2770 |
| 2770 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { | 2771 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { |
| 2771 return layer->layer_tree_impl()->property_trees(); | 2772 return layer->layer_tree_impl()->property_trees(); |
| 2772 } | 2773 } |
| 2773 | 2774 |
| 2774 } // namespace cc | 2775 } // namespace cc |
| OLD | NEW |