| 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/debug/debug_rect_history.h" | 5 #include "cc/debug/debug_rect_history.h" |
| 6 | 6 |
| 7 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
| 8 #include "cc/layers/layer_impl.h" | 8 #include "cc/layers/layer_impl.h" |
| 9 #include "cc/layers/layer_iterator.h" | 9 #include "cc/layers/layer_iterator.h" |
| 10 #include "cc/layers/layer_utils.h" | 10 #include "cc/layers/layer_utils.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 DebugRectHistory::DebugRectHistory() {} | 24 DebugRectHistory::DebugRectHistory() {} |
| 25 | 25 |
| 26 DebugRectHistory::~DebugRectHistory() {} | 26 DebugRectHistory::~DebugRectHistory() {} |
| 27 | 27 |
| 28 void DebugRectHistory::SaveDebugRectsForCurrentFrame( | 28 void DebugRectHistory::SaveDebugRectsForCurrentFrame( |
| 29 LayerImpl* root_layer, | 29 LayerImpl* root_layer, |
| 30 LayerImpl* hud_layer, | 30 LayerImpl* hud_layer, |
| 31 const LayerImplList& render_surface_layer_list, | 31 const LayerImplList& render_surface_layer_list, |
| 32 const std::vector<gfx::Rect>& occluding_screen_space_rects, | |
| 33 const std::vector<gfx::Rect>& non_occluding_screen_space_rects, | |
| 34 const LayerTreeDebugState& debug_state) { | 32 const LayerTreeDebugState& debug_state) { |
| 35 // For now, clear all rects from previous frames. In the future we may want to | 33 // For now, clear all rects from previous frames. In the future we may want to |
| 36 // store all debug rects for a history of many frames. | 34 // store all debug rects for a history of many frames. |
| 37 debug_rects_.clear(); | 35 debug_rects_.clear(); |
| 38 | 36 |
| 39 if (debug_state.show_touch_event_handler_rects) | 37 if (debug_state.show_touch_event_handler_rects) |
| 40 SaveTouchEventHandlerRects(root_layer); | 38 SaveTouchEventHandlerRects(root_layer); |
| 41 | 39 |
| 42 if (debug_state.show_wheel_event_handler_rects) | 40 if (debug_state.show_wheel_event_handler_rects) |
| 43 SaveWheelEventHandlerRects(root_layer); | 41 SaveWheelEventHandlerRects(root_layer); |
| 44 | 42 |
| 45 if (debug_state.show_scroll_event_handler_rects) | 43 if (debug_state.show_scroll_event_handler_rects) |
| 46 SaveScrollEventHandlerRects(root_layer); | 44 SaveScrollEventHandlerRects(root_layer); |
| 47 | 45 |
| 48 if (debug_state.show_non_fast_scrollable_rects) | 46 if (debug_state.show_non_fast_scrollable_rects) |
| 49 SaveNonFastScrollableRects(root_layer); | 47 SaveNonFastScrollableRects(root_layer); |
| 50 | 48 |
| 51 if (debug_state.show_paint_rects) | 49 if (debug_state.show_paint_rects) |
| 52 SavePaintRects(root_layer); | 50 SavePaintRects(root_layer); |
| 53 | 51 |
| 54 if (debug_state.show_property_changed_rects) | 52 if (debug_state.show_property_changed_rects) |
| 55 SavePropertyChangedRects(render_surface_layer_list, hud_layer); | 53 SavePropertyChangedRects(render_surface_layer_list, hud_layer); |
| 56 | 54 |
| 57 if (debug_state.show_surface_damage_rects) | 55 if (debug_state.show_surface_damage_rects) |
| 58 SaveSurfaceDamageRects(render_surface_layer_list); | 56 SaveSurfaceDamageRects(render_surface_layer_list); |
| 59 | 57 |
| 60 if (debug_state.show_screen_space_rects) | 58 if (debug_state.show_screen_space_rects) |
| 61 SaveScreenSpaceRects(render_surface_layer_list); | 59 SaveScreenSpaceRects(render_surface_layer_list); |
| 62 | 60 |
| 63 if (debug_state.show_occluding_rects) | |
| 64 SaveOccludingRects(occluding_screen_space_rects); | |
| 65 | |
| 66 if (debug_state.show_non_occluding_rects) | |
| 67 SaveNonOccludingRects(non_occluding_screen_space_rects); | |
| 68 | |
| 69 if (debug_state.show_layer_animation_bounds_rects) | 61 if (debug_state.show_layer_animation_bounds_rects) |
| 70 SaveLayerAnimationBoundsRects(render_surface_layer_list); | 62 SaveLayerAnimationBoundsRects(render_surface_layer_list); |
| 71 } | 63 } |
| 72 | 64 |
| 73 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { | 65 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { |
| 74 // We would like to visualize where any layer's paint rect (update rect) has | 66 // We would like to visualize where any layer's paint rect (update rect) has |
| 75 // changed, regardless of whether this layer is skipped for actual drawing or | 67 // changed, regardless of whether this layer is skipped for actual drawing or |
| 76 // not. Therefore we traverse recursively over all layers, not just the render | 68 // not. Therefore we traverse recursively over all layers, not just the render |
| 77 // surface list. | 69 // surface list. |
| 78 | 70 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 if (render_surface_layer->replica_layer()) { | 155 if (render_surface_layer->replica_layer()) { |
| 164 debug_rects_.push_back( | 156 debug_rects_.push_back( |
| 165 DebugRect(REPLICA_SCREEN_SPACE_RECT_TYPE, | 157 DebugRect(REPLICA_SCREEN_SPACE_RECT_TYPE, |
| 166 MathUtil::MapEnclosingClippedRect( | 158 MathUtil::MapEnclosingClippedRect( |
| 167 render_surface->replica_screen_space_transform(), | 159 render_surface->replica_screen_space_transform(), |
| 168 render_surface->content_rect()))); | 160 render_surface->content_rect()))); |
| 169 } | 161 } |
| 170 } | 162 } |
| 171 } | 163 } |
| 172 | 164 |
| 173 void DebugRectHistory::SaveOccludingRects( | |
| 174 const std::vector<gfx::Rect>& occluding_rects) { | |
| 175 for (size_t i = 0; i < occluding_rects.size(); ++i) | |
| 176 debug_rects_.push_back(DebugRect(OCCLUDING_RECT_TYPE, occluding_rects[i])); | |
| 177 } | |
| 178 | |
| 179 void DebugRectHistory::SaveNonOccludingRects( | |
| 180 const std::vector<gfx::Rect>& non_occluding_rects) { | |
| 181 for (size_t i = 0; i < non_occluding_rects.size(); ++i) { | |
| 182 debug_rects_.push_back( | |
| 183 DebugRect(NONOCCLUDING_RECT_TYPE, non_occluding_rects[i])); | |
| 184 } | |
| 185 } | |
| 186 | |
| 187 void DebugRectHistory::SaveTouchEventHandlerRects(LayerImpl* layer) { | 165 void DebugRectHistory::SaveTouchEventHandlerRects(LayerImpl* layer) { |
| 188 LayerTreeHostCommon::CallFunctionForSubtree<LayerImpl>( | 166 LayerTreeHostCommon::CallFunctionForSubtree<LayerImpl>( |
| 189 layer, | 167 layer, |
| 190 base::Bind(&DebugRectHistory::SaveTouchEventHandlerRectsCallback, | 168 base::Bind(&DebugRectHistory::SaveTouchEventHandlerRectsCallback, |
| 191 base::Unretained(this))); | 169 base::Unretained(this))); |
| 192 } | 170 } |
| 193 | 171 |
| 194 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { | 172 void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) { |
| 195 for (Region::Iterator iter(layer->touch_event_handler_region()); | 173 for (Region::Iterator iter(layer->touch_event_handler_region()); |
| 196 iter.has_rect(); | 174 iter.has_rect(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 debug_rects_.push_back( | 263 debug_rects_.push_back( |
| 286 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | 264 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, |
| 287 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), | 265 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), |
| 288 inflated_bounds.y(), | 266 inflated_bounds.y(), |
| 289 inflated_bounds.width(), | 267 inflated_bounds.width(), |
| 290 inflated_bounds.height())))); | 268 inflated_bounds.height())))); |
| 291 } | 269 } |
| 292 } | 270 } |
| 293 | 271 |
| 294 } // namespace cc | 272 } // namespace cc |
| OLD | NEW |