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

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

Issue 1754333003: Use the iterator for DebugRectHistory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months 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 | « no previous file | no next file » | 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
11 #include "cc/layers/layer_iterator.h" 11 #include "cc/layers/layer_iterator.h"
12 #include "cc/layers/layer_list_iterator.h"
12 #include "cc/layers/layer_utils.h" 13 #include "cc/layers/layer_utils.h"
13 #include "cc/layers/render_surface_impl.h" 14 #include "cc/layers/render_surface_impl.h"
14 #include "cc/trees/damage_tracker.h" 15 #include "cc/trees/damage_tracker.h"
15 #include "cc/trees/layer_tree_host.h" 16 #include "cc/trees/layer_tree_host.h"
16 #include "cc/trees/layer_tree_host_common.h" 17 #include "cc/trees/layer_tree_host_common.h"
17 #include "cc/trees/layer_tree_impl.h" 18 #include "cc/trees/layer_tree_impl.h"
18 #include "ui/gfx/geometry/rect_conversions.h" 19 #include "ui/gfx/geometry/rect_conversions.h"
19 20
20 namespace cc { 21 namespace cc {
21 22
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (debug_state.show_surface_damage_rects) 59 if (debug_state.show_surface_damage_rects)
59 SaveSurfaceDamageRects(render_surface_layer_list); 60 SaveSurfaceDamageRects(render_surface_layer_list);
60 61
61 if (debug_state.show_screen_space_rects) 62 if (debug_state.show_screen_space_rects)
62 SaveScreenSpaceRects(render_surface_layer_list); 63 SaveScreenSpaceRects(render_surface_layer_list);
63 64
64 if (debug_state.show_layer_animation_bounds_rects) 65 if (debug_state.show_layer_animation_bounds_rects)
65 SaveLayerAnimationBoundsRects(render_surface_layer_list); 66 SaveLayerAnimationBoundsRects(render_surface_layer_list);
66 } 67 }
67 68
68 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { 69 void DebugRectHistory::SavePaintRects(LayerImpl* root_layer) {
69 // We would like to visualize where any layer's paint rect (update rect) has 70 // We would like to visualize where any layer's paint rect (update rect) has
70 // changed, regardless of whether this layer is skipped for actual drawing or 71 // changed, regardless of whether this layer is skipped for actual drawing or
71 // not. Therefore we traverse recursively over all layers, not just the render 72 // not. Therefore we traverse over all layers, not just the render surface
72 // surface list. 73 // list.
74 for (auto* layer : *root_layer->layer_tree_impl()) {
75 Region invalidation_region = layer->GetInvalidationRegion();
76 if (invalidation_region.IsEmpty() || !layer->DrawsContent())
77 continue;
73 78
74 Region invalidation_region = layer->GetInvalidationRegion();
75 if (!invalidation_region.IsEmpty() && layer->DrawsContent()) {
76 for (Region::Iterator it(invalidation_region); it.has_rect(); it.next()) { 79 for (Region::Iterator it(invalidation_region); it.has_rect(); it.next()) {
77 debug_rects_.push_back(DebugRect( 80 debug_rects_.push_back(DebugRect(
78 PAINT_RECT_TYPE, MathUtil::MapEnclosingClippedRect( 81 PAINT_RECT_TYPE, MathUtil::MapEnclosingClippedRect(
79 layer->ScreenSpaceTransform(), it.rect()))); 82 layer->ScreenSpaceTransform(), it.rect())));
80 } 83 }
81 } 84 }
82
83 for (unsigned i = 0; i < layer->children().size(); ++i)
84 SavePaintRects(layer->children()[i].get());
85 } 85 }
86 86
87 void DebugRectHistory::SavePropertyChangedRects( 87 void DebugRectHistory::SavePropertyChangedRects(
88 const LayerImplList& render_surface_layer_list, 88 const LayerImplList& render_surface_layer_list,
89 LayerImpl* hud_layer) { 89 LayerImpl* hud_layer) {
90 for (size_t i = 0; i < render_surface_layer_list.size(); ++i) { 90 for (size_t i = 0; i < render_surface_layer_list.size(); ++i) {
91 size_t surface_index = render_surface_layer_list.size() - 1 - i; 91 size_t surface_index = render_surface_layer_list.size() - 1 - i;
92 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; 92 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index];
93 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); 93 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface();
94 DCHECK(render_surface); 94 DCHECK(render_surface);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 debug_rects_.push_back( 246 debug_rects_.push_back(
247 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, 247 DebugRect(ANIMATION_BOUNDS_RECT_TYPE,
248 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), 248 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(),
249 inflated_bounds.y(), 249 inflated_bounds.y(),
250 inflated_bounds.width(), 250 inflated_bounds.width(),
251 inflated_bounds.height())))); 251 inflated_bounds.height()))));
252 } 252 }
253 } 253 }
254 254
255 } // namespace cc 255 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698