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 #ifndef CCDebugRectHistory_h | 5 // Temporary forwarding header |
6 #define CCDebugRectHistory_h | 6 #include "cc/debug_rect_history.h" |
7 | |
8 #if USE(ACCELERATED_COMPOSITING) | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "FloatRect.h" | |
12 #include "IntRect.h" | |
13 #include <wtf/PassOwnPtr.h> | |
14 #include <wtf/Vector.h> | |
15 #include <vector> | |
16 | |
17 namespace cc { | |
18 | |
19 class CCLayerImpl; | |
20 struct CCLayerTreeSettings; | |
21 | |
22 // There are currently six types of debug rects: | |
23 // | |
24 // - Paint rects (update rects): regions of a layer that needed to be re-uploade
d to the | |
25 // texture resource; in most cases implying that they had to be repainted, too
. | |
26 // | |
27 // - Property-changed rects: enclosing bounds of layers that cause changes to th
e screen | |
28 // even if the layer did not change internally. (For example, if the layer's o
pacity or | |
29 // position changes.) | |
30 // | |
31 // - Surface damage rects: the aggregate damage on a target surface that is caus
ed by all | |
32 // layers and surfaces that contribute to it. This includes (1) paint rects, (
2) property- | |
33 // changed rects, and (3) newly exposed areas. | |
34 // | |
35 // - Screen space rects: this is the region the contents occupy in screen space. | |
36 // | |
37 // - Replica screen space rects: this is the region the replica's contents occup
y in screen space. | |
38 // | |
39 // - Occluding rects: these are the regions that contribute to the occluded regi
on. | |
40 // | |
41 enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectTy
pe, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType }; | |
42 | |
43 struct CCDebugRect { | |
44 CCDebugRect(DebugRectType newType, FloatRect newRect) | |
45 : type(newType) | |
46 , rect(newRect) { } | |
47 | |
48 DebugRectType type; | |
49 FloatRect rect; | |
50 }; | |
51 | |
52 // This class maintains a history of rects of various types that can be used | |
53 // for debugging purposes. The overhead of collecting rects is performed only if | |
54 // the appropriate CCLayerTreeSettings are enabled. | |
55 class CCDebugRectHistory { | |
56 public: | |
57 static PassOwnPtr<CCDebugRectHistory> create() | |
58 { | |
59 return adoptPtr(new CCDebugRectHistory()); | |
60 } | |
61 | |
62 ~CCDebugRectHistory(); | |
63 | |
64 // Note: Saving debug rects must happen before layers' change tracking is re
set. | |
65 void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const std::vector
<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSp
aceRects, const CCLayerTreeSettings&); | |
66 | |
67 const Vector<CCDebugRect>& debugRects() { return m_debugRects; } | |
68 | |
69 private: | |
70 CCDebugRectHistory(); | |
71 | |
72 void savePaintRects(CCLayerImpl*); | |
73 void savePropertyChangedRects(const std::vector<CCLayerImpl*>& renderSurface
LayerList); | |
74 void saveSurfaceDamageRects(const std::vector<CCLayerImpl* >& renderSurfaceL
ayerList); | |
75 void saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLay
erList); | |
76 void saveOccludingRects(const Vector<IntRect>& occludingScreenSpaceRects); | |
77 | |
78 Vector<CCDebugRect> m_debugRects; | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(CCDebugRectHistory); | |
81 }; | |
82 | |
83 } // namespace cc | |
84 | |
85 #endif // USE(ACCELERATED_COMPOSITING) | |
86 | |
87 #endif | |
OLD | NEW |