| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->update_rect().IsEmpty() && layer->DrawsContent()) { |
| 80 float width_scale = layer->content_bounds().width() / | 80 float width_scale = layer->content_bounds().width() / |
| 81 static_cast<float>(layer->bounds().width()); | 81 layer->bounds().width(); |
| 82 float height_scale = layer->content_bounds().height() / | 82 float height_scale = layer->content_bounds().height() / |
| 83 static_cast<float>(layer->bounds().height()); | 83 layer->bounds().height(); |
| 84 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( | 84 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( |
| 85 gfx::ToEnclosingRect(layer->update_rect()), width_scale, height_scale); | 85 gfx::ToEnclosingRect(layer->update_rect()), width_scale, height_scale); |
| 86 debug_rects_.push_back( | 86 debug_rects_.push_back( |
| 87 DebugRect(PAINT_RECT_TYPE, | 87 DebugRect(PAINT_RECT_TYPE, |
| 88 MathUtil::MapEnclosingClippedRect( | 88 MathUtil::MapEnclosingClippedRect( |
| 89 layer->screen_space_transform(), update_content_rect))); | 89 layer->screen_space_transform(), update_content_rect))); |
| 90 } | 90 } |
| 91 | 91 |
| 92 for (unsigned i = 0; i < layer->children().size(); ++i) | 92 for (unsigned i = 0; i < layer->children().size(); ++i) |
| 93 SavePaintRects(layer->children()[i]); | 93 SavePaintRects(layer->children()[i]); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 debug_rects_.push_back( | 285 debug_rects_.push_back( |
| 286 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | 286 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, |
| 287 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), | 287 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), |
| 288 inflated_bounds.y(), | 288 inflated_bounds.y(), |
| 289 inflated_bounds.width(), | 289 inflated_bounds.width(), |
| 290 inflated_bounds.height())))); | 290 inflated_bounds.height())))); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace cc | 294 } // namespace cc |
| OLD | NEW |