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/render_surface_impl.h" | 9 #include "cc/layers/render_surface_impl.h" |
10 #include "cc/trees/damage_tracker.h" | 10 #include "cc/trees/damage_tracker.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 SaveSurfaceDamageRects(render_surface_layer_list); | 51 SaveSurfaceDamageRects(render_surface_layer_list); |
52 | 52 |
53 if (debug_state.show_screen_space_rects) | 53 if (debug_state.show_screen_space_rects) |
54 SaveScreenSpaceRects(render_surface_layer_list); | 54 SaveScreenSpaceRects(render_surface_layer_list); |
55 | 55 |
56 if (debug_state.show_occluding_rects) | 56 if (debug_state.show_occluding_rects) |
57 SaveOccludingRects(occluding_screen_space_rects); | 57 SaveOccludingRects(occluding_screen_space_rects); |
58 | 58 |
59 if (debug_state.show_non_occluding_rects) | 59 if (debug_state.show_non_occluding_rects) |
60 SaveNonOccludingRects(non_occluding_screen_space_rects); | 60 SaveNonOccludingRects(non_occluding_screen_space_rects); |
61 | |
62 if (debug_state.show_layer_animation_bounds_rects) | |
63 SaveLayerAnimationBoundsRects(render_surface_layer_list); | |
61 } | 64 } |
62 | 65 |
63 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { | 66 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { |
64 // We would like to visualize where any layer's paint rect (update rect) has | 67 // We would like to visualize where any layer's paint rect (update rect) has |
65 // changed, regardless of whether this layer is skipped for actual drawing or | 68 // changed, regardless of whether this layer is skipped for actual drawing or |
66 // not. Therefore we traverse recursively over all layers, not just the render | 69 // not. Therefore we traverse recursively over all layers, not just the render |
67 // surface list. | 70 // surface list. |
68 | 71 |
69 if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) { | 72 if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) { |
70 float width_scale = layer->content_bounds().width() / | 73 float width_scale = layer->content_bounds().width() / |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 gfx::RectF scroll_rect = gfx::ScaleRect(iter.rect(), | 228 gfx::RectF scroll_rect = gfx::ScaleRect(iter.rect(), |
226 layer->contents_scale_x(), | 229 layer->contents_scale_x(), |
227 layer->contents_scale_y()); | 230 layer->contents_scale_y()); |
228 debug_rects_.push_back(DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, | 231 debug_rects_.push_back(DebugRect(NON_FAST_SCROLLABLE_RECT_TYPE, |
229 MathUtil::MapClippedRect( | 232 MathUtil::MapClippedRect( |
230 layer->screen_space_transform(), | 233 layer->screen_space_transform(), |
231 scroll_rect))); | 234 scroll_rect))); |
232 } | 235 } |
233 } | 236 } |
234 | 237 |
238 void DebugRectHistory::SaveLayerAnimationBoundsRects( | |
239 const LayerImplList& render_surface_layer_list) { | |
240 for (int surface_index = render_surface_layer_list.size() - 1; | |
danakj
2013/11/28 17:48:56
Why not use LayerIterator?
avallee
2013/12/06 22:08:32
Done. I think we're iterating front to back now in
| |
241 surface_index >= 0; | |
242 --surface_index) { | |
243 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; | |
244 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); | |
245 DCHECK(render_surface); | |
246 | |
247 const LayerImplList& layer_list = render_surface->layer_list(); | |
248 for (unsigned layer_index = 0; | |
249 layer_index < layer_list.size(); | |
250 ++layer_index) { | |
251 LayerImpl* layer = layer_list[layer_index]; | |
252 | |
253 gfx::BoxF inflated_bounds; | |
254 if (!layer->GetAnimationBounds(&inflated_bounds)) | |
255 continue; | |
256 | |
257 debug_rects_.push_back(DebugRect(ANIMATION_BOUNDS_RECT_TYPE, | |
258 gfx::RectF(inflated_bounds.x(), | |
259 inflated_bounds.y(), | |
260 inflated_bounds.width(), | |
261 inflated_bounds.height()))); | |
262 } | |
263 } | |
264 } | |
265 | |
235 } // namespace cc | 266 } // namespace cc |
OLD | NEW |