summaryrefslogtreecommitdiffstats
path: root/cc/debug_rect_history.h
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-12 22:43:41 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-12 22:43:41 +0000
commitcd57cc5a246367c2558fefa04ae9eca8f4d545d2 (patch)
treea2235045e9c5e4ff028d641b76f5d01aa5461b26 /cc/debug_rect_history.h
parent3fe7ba055be580443445895c0ee01ada3b628487 (diff)
downloadchromium_src-cd57cc5a246367c2558fefa04ae9eca8f4d545d2.zip
chromium_src-cd57cc5a246367c2558fefa04ae9eca8f4d545d2.tar.gz
chromium_src-cd57cc5a246367c2558fefa04ae9eca8f4d545d2.tar.bz2
[cc] Rename all cc/ filenames to Chromium style
BUG=155413 Review URL: https://codereview.chromium.org/11122003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161671 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/debug_rect_history.h')
-rw-r--r--cc/debug_rect_history.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/cc/debug_rect_history.h b/cc/debug_rect_history.h
index 638cbb2..1b03f34 100644
--- a/cc/debug_rect_history.h
+++ b/cc/debug_rect_history.h
@@ -1,3 +1,87 @@
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+#ifndef CCDebugRectHistory_h
+#define CCDebugRectHistory_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "base/basictypes.h"
+#include "FloatRect.h"
+#include "IntRect.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+#include <vector>
+
+namespace cc {
+
+class CCLayerImpl;
+struct CCLayerTreeSettings;
+
+// There are currently six types of debug rects:
+//
+// - Paint rects (update rects): regions of a layer that needed to be re-uploaded to the
+// texture resource; in most cases implying that they had to be repainted, too.
+//
+// - Property-changed rects: enclosing bounds of layers that cause changes to the screen
+// even if the layer did not change internally. (For example, if the layer's opacity or
+// position changes.)
+//
+// - Surface damage rects: the aggregate damage on a target surface that is caused by all
+// layers and surfaces that contribute to it. This includes (1) paint rects, (2) property-
+// changed rects, and (3) newly exposed areas.
+//
+// - Screen space rects: this is the region the contents occupy in screen space.
+//
+// - Replica screen space rects: this is the region the replica's contents occupy in screen space.
+//
+// - Occluding rects: these are the regions that contribute to the occluded region.
+//
+enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectType, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType };
+
+struct CCDebugRect {
+ CCDebugRect(DebugRectType newType, FloatRect newRect)
+ : type(newType)
+ , rect(newRect) { }
+
+ DebugRectType type;
+ FloatRect rect;
+};
+
+// This class maintains a history of rects of various types that can be used
+// for debugging purposes. The overhead of collecting rects is performed only if
+// the appropriate CCLayerTreeSettings are enabled.
+class CCDebugRectHistory {
+public:
+ static PassOwnPtr<CCDebugRectHistory> create()
+ {
+ return adoptPtr(new CCDebugRectHistory());
+ }
+
+ ~CCDebugRectHistory();
+
+ // Note: Saving debug rects must happen before layers' change tracking is reset.
+ void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const std::vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings&);
+
+ const Vector<CCDebugRect>& debugRects() { return m_debugRects; }
+
+private:
+ CCDebugRectHistory();
+
+ void savePaintRects(CCLayerImpl*);
+ void savePropertyChangedRects(const std::vector<CCLayerImpl*>& renderSurfaceLayerList);
+ void saveSurfaceDamageRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
+ void saveScreenSpaceRects(const std::vector<CCLayerImpl* >& renderSurfaceLayerList);
+ void saveOccludingRects(const Vector<IntRect>& occludingScreenSpaceRects);
+
+ Vector<CCDebugRect> m_debugRects;
+
+ DISALLOW_COPY_AND_ASSIGN(CCDebugRectHistory);
+};
+
+} // namespace cc
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif