Chromium Code Reviews| 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 if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) { |
|
danakj
2015/02/26 23:53:05
Can this use the region too?
daplatz
2015/02/27 11:04:56
I made the change; it makes sense; but for this i
| |
| 72 float width_scale = layer->content_bounds().width() / | 72 float width_scale = layer->content_bounds().width() / |
| 73 static_cast<float>(layer->bounds().width()); | 73 static_cast<float>(layer->bounds().width()); |
| 74 float height_scale = layer->content_bounds().height() / | 74 float height_scale = layer->content_bounds().height() / |
| 75 static_cast<float>(layer->bounds().height()); | 75 static_cast<float>(layer->bounds().height()); |
| 76 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( | 76 |
| 77 layer->update_rect(), width_scale, height_scale); | 77 for (Region::Iterator it(layer->GetInvalidationRegion()); |
| 78 debug_rects_.push_back( | 78 it.has_rect(); |
| 79 it.next()) { | |
| 80 | |
| 81 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( | |
| 82 it.rect(), width_scale, height_scale); | |
| 83 debug_rects_.push_back( | |
| 79 DebugRect(PAINT_RECT_TYPE, | 84 DebugRect(PAINT_RECT_TYPE, |
| 80 MathUtil::MapEnclosingClippedRect( | 85 MathUtil::MapEnclosingClippedRect( |
| 81 layer->screen_space_transform(), update_content_rect))); | 86 layer->screen_space_transform(), update_content_rect))); |
| 87 } | |
| 82 } | 88 } |
| 83 | 89 |
| 84 for (unsigned i = 0; i < layer->children().size(); ++i) | 90 for (unsigned i = 0; i < layer->children().size(); ++i) |
| 85 SavePaintRects(layer->children()[i]); | 91 SavePaintRects(layer->children()[i]); |
| 86 } | 92 } |
| 87 | 93 |
| 88 void DebugRectHistory::SavePropertyChangedRects( | 94 void DebugRectHistory::SavePropertyChangedRects( |
| 89 const LayerImplList& render_surface_layer_list, | 95 const LayerImplList& render_surface_layer_list, |
| 90 LayerImpl* hud_layer) { | 96 LayerImpl* hud_layer) { |
| 91 for (int surface_index = render_surface_layer_list.size() - 1; | 97 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( | 269 debug_rects_.push_back( |
| 264 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | 270 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, |
| 265 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), | 271 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), |
| 266 inflated_bounds.y(), | 272 inflated_bounds.y(), |
| 267 inflated_bounds.width(), | 273 inflated_bounds.width(), |
| 268 inflated_bounds.height())))); | 274 inflated_bounds.height())))); |
| 269 } | 275 } |
| 270 } | 276 } |
| 271 | 277 |
| 272 } // namespace cc | 278 } // namespace cc |
| OLD | NEW |