Remove extra line from unit_tests.isolate
[chromium-blink-merge.git] / cc / CCDebugRectHistory.h
blob1b03f34aa7963473f02c51fa2db932e1c848e666
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.
5 #ifndef CCDebugRectHistory_h
6 #define CCDebugRectHistory_h
8 #if USE(ACCELERATED_COMPOSITING)
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>
17 namespace cc {
19 class CCLayerImpl;
20 struct CCLayerTreeSettings;
22 // There are currently six types of debug rects:
24 // - Paint rects (update rects): regions of a layer that needed to be re-uploaded to the
25 // texture resource; in most cases implying that they had to be repainted, too.
27 // - Property-changed rects: enclosing bounds of layers that cause changes to the screen
28 // even if the layer did not change internally. (For example, if the layer's opacity or
29 // position changes.)
31 // - Surface damage rects: the aggregate damage on a target surface that is caused 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.
35 // - Screen space rects: this is the region the contents occupy in screen space.
37 // - Replica screen space rects: this is the region the replica's contents occupy in screen space.
39 // - Occluding rects: these are the regions that contribute to the occluded region.
41 enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectType, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType };
43 struct CCDebugRect {
44 CCDebugRect(DebugRectType newType, FloatRect newRect)
45 : type(newType)
46 , rect(newRect) { }
48 DebugRectType type;
49 FloatRect rect;
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()
59 return adoptPtr(new CCDebugRectHistory());
62 ~CCDebugRectHistory();
64 // Note: Saving debug rects must happen before layers' change tracking is reset.
65 void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings&);
67 const Vector<CCDebugRect>& debugRects() { return m_debugRects; }
69 private:
70 CCDebugRectHistory();
72 void savePaintRects(CCLayerImpl*);
73 void savePropertyChangedRects(const std::vector<CCLayerImpl*>& renderSurfaceLayerList);
74 void saveSurfaceDamageRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
75 void saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
76 void saveOccludingRects(const Vector<IntRect>& occludingScreenSpaceRects);
78 Vector<CCDebugRect> m_debugRects;
80 DISALLOW_COPY_AND_ASSIGN(CCDebugRectHistory);
83 } // namespace cc
85 #endif // USE(ACCELERATED_COMPOSITING)
87 #endif