Don't consider a Bluetooth adapter present until it has an address.
[chromium-blink-merge.git] / cc / CCDamageTracker.h
blobeb2a644a7820555153a0720902d7d91d3e25ec4f
1 // Copyright 2011 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 CCDamageTracker_h
6 #define CCDamageTracker_h
8 #include "FloatRect.h"
9 #include <wtf/HashMap.h>
10 #include <wtf/PassOwnPtr.h>
11 #include <wtf/Vector.h>
13 namespace WebKit {
14 class WebFilterOperations;
17 namespace WebCore {
19 class CCLayerImpl;
20 class CCRenderSurface;
22 // Computes the region where pixels have actually changed on a RenderSurface. This region is used
23 // to scissor what is actually drawn to the screen to save GPU computation and bandwidth.
24 class CCDamageTracker {
25 public:
26 static PassOwnPtr<CCDamageTracker> create();
27 ~CCDamageTracker();
29 void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); }
30 void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; }
31 void updateDamageTrackingState(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, CCLayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&);
33 const FloatRect& currentDamageRect() { return m_currentDamageRect; }
35 private:
36 CCDamageTracker();
38 FloatRect trackDamageFromActiveLayers(const Vector<CCLayerImpl*>& layerList, int targetSurfaceLayerID);
39 FloatRect trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer);
40 FloatRect trackDamageFromLeftoverRects();
42 FloatRect removeRectFromCurrentFrame(int layerID, bool& layerIsNew);
43 void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect);
45 // These helper functions are used only in trackDamageFromActiveLayers().
46 void extendDamageForLayer(CCLayerImpl*, FloatRect& targetDamageRect);
47 void extendDamageForRenderSurface(CCLayerImpl*, FloatRect& targetDamageRect);
49 // To correctly track exposed regions, two hashtables of rects are maintained.
50 // The "current" map is used to compute exposed regions of the current frame, while
51 // the "next" map is used to collect layer rects that are used in the next frame.
52 typedef HashMap<int, FloatRect> RectMap;
53 OwnPtr<RectMap> m_currentRectHistory;
54 OwnPtr<RectMap> m_nextRectHistory;
56 FloatRect m_currentDamageRect;
57 bool m_forceFullDamageNextUpdate;
60 } // namespace WebCore
62 #endif // CCDamageTracker_h