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_rect_history.h" | 5 #include "cc/debug_rect_history.h" |
6 | 6 |
7 #include "cc/damage_tracker.h" | 7 #include "cc/damage_tracker.h" |
8 #include "cc/layer_impl.h" | 8 #include "cc/layer_impl.h" |
9 #include "cc/layer_tree_host.h" | 9 #include "cc/layer_tree_host.h" |
10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 // static | 14 // static |
15 scoped_ptr<DebugRectHistory> DebugRectHistory::create() { | 15 scoped_ptr<DebugRectHistory> DebugRectHistory::create() { |
16 return make_scoped_ptr(new DebugRectHistory()); | 16 return make_scoped_ptr(new DebugRectHistory()); |
17 } | 17 } |
18 | 18 |
19 DebugRectHistory::DebugRectHistory() | 19 DebugRectHistory::DebugRectHistory() |
20 { | 20 { |
21 } | 21 } |
22 | 22 |
23 DebugRectHistory::~DebugRectHistory() | 23 DebugRectHistory::~DebugRectHistory() |
24 { | 24 { |
25 } | 25 } |
26 | 26 |
27 void DebugRectHistory::saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const
std::vector<LayerImpl*>& renderSurfaceLayerList, const std::vector<gfx::Rect>&
occludingScreenSpaceRects, const std::vector<gfx::Rect>& nonOccludingScreenSpace
Rects, const LayerTreeSettings& settings) | 27 void DebugRectHistory::saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const
std::vector<LayerImpl*>& renderSurfaceLayerList, const std::vector<gfx::Rect>&
occludingScreenSpaceRects, const std::vector<gfx::Rect>& nonOccludingScreenSpace
Rects, const LayerTreeSwitches& switches) |
28 { | 28 { |
29 // For now, clear all rects from previous frames. In the future we may want
to store | 29 // For now, clear all rects from previous frames. In the future we may want
to store |
30 // all debug rects for a history of many frames. | 30 // all debug rects for a history of many frames. |
31 m_debugRects.clear(); | 31 m_debugRects.clear(); |
32 | 32 |
33 if (settings.showPaintRects) | 33 if (switches.showPaintRects) |
34 savePaintRects(rootLayer); | 34 savePaintRects(rootLayer); |
35 | 35 |
36 if (settings.showPropertyChangedRects) | 36 if (switches.showPropertyChangedRects) |
37 savePropertyChangedRects(renderSurfaceLayerList); | 37 savePropertyChangedRects(renderSurfaceLayerList); |
38 | 38 |
39 if (settings.showSurfaceDamageRects) | 39 if (switches.showSurfaceDamageRects) |
40 saveSurfaceDamageRects(renderSurfaceLayerList); | 40 saveSurfaceDamageRects(renderSurfaceLayerList); |
41 | 41 |
42 if (settings.showScreenSpaceRects) | 42 if (switches.showScreenSpaceRects) |
43 saveScreenSpaceRects(renderSurfaceLayerList); | 43 saveScreenSpaceRects(renderSurfaceLayerList); |
44 | 44 |
45 if (settings.showOccludingRects) | 45 if (switches.showOccludingRects) |
46 saveOccludingRects(occludingScreenSpaceRects); | 46 saveOccludingRects(occludingScreenSpaceRects); |
47 | 47 |
48 if (settings.showNonOccludingRects) | 48 if (switches.showNonOccludingRects) |
49 saveNonOccludingRects(nonOccludingScreenSpaceRects); | 49 saveNonOccludingRects(nonOccludingScreenSpaceRects); |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 void DebugRectHistory::savePaintRects(LayerImpl* layer) | 53 void DebugRectHistory::savePaintRects(LayerImpl* layer) |
54 { | 54 { |
55 // We would like to visualize where any layer's paint rect (update rect) has
changed, | 55 // We would like to visualize where any layer's paint rect (update rect) has
changed, |
56 // regardless of whether this layer is skipped for actual drawing or not. Th
erefore | 56 // regardless of whether this layer is skipped for actual drawing or not. Th
erefore |
57 // we traverse recursively over all layers, not just the render surface list
. | 57 // we traverse recursively over all layers, not just the render surface list
. |
58 | 58 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 m_debugRects.push_back(DebugRect(OccludingRectType, occludingRects[i])); | 121 m_debugRects.push_back(DebugRect(OccludingRectType, occludingRects[i])); |
122 } | 122 } |
123 | 123 |
124 void DebugRectHistory::saveNonOccludingRects(const std::vector<gfx::Rect>& nonOc
cludingRects) | 124 void DebugRectHistory::saveNonOccludingRects(const std::vector<gfx::Rect>& nonOc
cludingRects) |
125 { | 125 { |
126 for (size_t i = 0; i < nonOccludingRects.size(); ++i) | 126 for (size_t i = 0; i < nonOccludingRects.size(); ++i) |
127 m_debugRects.push_back(DebugRect(NonOccludingRectType, nonOccludingRects
[i])); | 127 m_debugRects.push_back(DebugRect(NonOccludingRectType, nonOccludingRects
[i])); |
128 } | 128 } |
129 | 129 |
130 } // namespace cc | 130 } // namespace cc |
OLD | NEW |