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

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

Issue 13285002: cc: Consolidate LayerList types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/debug/debug_rect_history.h ('k') | cc/layers/contents_scaling_layer_unittest.cc » ('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/trees/damage_tracker.h" 10 #include "cc/trees/damage_tracker.h"
10 #include "cc/trees/layer_tree_host.h" 11 #include "cc/trees/layer_tree_host.h"
11 12
12 namespace cc { 13 namespace cc {
13 14
14 // static 15 // static
15 scoped_ptr<DebugRectHistory> DebugRectHistory::Create() { 16 scoped_ptr<DebugRectHistory> DebugRectHistory::Create() {
16 return make_scoped_ptr(new DebugRectHistory()); 17 return make_scoped_ptr(new DebugRectHistory());
17 } 18 }
18 19
19 DebugRectHistory::DebugRectHistory() {} 20 DebugRectHistory::DebugRectHistory() {}
20 21
21 DebugRectHistory::~DebugRectHistory() {} 22 DebugRectHistory::~DebugRectHistory() {}
22 23
23 void DebugRectHistory::SaveDebugRectsForCurrentFrame( 24 void DebugRectHistory::SaveDebugRectsForCurrentFrame(
24 LayerImpl* root_layer, 25 LayerImpl* root_layer,
25 const std::vector<LayerImpl*>& render_surface_layer_list, 26 const LayerImplList& render_surface_layer_list,
26 const std::vector<gfx::Rect>& occluding_screen_space_rects, 27 const std::vector<gfx::Rect>& occluding_screen_space_rects,
27 const std::vector<gfx::Rect>& non_occluding_screen_space_rects, 28 const std::vector<gfx::Rect>& non_occluding_screen_space_rects,
28 const LayerTreeDebugState& debug_state) { 29 const LayerTreeDebugState& debug_state) {
29 // For now, clear all rects from previous frames. In the future we may want to 30 // For now, clear all rects from previous frames. In the future we may want to
30 // store all debug rects for a history of many frames. 31 // store all debug rects for a history of many frames.
31 debug_rects_.clear(); 32 debug_rects_.clear();
32 33
33 if (debug_state.show_paint_rects) 34 if (debug_state.show_paint_rects)
34 SavePaintRects(root_layer); 35 SavePaintRects(root_layer);
35 36
(...skipping 30 matching lines...) Expand all
66 DebugRect(PAINT_RECT_TYPE, 67 DebugRect(PAINT_RECT_TYPE,
67 MathUtil::MapClippedRect(layer->screen_space_transform(), 68 MathUtil::MapClippedRect(layer->screen_space_transform(),
68 update_content_rect))); 69 update_content_rect)));
69 } 70 }
70 71
71 for (unsigned i = 0; i < layer->children().size(); ++i) 72 for (unsigned i = 0; i < layer->children().size(); ++i)
72 SavePaintRects(layer->children()[i]); 73 SavePaintRects(layer->children()[i]);
73 } 74 }
74 75
75 void DebugRectHistory::SavePropertyChangedRects( 76 void DebugRectHistory::SavePropertyChangedRects(
76 const std::vector<LayerImpl*>& render_surface_layer_list) { 77 const LayerImplList& render_surface_layer_list) {
77 for (int surface_index = render_surface_layer_list.size() - 1; 78 for (int surface_index = render_surface_layer_list.size() - 1;
78 surface_index >= 0; 79 surface_index >= 0;
79 --surface_index) { 80 --surface_index) {
80 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; 81 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index];
81 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); 82 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface();
82 DCHECK(render_surface); 83 DCHECK(render_surface);
83 84
84 const std::vector<LayerImpl*>& layer_list = render_surface->layer_list(); 85 const LayerImplList& layer_list = render_surface->layer_list();
85 for (unsigned layer_index = 0; 86 for (unsigned layer_index = 0;
86 layer_index < layer_list.size(); 87 layer_index < layer_list.size();
87 ++layer_index) { 88 ++layer_index) {
88 LayerImpl* layer = layer_list[layer_index]; 89 LayerImpl* layer = layer_list[layer_index];
89 90
90 if (LayerTreeHostCommon::RenderSurfaceContributesToTarget<LayerImpl>( 91 if (LayerTreeHostCommon::RenderSurfaceContributesToTarget<LayerImpl>(
91 layer, render_surface_layer->id())) 92 layer, render_surface_layer->id()))
92 continue; 93 continue;
93 94
94 if (layer->LayerIsAlwaysDamaged()) 95 if (layer->LayerIsAlwaysDamaged())
95 continue; 96 continue;
96 97
97 if (layer->LayerPropertyChanged() || 98 if (layer->LayerPropertyChanged() ||
98 layer->LayerSurfacePropertyChanged()) { 99 layer->LayerSurfacePropertyChanged()) {
99 debug_rects_.push_back( 100 debug_rects_.push_back(
100 DebugRect(PROPERTY_CHANGED_RECT_TYPE, 101 DebugRect(PROPERTY_CHANGED_RECT_TYPE,
101 MathUtil::MapClippedRect( 102 MathUtil::MapClippedRect(
102 layer->screen_space_transform(), 103 layer->screen_space_transform(),
103 gfx::RectF(gfx::PointF(), layer->content_bounds())))); 104 gfx::RectF(gfx::PointF(), layer->content_bounds()))));
104 } 105 }
105 } 106 }
106 } 107 }
107 } 108 }
108 109
109 void DebugRectHistory::SaveSurfaceDamageRects( 110 void DebugRectHistory::SaveSurfaceDamageRects(
110 const std::vector<LayerImpl*>& render_surface_layer_list) { 111 const LayerImplList& render_surface_layer_list) {
111 for (int surface_index = render_surface_layer_list.size() - 1; 112 for (int surface_index = render_surface_layer_list.size() - 1;
112 surface_index >= 0; 113 surface_index >= 0;
113 --surface_index) { 114 --surface_index) {
114 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; 115 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index];
115 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); 116 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface();
116 DCHECK(render_surface); 117 DCHECK(render_surface);
117 118
118 debug_rects_.push_back(DebugRect( 119 debug_rects_.push_back(DebugRect(
119 SURFACE_DAMAGE_RECT_TYPE, 120 SURFACE_DAMAGE_RECT_TYPE,
120 MathUtil::MapClippedRect( 121 MathUtil::MapClippedRect(
121 render_surface->screen_space_transform(), 122 render_surface->screen_space_transform(),
122 render_surface->damage_tracker()->current_damage_rect()))); 123 render_surface->damage_tracker()->current_damage_rect())));
123 } 124 }
124 } 125 }
125 126
126 void DebugRectHistory::SaveScreenSpaceRects( 127 void DebugRectHistory::SaveScreenSpaceRects(
127 const std::vector<LayerImpl*>& render_surface_layer_list) { 128 const LayerImplList& render_surface_layer_list) {
128 for (int surface_index = render_surface_layer_list.size() - 1; 129 for (int surface_index = render_surface_layer_list.size() - 1;
129 surface_index >= 0; 130 surface_index >= 0;
130 --surface_index) { 131 --surface_index) {
131 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; 132 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index];
132 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); 133 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface();
133 DCHECK(render_surface); 134 DCHECK(render_surface);
134 135
135 debug_rects_.push_back(DebugRect( 136 debug_rects_.push_back(DebugRect(
136 SCREEN_SPACE_RECT_TYPE, 137 SCREEN_SPACE_RECT_TYPE,
137 MathUtil::MapClippedRect(render_surface->screen_space_transform(), 138 MathUtil::MapClippedRect(render_surface->screen_space_transform(),
(...skipping 17 matching lines...) Expand all
155 156
156 void DebugRectHistory::SaveNonOccludingRects( 157 void DebugRectHistory::SaveNonOccludingRects(
157 const std::vector<gfx::Rect>& non_occluding_rects) { 158 const std::vector<gfx::Rect>& non_occluding_rects) {
158 for (size_t i = 0; i < non_occluding_rects.size(); ++i) { 159 for (size_t i = 0; i < non_occluding_rects.size(); ++i) {
159 debug_rects_.push_back( 160 debug_rects_.push_back(
160 DebugRect(NONOCCLUDING_RECT_TYPE, non_occluding_rects[i])); 161 DebugRect(NONOCCLUDING_RECT_TYPE, non_occluding_rects[i]));
161 } 162 }
162 } 163 }
163 164
164 } // namespace cc 165 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/debug_rect_history.h ('k') | cc/layers/contents_scaling_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698