| 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 18 matching lines...) Expand all Loading... |
| 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( | 35 static void UpdateDamageTracking( |
| 36 LayerTreeImpl* layer_tree_impl, | 36 LayerTreeImpl* layer_tree_impl, |
| 37 const RenderSurfaceList& render_surface_list); | 37 const RenderSurfaceList& render_surface_list); |
| 38 | 38 |
| 39 void DidDrawDamagedArea() { current_damage_ = DamageAccumulator(); } | 39 void DidDrawDamagedArea() { |
| 40 current_damage_ = DamageAccumulator(); |
| 41 has_damage_from_contributing_content_ = false; |
| 42 } |
| 40 void AddDamageNextUpdate(const gfx::Rect& dmg) { current_damage_.Union(dmg); } | 43 void AddDamageNextUpdate(const gfx::Rect& dmg) { current_damage_.Union(dmg); } |
| 41 | 44 |
| 42 bool GetDamageRectIfValid(gfx::Rect* rect); | 45 bool GetDamageRectIfValid(gfx::Rect* rect); |
| 43 | 46 |
| 47 bool has_damage_from_contributing_content() const { |
| 48 return has_damage_from_contributing_content_; |
| 49 } |
| 50 |
| 44 private: | 51 private: |
| 45 DamageTracker(); | 52 DamageTracker(); |
| 46 | 53 |
| 47 class DamageAccumulator { | 54 class DamageAccumulator { |
| 48 public: | 55 public: |
| 49 template <typename Type> | 56 template <typename Type> |
| 50 void Union(const Type& rect) { | 57 void Union(const Type& rect) { |
| 51 if (!is_valid_rect_) | 58 if (!is_valid_rect_) |
| 52 return; | 59 return; |
| 53 if (rect.IsEmpty()) | 60 if (rect.IsEmpty()) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 141 |
| 135 LayerRectMapData& RectDataForLayer(int layer_id, bool* layer_is_new); | 142 LayerRectMapData& RectDataForLayer(int layer_id, bool* layer_is_new); |
| 136 SurfaceRectMapData& RectDataForSurface(uint64_t surface_id, | 143 SurfaceRectMapData& RectDataForSurface(uint64_t surface_id, |
| 137 bool* layer_is_new); | 144 bool* layer_is_new); |
| 138 | 145 |
| 139 SortedRectMapForLayers rect_history_for_layers_; | 146 SortedRectMapForLayers rect_history_for_layers_; |
| 140 SortedRectMapForSurfaces rect_history_for_surfaces_; | 147 SortedRectMapForSurfaces rect_history_for_surfaces_; |
| 141 | 148 |
| 142 unsigned int mailboxId_; | 149 unsigned int mailboxId_; |
| 143 DamageAccumulator current_damage_; | 150 DamageAccumulator current_damage_; |
| 151 // Damage from contributing render surface and layer |
| 152 bool has_damage_from_contributing_content_; |
| 144 | 153 |
| 145 // Damage accumulated since the last call to PrepareForUpdate(). | 154 // Damage accumulated since the last call to PrepareForUpdate(). |
| 146 DamageAccumulator damage_for_this_update_; | 155 DamageAccumulator damage_for_this_update_; |
| 147 | 156 |
| 148 DISALLOW_COPY_AND_ASSIGN(DamageTracker); | 157 DISALLOW_COPY_AND_ASSIGN(DamageTracker); |
| 149 }; | 158 }; |
| 150 | 159 |
| 151 } // namespace cc | 160 } // namespace cc |
| 152 | 161 |
| 153 #endif // CC_TREES_DAMAGE_TRACKER_H_ | 162 #endif // CC_TREES_DAMAGE_TRACKER_H_ |
| OLD | NEW |