| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/debug_rect_history.h" | 5 #include "cc/trees/debug_rect_history.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| 11 #include "cc/layers/layer_impl.h" | 11 #include "cc/layers/layer_impl.h" |
| 12 #include "cc/layers/layer_iterator.h" | |
| 13 #include "cc/layers/layer_list_iterator.h" | 12 #include "cc/layers/layer_list_iterator.h" |
| 14 #include "cc/layers/layer_utils.h" | 13 #include "cc/layers/layer_utils.h" |
| 15 #include "cc/layers/render_surface_impl.h" | 14 #include "cc/layers/render_surface_impl.h" |
| 16 #include "cc/trees/damage_tracker.h" | 15 #include "cc/trees/damage_tracker.h" |
| 17 #include "cc/trees/layer_tree_host.h" | 16 #include "cc/trees/layer_tree_host.h" |
| 18 #include "cc/trees/layer_tree_host_common.h" | 17 #include "cc/trees/layer_tree_host_common.h" |
| 19 #include "cc/trees/layer_tree_impl.h" | 18 #include "cc/trees/layer_tree_impl.h" |
| 20 #include "ui/gfx/geometry/rect_conversions.h" | 19 #include "ui/gfx/geometry/rect_conversions.h" |
| 21 | 20 |
| 22 namespace cc { | 21 namespace cc { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 if (debug_state.show_property_changed_rects) | 56 if (debug_state.show_property_changed_rects) |
| 58 SavePropertyChangedRects(render_surface_layer_list, hud_layer); | 57 SavePropertyChangedRects(render_surface_layer_list, hud_layer); |
| 59 | 58 |
| 60 if (debug_state.show_surface_damage_rects) | 59 if (debug_state.show_surface_damage_rects) |
| 61 SaveSurfaceDamageRects(render_surface_layer_list); | 60 SaveSurfaceDamageRects(render_surface_layer_list); |
| 62 | 61 |
| 63 if (debug_state.show_screen_space_rects) | 62 if (debug_state.show_screen_space_rects) |
| 64 SaveScreenSpaceRects(render_surface_layer_list); | 63 SaveScreenSpaceRects(render_surface_layer_list); |
| 65 | 64 |
| 66 if (debug_state.show_layer_animation_bounds_rects) | 65 if (debug_state.show_layer_animation_bounds_rects) |
| 67 SaveLayerAnimationBoundsRects(render_surface_layer_list); | 66 SaveLayerAnimationBoundsRects(tree_impl); |
| 68 } | 67 } |
| 69 | 68 |
| 70 void DebugRectHistory::SavePaintRects(LayerTreeImpl* tree_impl) { | 69 void DebugRectHistory::SavePaintRects(LayerTreeImpl* tree_impl) { |
| 71 // We would like to visualize where any layer's paint rect (update rect) has | 70 // We would like to visualize where any layer's paint rect (update rect) has |
| 72 // changed, regardless of whether this layer is skipped for actual drawing or | 71 // changed, regardless of whether this layer is skipped for actual drawing or |
| 73 // not. Therefore we traverse over all layers, not just the render surface | 72 // not. Therefore we traverse over all layers, not just the render surface |
| 74 // list. | 73 // list. |
| 75 for (auto* layer : *tree_impl) { | 74 for (auto* layer : *tree_impl) { |
| 76 Region invalidation_region = layer->GetInvalidationRegionForDebugging(); | 75 Region invalidation_region = layer->GetInvalidationRegionForDebugging(); |
| 77 if (invalidation_region.IsEmpty() || !layer->DrawsContent()) | 76 if (invalidation_region.IsEmpty() || !layer->DrawsContent()) |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { | 209 void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) { |
| 211 for (Region::Iterator iter(layer->non_fast_scrollable_region()); | 210 for (Region::Iterator iter(layer->non_fast_scrollable_region()); |
| 212 iter.has_rect(); iter.next()) { | 211 iter.has_rect(); iter.next()) { |
| 213 debug_rects_.push_back( | 212 debug_rects_.push_back( |
| 214 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, | 213 DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, |
| 215 MathUtil::MapEnclosingClippedRect( | 214 MathUtil::MapEnclosingClippedRect( |
| 216 layer->ScreenSpaceTransform(), iter.rect()))); | 215 layer->ScreenSpaceTransform(), iter.rect()))); |
| 217 } | 216 } |
| 218 } | 217 } |
| 219 | 218 |
| 220 void DebugRectHistory::SaveLayerAnimationBoundsRects( | 219 void DebugRectHistory::SaveLayerAnimationBoundsRects(LayerTreeImpl* tree_impl) { |
| 221 const LayerImplList& render_surface_layer_list) { | 220 for (auto it = tree_impl->rbegin(); it != tree_impl->rend(); ++it) { |
| 222 LayerIterator end = LayerIterator::End(&render_surface_layer_list); | 221 if (!(*it)->is_drawn_render_surface_layer_list_member()) |
| 223 for (LayerIterator it = LayerIterator::Begin(&render_surface_layer_list); | |
| 224 it != end; ++it) { | |
| 225 if (!it.represents_itself()) | |
| 226 continue; | 222 continue; |
| 227 | 223 |
| 228 // TODO(avallee): Figure out if we should show something for a layer who's | 224 // TODO(avallee): Figure out if we should show something for a layer who's |
| 229 // animating bounds but that we can't compute them. | 225 // animating bounds but that we can't compute them. |
| 230 gfx::BoxF inflated_bounds; | 226 gfx::BoxF inflated_bounds; |
| 231 if (!LayerUtils::GetAnimationBounds(**it, &inflated_bounds)) | 227 if (!LayerUtils::GetAnimationBounds(**it, &inflated_bounds)) |
| 232 continue; | 228 continue; |
| 233 | 229 |
| 234 debug_rects_.push_back( | 230 debug_rects_.push_back( |
| 235 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | 231 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, |
| 236 gfx::ToEnclosingRect(gfx::RectF( | 232 gfx::ToEnclosingRect(gfx::RectF( |
| 237 inflated_bounds.x(), inflated_bounds.y(), | 233 inflated_bounds.x(), inflated_bounds.y(), |
| 238 inflated_bounds.width(), inflated_bounds.height())))); | 234 inflated_bounds.width(), inflated_bounds.height())))); |
| 239 } | 235 } |
| 240 } | 236 } |
| 241 | 237 |
| 242 } // namespace cc | 238 } // namespace cc |
| OLD | NEW |