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" | |
10 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
11 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
12 #include "cc/layers/layer_lists.h" | 11 #include "cc/layers/layer_lists.h" |
13 #include "ui/gfx/rect_f.h" | 12 #include "ui/gfx/rect_f.h" |
14 | 13 |
15 class SkImageFilter; | 14 class SkImageFilter; |
16 | 15 |
17 namespace gfx { | 16 namespace gfx { |
18 class Rect; | 17 class Rect; |
19 } | 18 } |
(...skipping 26 matching lines...) Expand all Loading... | |
46 | 45 |
47 private: | 46 private: |
48 DamageTracker(); | 47 DamageTracker(); |
49 | 48 |
50 gfx::RectF TrackDamageFromActiveLayers( | 49 gfx::RectF TrackDamageFromActiveLayers( |
51 const LayerImplList& layer_list, | 50 const LayerImplList& layer_list, |
52 int target_surface_layer_id); | 51 int target_surface_layer_id); |
53 gfx::RectF TrackDamageFromSurfaceMask(LayerImpl* target_surface_mask_layer); | 52 gfx::RectF TrackDamageFromSurfaceMask(LayerImpl* target_surface_mask_layer); |
54 gfx::RectF TrackDamageFromLeftoverRects(); | 53 gfx::RectF TrackDamageFromLeftoverRects(); |
55 | 54 |
56 gfx::RectF RemoveRectFromCurrentFrame(int layer_id, bool* layer_is_new); | 55 void PrepareRectHistoryForUpdate(); |
57 void SaveRectForNextFrame(int layer_id, const gfx::RectF& target_space_rect); | |
58 | 56 |
59 // These helper functions are used only in TrackDamageFromActiveLayers(). | 57 // These helper functions are used only in TrackDamageFromActiveLayers(). |
60 void ExtendDamageForLayer(LayerImpl* layer, gfx::RectF* target_damage_rect); | 58 void ExtendDamageForLayer(LayerImpl* layer, gfx::RectF* target_damage_rect); |
61 void ExtendDamageForRenderSurface(LayerImpl* layer, | 59 void ExtendDamageForRenderSurface(LayerImpl* layer, |
62 gfx::RectF* target_damage_rect); | 60 gfx::RectF* target_damage_rect); |
63 | 61 |
64 // To correctly track exposed regions, two hashtables of rects are maintained. | 62 struct RectMapData { |
65 // The "current" map is used to compute exposed regions of the current frame, | 63 RectMapData() : layer_id_(0), mailboxId_(0) {} |
66 // while the "next" map is used to collect layer rects that are used in the | 64 explicit RectMapData(int layer_id) : layer_id_(layer_id), mailboxId_(0) {} |
67 // next frame. | 65 void Update(const gfx::RectF& rect, unsigned int mailboxId) { |
68 typedef base::hash_map<int, gfx::RectF> RectMap; | 66 rect_ = rect; |
69 scoped_ptr<RectMap> current_rect_history_; | 67 mailboxId_ = mailboxId; |
70 scoped_ptr<RectMap> next_rect_history_; | 68 } |
69 | |
70 bool operator < (const RectMapData& other) { | |
71 return layer_id_ < other.layer_id_; | |
72 } | |
73 | |
74 int layer_id_; | |
75 gfx::RectF rect_; | |
76 unsigned int mailboxId_; | |
shawnsingh
2013/11/23 01:32:01
Let's declare mailboxId_ above rect_, on the very
ostap
2013/11/25 16:11:39
Done.
| |
77 }; | |
78 typedef std::vector<RectMapData> SortedRectMap; | |
79 | |
80 RectMapData& RectDataForLayer(int layer_id, bool* layer_is_new); | |
81 | |
82 SortedRectMap rect_history_; | |
71 | 83 |
72 gfx::RectF current_damage_rect_; | 84 gfx::RectF current_damage_rect_; |
85 unsigned int mailboxId_; | |
73 | 86 |
74 DISALLOW_COPY_AND_ASSIGN(DamageTracker); | 87 DISALLOW_COPY_AND_ASSIGN(DamageTracker); |
75 }; | 88 }; |
76 | 89 |
77 } // namespace cc | 90 } // namespace cc |
78 | 91 |
79 #endif // CC_TREES_DAMAGE_TRACKER_H_ | 92 #endif // CC_TREES_DAMAGE_TRACKER_H_ |
OLD | NEW |