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 <vector> | 8 #include <vector> |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // Computes the region where pixels have actually changed on a | 30 // Computes the region where pixels have actually changed on a |
31 // RenderSurfaceImpl. This region is used to scissor what is actually drawn to | 31 // RenderSurfaceImpl. This region is used to scissor what is actually drawn to |
32 // the screen to save GPU computation and bandwidth. | 32 // the screen to save GPU computation and bandwidth. |
33 class CC_EXPORT DamageTracker { | 33 class CC_EXPORT DamageTracker { |
34 public: | 34 public: |
35 static scoped_ptr<DamageTracker> Create(); | 35 static scoped_ptr<DamageTracker> Create(); |
36 ~DamageTracker(); | 36 ~DamageTracker(); |
37 | 37 |
38 void DidDrawDamagedArea() { current_damage_rect_ = gfx::RectF(); } | 38 void DidDrawDamagedArea() { current_damage_rect_ = gfx::RectF(); } |
39 void ForceFullDamageNextUpdate() { force_full_damage_next_update_ = true; } | 39 void AddDamageNextUpdate(gfx::RectF dmg) { current_damage_rect_.Union(dmg); } |
40 void UpdateDamageTrackingState( | 40 void UpdateDamageTrackingState( |
41 const LayerImplList& layer_list, | 41 const LayerImplList& layer_list, |
42 int target_surface_layer_id, | 42 int target_surface_layer_id, |
43 bool target_surface_property_changed_only_from_descendant, | 43 bool target_surface_property_changed_only_from_descendant, |
44 gfx::Rect target_surface_content_rect, | 44 gfx::Rect target_surface_content_rect, |
45 LayerImpl* target_surface_mask_layer, | 45 LayerImpl* target_surface_mask_layer, |
46 const WebKit::WebFilterOperations& filters, | 46 const WebKit::WebFilterOperations& filters, |
47 SkImageFilter* filter); | 47 SkImageFilter* filter); |
48 | 48 |
49 gfx::RectF current_damage_rect() { return current_damage_rect_; } | 49 gfx::RectF current_damage_rect() { return current_damage_rect_; } |
(...skipping 17 matching lines...) Expand all Loading... |
67 | 67 |
68 // To correctly track exposed regions, two hashtables of rects are maintained. | 68 // To correctly track exposed regions, two hashtables of rects are maintained. |
69 // The "current" map is used to compute exposed regions of the current frame, | 69 // The "current" map is used to compute exposed regions of the current frame, |
70 // while the "next" map is used to collect layer rects that are used in the | 70 // while the "next" map is used to collect layer rects that are used in the |
71 // next frame. | 71 // next frame. |
72 typedef base::hash_map<int, gfx::RectF> RectMap; | 72 typedef base::hash_map<int, gfx::RectF> RectMap; |
73 scoped_ptr<RectMap> current_rect_history_; | 73 scoped_ptr<RectMap> current_rect_history_; |
74 scoped_ptr<RectMap> next_rect_history_; | 74 scoped_ptr<RectMap> next_rect_history_; |
75 | 75 |
76 gfx::RectF current_damage_rect_; | 76 gfx::RectF current_damage_rect_; |
77 bool force_full_damage_next_update_; | |
78 | 77 |
79 DISALLOW_COPY_AND_ASSIGN(DamageTracker); | 78 DISALLOW_COPY_AND_ASSIGN(DamageTracker); |
80 }; | 79 }; |
81 | 80 |
82 } // namespace cc | 81 } // namespace cc |
83 | 82 |
84 #endif // CC_TREES_DAMAGE_TRACKER_H_ | 83 #endif // CC_TREES_DAMAGE_TRACKER_H_ |
OLD | NEW |