diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-12 22:43:41 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-12 22:43:41 +0000 |
commit | cd57cc5a246367c2558fefa04ae9eca8f4d545d2 (patch) | |
tree | a2235045e9c5e4ff028d641b76f5d01aa5461b26 /cc/damage_tracker.h | |
parent | 3fe7ba055be580443445895c0ee01ada3b628487 (diff) | |
download | chromium_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/damage_tracker.h')
-rw-r--r-- | cc/damage_tracker.h | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/cc/damage_tracker.h b/cc/damage_tracker.h index 638cbb2..c7550a2 100644 --- a/cc/damage_tracker.h +++ b/cc/damage_tracker.h @@ -1,3 +1,63 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. +// Copyright 2011 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 CCDamageTracker_h +#define CCDamageTracker_h + +#include "base/memory/scoped_ptr.h" +#include "FloatRect.h" +#include <vector> +#include <wtf/HashMap.h> +#include <wtf/Vector.h> + +namespace WebKit { +class WebFilterOperations; +} + +namespace cc { + +class CCLayerImpl; +class CCRenderSurface; + +// Computes the region where pixels have actually changed on a RenderSurface. This region is used +// to scissor what is actually drawn to the screen to save GPU computation and bandwidth. +class CCDamageTracker { +public: + static scoped_ptr<CCDamageTracker> create(); + ~CCDamageTracker(); + + void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); } + void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; } + void updateDamageTrackingState(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&); + + const FloatRect& currentDamageRect() { return m_currentDamageRect; } + +private: + CCDamageTracker(); + + FloatRect trackDamageFromActiveLayers(const std::vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID); + FloatRect trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer); + FloatRect trackDamageFromLeftoverRects(); + + FloatRect removeRectFromCurrentFrame(int layerID, bool& layerIsNew); + void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect); + + // These helper functions are used only in trackDamageFromActiveLayers(). + void extendDamageForLayer(CCLayerImpl*, FloatRect& targetDamageRect); + void extendDamageForRenderSurface(CCLayerImpl*, FloatRect& targetDamageRect); + + // To correctly track exposed regions, two hashtables of rects are maintained. + // The "current" map is used to compute exposed regions of the current frame, while + // the "next" map is used to collect layer rects that are used in the next frame. + typedef HashMap<int, FloatRect> RectMap; + scoped_ptr<RectMap> m_currentRectHistory; + scoped_ptr<RectMap> m_nextRectHistory; + + FloatRect m_currentDamageRect; + bool m_forceFullDamageNextUpdate; +}; + +} // namespace cc + +#endif // CCDamageTracker_h |