Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: cc/debug/debug_rect_history.cc

Issue 92853002: Support for drawing a debug border around animated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Copy switches for chromeos Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/debug/debug_rect_history.h ('k') | cc/debug/layer_tree_debug_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 typedef LayerIterator<LayerImpl,
241 LayerImplList,
242 RenderSurfaceImpl,
243 LayerIteratorActions::FrontToBack> LayerIteratorType;
244 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list);
245 for (LayerIteratorType it =
246 LayerIteratorType::Begin(&render_surface_layer_list);
247 it != end; ++it) {
248 if (!it.represents_itself())
249 continue;
250 gfx::BoxF inflated_bounds;
251 if (!(*it)->GetAnimationBounds(&inflated_bounds))
252 continue;
253
254 debug_rects_.push_back(DebugRect(ANIMATION_BOUNDS_RECT_TYPE,
255 gfx::RectF(inflated_bounds.x(),
256 inflated_bounds.y(),
257 inflated_bounds.width(),
258 inflated_bounds.height())));
259 }
260 }
261
235 } // namespace cc 262 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/debug_rect_history.h ('k') | cc/debug/layer_tree_debug_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698