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 CC_DEBUG_RECT_HISTORY_H_ | 5 #ifndef CC_DEBUG_RECT_HISTORY_H_ |
6 #define CC_DEBUG_RECT_HISTORY_H_ | 6 #define CC_DEBUG_RECT_HISTORY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // - Surface damage rects: the aggregate damage on a target surface that is caus
ed by all | 28 // - Surface damage rects: the aggregate damage on a target surface that is caus
ed by all |
29 // layers and surfaces that contribute to it. This includes (1) paint rects, (
2) property- | 29 // layers and surfaces that contribute to it. This includes (1) paint rects, (
2) property- |
30 // changed rects, and (3) newly exposed areas. | 30 // changed rects, and (3) newly exposed areas. |
31 // | 31 // |
32 // - Screen space rects: this is the region the contents occupy in screen space. | 32 // - Screen space rects: this is the region the contents occupy in screen space. |
33 // | 33 // |
34 // - Replica screen space rects: this is the region the replica's contents occup
y in screen space. | 34 // - Replica screen space rects: this is the region the replica's contents occup
y in screen space. |
35 // | 35 // |
36 // - Occluding rects: these are the regions that contribute to the occluded regi
on. | 36 // - Occluding rects: these are the regions that contribute to the occluded regi
on. |
37 // | 37 // |
38 enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectTy
pe, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType }; | 38 // - Non-Occluding rects: these are the regions of composited layers that do not |
| 39 // contribute to the occluded region. |
| 40 // |
| 41 enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectTy
pe, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType, NonOcclu
dingRectType }; |
39 | 42 |
40 struct DebugRect { | 43 struct DebugRect { |
41 DebugRect(DebugRectType newType, gfx::RectF newRect) | 44 DebugRect(DebugRectType newType, gfx::RectF newRect) |
42 : type(newType) | 45 : type(newType) |
43 , rect(newRect) { } | 46 , rect(newRect) { } |
44 | 47 |
45 DebugRectType type; | 48 DebugRectType type; |
46 gfx::RectF rect; | 49 gfx::RectF rect; |
47 }; | 50 }; |
48 | 51 |
49 // This class maintains a history of rects of various types that can be used | 52 // This class maintains a history of rects of various types that can be used |
50 // for debugging purposes. The overhead of collecting rects is performed only if | 53 // for debugging purposes. The overhead of collecting rects is performed only if |
51 // the appropriate LayerTreeSettings are enabled. | 54 // the appropriate LayerTreeSettings are enabled. |
52 class DebugRectHistory { | 55 class DebugRectHistory { |
53 public: | 56 public: |
54 static scoped_ptr<DebugRectHistory> create(); | 57 static scoped_ptr<DebugRectHistory> create(); |
55 | 58 |
56 ~DebugRectHistory(); | 59 ~DebugRectHistory(); |
57 | 60 |
58 // Note: Saving debug rects must happen before layers' change tracking is re
set. | 61 // Note: Saving debug rects must happen before layers' change tracking is re
set. |
59 void saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const std::vector<L
ayerImpl*>& renderSurfaceLayerList, const std::vector<gfx::Rect>& occludingScree
nSpaceRects, const LayerTreeSettings&); | 62 void saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const std::vector<L
ayerImpl*>& renderSurfaceLayerList, const std::vector<gfx::Rect>& occludingScree
nSpaceRects, const std::vector<gfx::Rect>& nonOccludingScreenSpaceRects, const L
ayerTreeSettings&); |
60 | 63 |
61 const std::vector<DebugRect>& debugRects() { return m_debugRects; } | 64 const std::vector<DebugRect>& debugRects() { return m_debugRects; } |
62 | 65 |
63 private: | 66 private: |
64 DebugRectHistory(); | 67 DebugRectHistory(); |
65 | 68 |
66 void savePaintRects(LayerImpl*); | 69 void savePaintRects(LayerImpl*); |
67 void savePropertyChangedRects(const std::vector<LayerImpl*>& renderSurfaceLa
yerList); | 70 void savePropertyChangedRects(const std::vector<LayerImpl*>& renderSurfaceLa
yerList); |
68 void saveSurfaceDamageRects(const std::vector<LayerImpl* >& renderSurfaceLay
erList); | 71 void saveSurfaceDamageRects(const std::vector<LayerImpl* >& renderSurfaceLay
erList); |
69 void saveScreenSpaceRects(const std::vector<LayerImpl* >& renderSurfaceLayer
List); | 72 void saveScreenSpaceRects(const std::vector<LayerImpl* >& renderSurfaceLayer
List); |
70 void saveOccludingRects(const std::vector<gfx::Rect>& occludingScreenSpaceRe
cts); | 73 void saveOccludingRects(const std::vector<gfx::Rect>& occludingScreenSpaceRe
cts); |
| 74 void saveNonOccludingRects(const std::vector<gfx::Rect>& nonOccludingScreenS
paceRects); |
71 | 75 |
72 std::vector<DebugRect> m_debugRects; | 76 std::vector<DebugRect> m_debugRects; |
73 | 77 |
74 DISALLOW_COPY_AND_ASSIGN(DebugRectHistory); | 78 DISALLOW_COPY_AND_ASSIGN(DebugRectHistory); |
75 }; | 79 }; |
76 | 80 |
77 } // namespace cc | 81 } // namespace cc |
78 | 82 |
79 #endif // CC_DEBUG_RECT_HISTORY_H_ | 83 #endif // CC_DEBUG_RECT_HISTORY_H_ |
OLD | NEW |