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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 if (debug_state.show_layer_animation_bounds_rects) | 61 if (debug_state.show_layer_animation_bounds_rects) |
62 SaveLayerAnimationBoundsRects(render_surface_layer_list); | 62 SaveLayerAnimationBoundsRects(render_surface_layer_list); |
63 } | 63 } |
64 | 64 |
65 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { | 65 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { |
66 // 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 |
67 // 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 |
68 // 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 |
69 // surface list. | 69 // surface list. |
70 | 70 |
71 if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) { | 71 Region invalidation_region = layer->GetInvalidationRegion(); |
72 if (!invalidation_region.IsEmpty() && layer->DrawsContent()) { | |
72 float width_scale = layer->content_bounds().width() / | 73 float width_scale = layer->content_bounds().width() / |
73 static_cast<float>(layer->bounds().width()); | 74 static_cast<float>(layer->bounds().width()); |
74 float height_scale = layer->content_bounds().height() / | 75 float height_scale = layer->content_bounds().height() / |
75 static_cast<float>(layer->bounds().height()); | 76 static_cast<float>(layer->bounds().height()); |
76 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( | 77 |
77 layer->update_rect(), width_scale, height_scale); | 78 for (Region::Iterator it(invalidation_region); |
78 debug_rects_.push_back( | 79 it.has_rect(); |
danakj
2015/03/02 20:10:53
this doesn't look like how git cl format would do
daplatz
2015/03/02 20:28:02
no i did not know about it. sweet.
| |
80 it.next()) { | |
81 | |
danakj
2015/03/02 20:10:53
nit: remove this whitespace
daplatz
2015/03/02 20:28:02
Acknowledged.
| |
82 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( | |
83 it.rect(), width_scale, height_scale); | |
84 debug_rects_.push_back( | |
79 DebugRect(PAINT_RECT_TYPE, | 85 DebugRect(PAINT_RECT_TYPE, |
80 MathUtil::MapEnclosingClippedRect( | 86 MathUtil::MapEnclosingClippedRect( |
81 layer->screen_space_transform(), update_content_rect))); | 87 layer->screen_space_transform(), update_content_rect))); |
88 } | |
82 } | 89 } |
83 | 90 |
84 for (unsigned i = 0; i < layer->children().size(); ++i) | 91 for (unsigned i = 0; i < layer->children().size(); ++i) |
85 SavePaintRects(layer->children()[i]); | 92 SavePaintRects(layer->children()[i]); |
86 } | 93 } |
87 | 94 |
88 void DebugRectHistory::SavePropertyChangedRects( | 95 void DebugRectHistory::SavePropertyChangedRects( |
89 const LayerImplList& render_surface_layer_list, | 96 const LayerImplList& render_surface_layer_list, |
90 LayerImpl* hud_layer) { | 97 LayerImpl* hud_layer) { |
91 for (int surface_index = render_surface_layer_list.size() - 1; | 98 for (int surface_index = render_surface_layer_list.size() - 1; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 debug_rects_.push_back( | 270 debug_rects_.push_back( |
264 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | 271 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, |
265 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), | 272 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), |
266 inflated_bounds.y(), | 273 inflated_bounds.y(), |
267 inflated_bounds.width(), | 274 inflated_bounds.width(), |
268 inflated_bounds.height())))); | 275 inflated_bounds.height())))); |
269 } | 276 } |
270 } | 277 } |
271 | 278 |
272 } // namespace cc | 279 } // namespace cc |
OLD | NEW |