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

Side by Side Diff: cc/debug_rect_history.cc

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
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 "config.h" 5 #include "config.h"
6 6
7 #include "CCDebugRectHistory.h" 7 #include "CCDebugRectHistory.h"
8 8
9 #include "CCDamageTracker.h" 9 #include "CCDamageTracker.h"
10 #include "CCLayerImpl.h" 10 #include "CCLayerImpl.h"
11 #include "CCLayerTreeHost.h" 11 #include "CCLayerTreeHost.h"
12 #include "CCMathUtil.h" 12 #include "CCMathUtil.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 // static 16 // static
17 scoped_ptr<CCDebugRectHistory> CCDebugRectHistory::create() { 17 scoped_ptr<DebugRectHistory> DebugRectHistory::create() {
18 return make_scoped_ptr(new CCDebugRectHistory()); 18 return make_scoped_ptr(new DebugRectHistory());
19 } 19 }
20 20
21 CCDebugRectHistory::CCDebugRectHistory() 21 DebugRectHistory::DebugRectHistory()
22 { 22 {
23 } 23 }
24 24
25 CCDebugRectHistory::~CCDebugRectHistory() 25 DebugRectHistory::~DebugRectHistory()
26 { 26 {
27 } 27 }
28 28
29 void CCDebugRectHistory::saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, c onst std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& o ccludingScreenSpaceRects, const CCLayerTreeSettings& settings) 29 void DebugRectHistory::saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const std::vector<LayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludi ngScreenSpaceRects, const LayerTreeSettings& settings)
30 { 30 {
31 // For now, clear all rects from previous frames. In the future we may want to store 31 // For now, clear all rects from previous frames. In the future we may want to store
32 // all debug rects for a history of many frames. 32 // all debug rects for a history of many frames.
33 m_debugRects.clear(); 33 m_debugRects.clear();
34 34
35 if (settings.showPaintRects) 35 if (settings.showPaintRects)
36 savePaintRects(rootLayer); 36 savePaintRects(rootLayer);
37 37
38 if (settings.showPropertyChangedRects) 38 if (settings.showPropertyChangedRects)
39 savePropertyChangedRects(renderSurfaceLayerList); 39 savePropertyChangedRects(renderSurfaceLayerList);
40 40
41 if (settings.showSurfaceDamageRects) 41 if (settings.showSurfaceDamageRects)
42 saveSurfaceDamageRects(renderSurfaceLayerList); 42 saveSurfaceDamageRects(renderSurfaceLayerList);
43 43
44 if (settings.showScreenSpaceRects) 44 if (settings.showScreenSpaceRects)
45 saveScreenSpaceRects(renderSurfaceLayerList); 45 saveScreenSpaceRects(renderSurfaceLayerList);
46 46
47 if (settings.showOccludingRects) 47 if (settings.showOccludingRects)
48 saveOccludingRects(occludingScreenSpaceRects); 48 saveOccludingRects(occludingScreenSpaceRects);
49 } 49 }
50 50
51 51
52 void CCDebugRectHistory::savePaintRects(CCLayerImpl* layer) 52 void DebugRectHistory::savePaintRects(LayerImpl* layer)
53 { 53 {
54 // We would like to visualize where any layer's paint rect (update rect) has changed, 54 // We would like to visualize where any layer's paint rect (update rect) has changed,
55 // regardless of whether this layer is skipped for actual drawing or not. Th erefore 55 // regardless of whether this layer is skipped for actual drawing or not. Th erefore
56 // we traverse recursively over all layers, not just the render surface list . 56 // we traverse recursively over all layers, not just the render surface list .
57 57
58 if (!layer->updateRect().isEmpty() && layer->drawsContent()) { 58 if (!layer->updateRect().isEmpty() && layer->drawsContent()) {
59 FloatRect updateContentRect = layer->updateRect(); 59 FloatRect updateContentRect = layer->updateRect();
60 updateContentRect.scale(layer->contentBounds().width() / static_cast<flo at>(layer->bounds().width()), layer->contentBounds().height() / static_cast<floa t>(layer->bounds().height())); 60 updateContentRect.scale(layer->contentBounds().width() / static_cast<flo at>(layer->bounds().width()), layer->contentBounds().height() / static_cast<floa t>(layer->bounds().height()));
61 m_debugRects.append(CCDebugRect(PaintRectType, CCMathUtil::mapClippedRec t(layer->screenSpaceTransform(), updateContentRect))); 61 m_debugRects.append(DebugRect(PaintRectType, MathUtil::mapClippedRect(la yer->screenSpaceTransform(), updateContentRect)));
62 } 62 }
63 63
64 for (unsigned i = 0; i < layer->children().size(); ++i) 64 for (unsigned i = 0; i < layer->children().size(); ++i)
65 savePaintRects(layer->children()[i]); 65 savePaintRects(layer->children()[i]);
66 } 66 }
67 67
68 void CCDebugRectHistory::savePropertyChangedRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList) 68 void DebugRectHistory::savePropertyChangedRects(const std::vector<LayerImpl*>& r enderSurfaceLayerList)
69 { 69 {
70 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { 70 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
71 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; 71 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
72 CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); 72 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface();
73 ASSERT(renderSurface); 73 ASSERT(renderSurface);
74 74
75 const std::vector<CCLayerImpl*>& layerList = renderSurface->layerList(); 75 const std::vector<LayerImpl*>& layerList = renderSurface->layerList();
76 for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerInde x) { 76 for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerInde x) {
77 CCLayerImpl* layer = layerList[layerIndex]; 77 LayerImpl* layer = layerList[layerIndex];
78 78
79 if (CCLayerTreeHostCommon::renderSurfaceContributesToTarget<CCLayerI mpl>(layer, renderSurfaceLayer->id())) 79 if (LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerImpl> (layer, renderSurfaceLayer->id()))
80 continue; 80 continue;
81 81
82 if (layer->layerIsAlwaysDamaged()) 82 if (layer->layerIsAlwaysDamaged())
83 continue; 83 continue;
84 84
85 if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChan ged()) 85 if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChan ged())
86 m_debugRects.append(CCDebugRect(PropertyChangedRectType, CCMathU til::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds())))); 86 m_debugRects.append(DebugRect(PropertyChangedRectType, MathUtil: :mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), lay er->contentBounds()))));
87 } 87 }
88 } 88 }
89 } 89 }
90 90
91 void CCDebugRectHistory::saveSurfaceDamageRects(const std::vector<CCLayerImpl* > & renderSurfaceLayerList) 91 void DebugRectHistory::saveSurfaceDamageRects(const std::vector<LayerImpl* >& re nderSurfaceLayerList)
92 { 92 {
93 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { 93 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
94 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; 94 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
95 CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); 95 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface();
96 ASSERT(renderSurface); 96 ASSERT(renderSurface);
97 97
98 m_debugRects.append(CCDebugRect(SurfaceDamageRectType, CCMathUtil::mapCl ippedRect(renderSurface->screenSpaceTransform(), renderSurface->damageTracker()- >currentDamageRect()))); 98 m_debugRects.append(DebugRect(SurfaceDamageRectType, MathUtil::mapClippe dRect(renderSurface->screenSpaceTransform(), renderSurface->damageTracker()->cur rentDamageRect())));
99 } 99 }
100 } 100 }
101 101
102 void CCDebugRectHistory::saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList) 102 void DebugRectHistory::saveScreenSpaceRects(const std::vector<LayerImpl* >& rend erSurfaceLayerList)
103 { 103 {
104 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { 104 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
105 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; 105 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
106 CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); 106 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface();
107 ASSERT(renderSurface); 107 ASSERT(renderSurface);
108 108
109 m_debugRects.append(CCDebugRect(ScreenSpaceRectType, CCMathUtil::mapClip pedRect(renderSurface->screenSpaceTransform(), renderSurface->contentRect()))); 109 m_debugRects.append(DebugRect(ScreenSpaceRectType, MathUtil::mapClippedR ect(renderSurface->screenSpaceTransform(), renderSurface->contentRect())));
110 110
111 if (renderSurfaceLayer->replicaLayer()) 111 if (renderSurfaceLayer->replicaLayer())
112 m_debugRects.append(CCDebugRect(ReplicaScreenSpaceRectType, CCMathUt il::mapClippedRect(renderSurface->replicaScreenSpaceTransform(), renderSurface-> contentRect()))); 112 m_debugRects.append(DebugRect(ReplicaScreenSpaceRectType, MathUtil:: mapClippedRect(renderSurface->replicaScreenSpaceTransform(), renderSurface->cont entRect())));
113 } 113 }
114 } 114 }
115 115
116 void CCDebugRectHistory::saveOccludingRects(const Vector<IntRect>& occludingRect s) 116 void DebugRectHistory::saveOccludingRects(const Vector<IntRect>& occludingRects)
117 { 117 {
118 for (size_t i = 0; i < occludingRects.size(); ++i) 118 for (size_t i = 0; i < occludingRects.size(); ++i)
119 m_debugRects.append(CCDebugRect(OccludingRectType, occludingRects[i])); 119 m_debugRects.append(DebugRect(OccludingRectType, occludingRects[i]));
120 } 120 }
121 121
122 } // namespace cc 122 } // namespace cc
123 123
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698