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

Side by Side Diff: cc/CCDebugRectHistory.cpp

Issue 11122003: [cc] Rename all cc/ filenames to Chromium style (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
« no previous file with comments | « cc/CCDebugRectHistory.h ('k') | cc/CCDelayBasedTimeSource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6
7 #if USE(ACCELERATED_COMPOSITING)
8 #include "CCDebugRectHistory.h"
9
10 #include "CCDamageTracker.h"
11 #include "CCLayerImpl.h"
12 #include "CCLayerTreeHost.h"
13 #include "CCMathUtil.h"
14
15 namespace cc {
16
17 CCDebugRectHistory::CCDebugRectHistory()
18 {
19 }
20
21 CCDebugRectHistory::~CCDebugRectHistory()
22 {
23 }
24
25 void CCDebugRectHistory::saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, c onst std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& o ccludingScreenSpaceRects, const CCLayerTreeSettings& settings)
26 {
27 // For now, clear all rects from previous frames. In the future we may want to store
28 // all debug rects for a history of many frames.
29 m_debugRects.clear();
30
31 if (settings.showPaintRects)
32 savePaintRects(rootLayer);
33
34 if (settings.showPropertyChangedRects)
35 savePropertyChangedRects(renderSurfaceLayerList);
36
37 if (settings.showSurfaceDamageRects)
38 saveSurfaceDamageRects(renderSurfaceLayerList);
39
40 if (settings.showScreenSpaceRects)
41 saveScreenSpaceRects(renderSurfaceLayerList);
42
43 if (settings.showOccludingRects)
44 saveOccludingRects(occludingScreenSpaceRects);
45 }
46
47
48 void CCDebugRectHistory::savePaintRects(CCLayerImpl* layer)
49 {
50 // We would like to visualize where any layer's paint rect (update rect) has changed,
51 // regardless of whether this layer is skipped for actual drawing or not. Th erefore
52 // we traverse recursively over all layers, not just the render surface list .
53
54 if (!layer->updateRect().isEmpty() && layer->drawsContent()) {
55 FloatRect updateContentRect = layer->updateRect();
56 updateContentRect.scale(layer->contentBounds().width() / static_cast<flo at>(layer->bounds().width()), layer->contentBounds().height() / static_cast<floa t>(layer->bounds().height()));
57 m_debugRects.append(CCDebugRect(PaintRectType, CCMathUtil::mapClippedRec t(layer->screenSpaceTransform(), updateContentRect)));
58 }
59
60 for (unsigned i = 0; i < layer->children().size(); ++i)
61 savePaintRects(layer->children()[i]);
62 }
63
64 void CCDebugRectHistory::savePropertyChangedRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList)
65 {
66 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
67 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
68 CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface();
69 ASSERT(renderSurface);
70
71 const std::vector<CCLayerImpl*>& layerList = renderSurface->layerList();
72 for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerInde x) {
73 CCLayerImpl* layer = layerList[layerIndex];
74
75 if (CCLayerTreeHostCommon::renderSurfaceContributesToTarget<CCLayerI mpl>(layer, renderSurfaceLayer->id()))
76 continue;
77
78 if (layer->layerIsAlwaysDamaged())
79 continue;
80
81 if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChan ged())
82 m_debugRects.append(CCDebugRect(PropertyChangedRectType, CCMathU til::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds()))));
83 }
84 }
85 }
86
87 void CCDebugRectHistory::saveSurfaceDamageRects(const std::vector<CCLayerImpl* > & renderSurfaceLayerList)
88 {
89 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
90 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
91 CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface();
92 ASSERT(renderSurface);
93
94 m_debugRects.append(CCDebugRect(SurfaceDamageRectType, CCMathUtil::mapCl ippedRect(renderSurface->screenSpaceTransform(), renderSurface->damageTracker()- >currentDamageRect())));
95 }
96 }
97
98 void CCDebugRectHistory::saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList)
99 {
100 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
101 CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
102 CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface();
103 ASSERT(renderSurface);
104
105 m_debugRects.append(CCDebugRect(ScreenSpaceRectType, CCMathUtil::mapClip pedRect(renderSurface->screenSpaceTransform(), renderSurface->contentRect())));
106
107 if (renderSurfaceLayer->replicaLayer())
108 m_debugRects.append(CCDebugRect(ReplicaScreenSpaceRectType, CCMathUt il::mapClippedRect(renderSurface->replicaScreenSpaceTransform(), renderSurface-> contentRect())));
109 }
110 }
111
112 void CCDebugRectHistory::saveOccludingRects(const Vector<IntRect>& occludingRect s)
113 {
114 for (size_t i = 0; i < occludingRects.size(); ++i)
115 m_debugRects.append(CCDebugRect(OccludingRectType, occludingRects[i]));
116 }
117
118 } // namespace cc
119
120 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CCDebugRectHistory.h ('k') | cc/CCDelayBasedTimeSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698