| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CCDamageTracker_h |
| 6 #define CCDamageTracker_h | 6 #define CCDamageTracker_h |
| 7 | 7 |
| 8 #include "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/cc_export.h" |
| 10 #include "ui/gfx/rect_f.h" | 11 #include "ui/gfx/rect_f.h" |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 class SkImageFilter; | 14 class SkImageFilter; |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 class Rect; | 17 class Rect; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace WebKit { | 20 namespace WebKit { |
| 20 class WebFilterOperations; | 21 class WebFilterOperations; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace cc { | 24 namespace cc { |
| 24 | 25 |
| 25 class LayerImpl; | 26 class LayerImpl; |
| 26 class RenderSurfaceImpl; | 27 class RenderSurfaceImpl; |
| 27 | 28 |
| 28 // Computes the region where pixels have actually changed on a RenderSurfaceImpl
. This region is used | 29 // Computes the region where pixels have actually changed on a RenderSurfaceImpl
. This region is used |
| 29 // to scissor what is actually drawn to the screen to save GPU computation and b
andwidth. | 30 // to scissor what is actually drawn to the screen to save GPU computation and b
andwidth. |
| 30 class DamageTracker { | 31 class CC_EXPORT DamageTracker { |
| 31 public: | 32 public: |
| 32 static scoped_ptr<DamageTracker> create(); | 33 static scoped_ptr<DamageTracker> create(); |
| 33 ~DamageTracker(); | 34 ~DamageTracker(); |
| 34 | 35 |
| 35 void didDrawDamagedArea() { m_currentDamageRect = gfx::RectF(); } | 36 void didDrawDamagedArea() { m_currentDamageRect = gfx::RectF(); } |
| 36 void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; } | 37 void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; } |
| 37 void updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int
targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, cons
t gfx::Rect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const
WebKit::WebFilterOperations&, SkImageFilter* filter); | 38 void updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int
targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, cons
t gfx::Rect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const
WebKit::WebFilterOperations&, SkImageFilter* filter); |
| 38 | 39 |
| 39 const gfx::RectF& currentDamageRect() { return m_currentDamageRect; } | 40 const gfx::RectF& currentDamageRect() { return m_currentDamageRect; } |
| 40 | 41 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 54 | 55 |
| 55 // To correctly track exposed regions, two hashtables of rects are maintaine
d. | 56 // To correctly track exposed regions, two hashtables of rects are maintaine
d. |
| 56 // The "current" map is used to compute exposed regions of the current frame
, while | 57 // The "current" map is used to compute exposed regions of the current frame
, while |
| 57 // the "next" map is used to collect layer rects that are used in the next f
rame. | 58 // the "next" map is used to collect layer rects that are used in the next f
rame. |
| 58 typedef base::hash_map<int, gfx::RectF> RectMap; | 59 typedef base::hash_map<int, gfx::RectF> RectMap; |
| 59 scoped_ptr<RectMap> m_currentRectHistory; | 60 scoped_ptr<RectMap> m_currentRectHistory; |
| 60 scoped_ptr<RectMap> m_nextRectHistory; | 61 scoped_ptr<RectMap> m_nextRectHistory; |
| 61 | 62 |
| 62 gfx::RectF m_currentDamageRect; | 63 gfx::RectF m_currentDamageRect; |
| 63 bool m_forceFullDamageNextUpdate; | 64 bool m_forceFullDamageNextUpdate; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(DamageTracker); |
| 64 }; | 67 }; |
| 65 | 68 |
| 66 } // namespace cc | 69 } // namespace cc |
| 67 | 70 |
| 68 #endif // CCDamageTracker_h | 71 #endif // CCDamageTracker_h |
| OLD | NEW |