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