| 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 CC_TREES_DAMAGE_TRACKER_H_ | 5 #ifndef CC_TREES_DAMAGE_TRACKER_H_ |
| 6 #define CC_TREES_DAMAGE_TRACKER_H_ | 6 #define CC_TREES_DAMAGE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class RenderSurfaceImpl; | 25 class RenderSurfaceImpl; |
| 26 | 26 |
| 27 // Computes the region where pixels have actually changed on a | 27 // Computes the region where pixels have actually changed on a |
| 28 // RenderSurfaceImpl. This region is used to scissor what is actually drawn to | 28 // RenderSurfaceImpl. This region is used to scissor what is actually drawn to |
| 29 // the screen to save GPU computation and bandwidth. | 29 // the screen to save GPU computation and bandwidth. |
| 30 class CC_EXPORT DamageTracker { | 30 class CC_EXPORT DamageTracker { |
| 31 public: | 31 public: |
| 32 static std::unique_ptr<DamageTracker> Create(); | 32 static std::unique_ptr<DamageTracker> Create(); |
| 33 ~DamageTracker(); | 33 ~DamageTracker(); |
| 34 | 34 |
| 35 static void UpdateDamageTracking(LayerTreeImpl* layer_tree_impl, | 35 static void UpdateDamageTracking( |
| 36 const LayerImplList& render_surface_list); | 36 LayerTreeImpl* layer_tree_impl, |
| 37 const RenderSurfaceList& render_surface_list); |
| 37 | 38 |
| 38 void DidDrawDamagedArea() { current_damage_ = DamageAccumulator(); } | 39 void DidDrawDamagedArea() { current_damage_ = DamageAccumulator(); } |
| 39 void AddDamageNextUpdate(const gfx::Rect& dmg) { current_damage_.Union(dmg); } | 40 void AddDamageNextUpdate(const gfx::Rect& dmg) { current_damage_.Union(dmg); } |
| 40 | 41 |
| 41 bool GetDamageRectIfValid(gfx::Rect* rect); | 42 bool GetDamageRectIfValid(gfx::Rect* rect); |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 DamageTracker(); | 45 DamageTracker(); |
| 45 | 46 |
| 46 class DamageAccumulator { | 47 class DamageAccumulator { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 143 |
| 143 // Damage accumulated since the last call to PrepareForUpdate(). | 144 // Damage accumulated since the last call to PrepareForUpdate(). |
| 144 DamageAccumulator damage_for_this_update_; | 145 DamageAccumulator damage_for_this_update_; |
| 145 | 146 |
| 146 DISALLOW_COPY_AND_ASSIGN(DamageTracker); | 147 DISALLOW_COPY_AND_ASSIGN(DamageTracker); |
| 147 }; | 148 }; |
| 148 | 149 |
| 149 } // namespace cc | 150 } // namespace cc |
| 150 | 151 |
| 151 #endif // CC_TREES_DAMAGE_TRACKER_H_ | 152 #endif // CC_TREES_DAMAGE_TRACKER_H_ |
| OLD | NEW |