| 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/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "cc/layers/layer_lists.h" | 12 #include "cc/layers/layer_lists.h" |
| 13 #include "ui/gfx/rect_f.h" | 13 #include "ui/gfx/rect_f.h" |
| 14 | 14 |
| 15 class SkImageFilter; | 15 class SkImageFilter; |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Rect; | 18 class Rect; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace WebKit { | |
| 22 class WebFilterOperations; | |
| 23 } | |
| 24 | |
| 25 namespace cc { | 21 namespace cc { |
| 26 | 22 |
| 23 class FilterOperations; |
| 27 class LayerImpl; | 24 class LayerImpl; |
| 28 class RenderSurfaceImpl; | 25 class RenderSurfaceImpl; |
| 29 | 26 |
| 30 // Computes the region where pixels have actually changed on a | 27 // Computes the region where pixels have actually changed on a |
| 31 // 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 |
| 32 // the screen to save GPU computation and bandwidth. | 29 // the screen to save GPU computation and bandwidth. |
| 33 class CC_EXPORT DamageTracker { | 30 class CC_EXPORT DamageTracker { |
| 34 public: | 31 public: |
| 35 static scoped_ptr<DamageTracker> Create(); | 32 static scoped_ptr<DamageTracker> Create(); |
| 36 ~DamageTracker(); | 33 ~DamageTracker(); |
| 37 | 34 |
| 38 void DidDrawDamagedArea() { current_damage_rect_ = gfx::RectF(); } | 35 void DidDrawDamagedArea() { current_damage_rect_ = gfx::RectF(); } |
| 39 void AddDamageNextUpdate(gfx::RectF dmg) { current_damage_rect_.Union(dmg); } | 36 void AddDamageNextUpdate(gfx::RectF dmg) { current_damage_rect_.Union(dmg); } |
| 40 void UpdateDamageTrackingState( | 37 void UpdateDamageTrackingState( |
| 41 const LayerImplList& layer_list, | 38 const LayerImplList& layer_list, |
| 42 int target_surface_layer_id, | 39 int target_surface_layer_id, |
| 43 bool target_surface_property_changed_only_from_descendant, | 40 bool target_surface_property_changed_only_from_descendant, |
| 44 gfx::Rect target_surface_content_rect, | 41 gfx::Rect target_surface_content_rect, |
| 45 LayerImpl* target_surface_mask_layer, | 42 LayerImpl* target_surface_mask_layer, |
| 46 const WebKit::WebFilterOperations& filters, | 43 const FilterOperations& filters, |
| 47 SkImageFilter* filter); | 44 SkImageFilter* filter); |
| 48 | 45 |
| 49 gfx::RectF current_damage_rect() { return current_damage_rect_; } | 46 gfx::RectF current_damage_rect() { return current_damage_rect_; } |
| 50 | 47 |
| 51 private: | 48 private: |
| 52 DamageTracker(); | 49 DamageTracker(); |
| 53 | 50 |
| 54 gfx::RectF TrackDamageFromActiveLayers( | 51 gfx::RectF TrackDamageFromActiveLayers( |
| 55 const LayerImplList& layer_list, | 52 const LayerImplList& layer_list, |
| 56 int target_surface_layer_id); | 53 int target_surface_layer_id); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 74 scoped_ptr<RectMap> next_rect_history_; | 71 scoped_ptr<RectMap> next_rect_history_; |
| 75 | 72 |
| 76 gfx::RectF current_damage_rect_; | 73 gfx::RectF current_damage_rect_; |
| 77 | 74 |
| 78 DISALLOW_COPY_AND_ASSIGN(DamageTracker); | 75 DISALLOW_COPY_AND_ASSIGN(DamageTracker); |
| 79 }; | 76 }; |
| 80 | 77 |
| 81 } // namespace cc | 78 } // namespace cc |
| 82 | 79 |
| 83 #endif // CC_TREES_DAMAGE_TRACKER_H_ | 80 #endif // CC_TREES_DAMAGE_TRACKER_H_ |
| OLD | NEW |