OLD | NEW |
1 // Copyright 2011 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 CCDamageTracker_h | 5 // Temporary forwarding header |
6 #define CCDamageTracker_h | 6 #include "cc/damage_tracker.h" |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "FloatRect.h" | |
10 #include <vector> | |
11 #include <wtf/HashMap.h> | |
12 #include <wtf/Vector.h> | |
13 | |
14 namespace WebKit { | |
15 class WebFilterOperations; | |
16 } | |
17 | |
18 namespace cc { | |
19 | |
20 class CCLayerImpl; | |
21 class CCRenderSurface; | |
22 | |
23 // Computes the region where pixels have actually changed on a RenderSurface. Th
is region is used | |
24 // to scissor what is actually drawn to the screen to save GPU computation and b
andwidth. | |
25 class CCDamageTracker { | |
26 public: | |
27 static scoped_ptr<CCDamageTracker> create(); | |
28 ~CCDamageTracker(); | |
29 | |
30 void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); } | |
31 void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; } | |
32 void updateDamageTrackingState(const std::vector<CCLayerImpl*>& layerList, i
nt targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, co
nst IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, cons
t WebKit::WebFilterOperations&); | |
33 | |
34 const FloatRect& currentDamageRect() { return m_currentDamageRect; } | |
35 | |
36 private: | |
37 CCDamageTracker(); | |
38 | |
39 FloatRect trackDamageFromActiveLayers(const std::vector<CCLayerImpl*>& layer
List, int targetSurfaceLayerID); | |
40 FloatRect trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer); | |
41 FloatRect trackDamageFromLeftoverRects(); | |
42 | |
43 FloatRect removeRectFromCurrentFrame(int layerID, bool& layerIsNew); | |
44 void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect); | |
45 | |
46 // These helper functions are used only in trackDamageFromActiveLayers(). | |
47 void extendDamageForLayer(CCLayerImpl*, FloatRect& targetDamageRect); | |
48 void extendDamageForRenderSurface(CCLayerImpl*, FloatRect& targetDamageRect)
; | |
49 | |
50 // To correctly track exposed regions, two hashtables of rects are maintaine
d. | |
51 // The "current" map is used to compute exposed regions of the current frame
, while | |
52 // the "next" map is used to collect layer rects that are used in the next f
rame. | |
53 typedef HashMap<int, FloatRect> RectMap; | |
54 scoped_ptr<RectMap> m_currentRectHistory; | |
55 scoped_ptr<RectMap> m_nextRectHistory; | |
56 | |
57 FloatRect m_currentDamageRect; | |
58 bool m_forceFullDamageNextUpdate; | |
59 }; | |
60 | |
61 } // namespace cc | |
62 | |
63 #endif // CCDamageTracker_h | |
OLD | NEW |