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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 if (debug_state.show_layer_animation_bounds_rects) | 69 if (debug_state.show_layer_animation_bounds_rects) |
70 SaveLayerAnimationBoundsRects(render_surface_layer_list); | 70 SaveLayerAnimationBoundsRects(render_surface_layer_list); |
71 } | 71 } |
72 | 72 |
73 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { | 73 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { |
74 // We would like to visualize where any layer's paint rect (update rect) has | 74 // 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 | 75 // 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 | 76 // not. Therefore we traverse recursively over all layers, not just the render |
77 // surface list. | 77 // surface list. |
78 | 78 |
79 if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) { | 79 if (layer->DrawsContent() && !layer->GetDetailedPaintRects(&debug_rects_) && |
| 80 !layer->update_rect().IsEmpty()) { |
80 float width_scale = layer->content_bounds().width() / | 81 float width_scale = layer->content_bounds().width() / |
81 static_cast<float>(layer->bounds().width()); | 82 static_cast<float>(layer->bounds().width()); |
82 float height_scale = layer->content_bounds().height() / | 83 float height_scale = layer->content_bounds().height() / |
83 static_cast<float>(layer->bounds().height()); | 84 static_cast<float>(layer->bounds().height()); |
84 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( | 85 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( |
85 gfx::ToEnclosingRect(layer->update_rect()), width_scale, height_scale); | 86 gfx::ToEnclosingRect(layer->update_rect()), width_scale, height_scale); |
86 debug_rects_.push_back( | 87 debug_rects_.push_back( |
87 DebugRect(PAINT_RECT_TYPE, | 88 DebugRect(PAINT_RECT_TYPE, |
88 MathUtil::MapEnclosingClippedRect( | 89 MathUtil::MapEnclosingClippedRect( |
89 layer->screen_space_transform(), update_content_rect))); | 90 layer->screen_space_transform(), update_content_rect))); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 debug_rects_.push_back( | 286 debug_rects_.push_back( |
286 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | 287 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, |
287 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), | 288 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), |
288 inflated_bounds.y(), | 289 inflated_bounds.y(), |
289 inflated_bounds.width(), | 290 inflated_bounds.width(), |
290 inflated_bounds.height())))); | 291 inflated_bounds.height())))); |
291 } | 292 } |
292 } | 293 } |
293 | 294 |
294 } // namespace cc | 295 } // namespace cc |
OLD | NEW |