Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: cc/trees/damage_tracker.h

Issue 2873593002: Force use of and cache render surface. (Closed)
Patch Set: Rebased to resolve conflict. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/quads/render_pass_unittest.cc ('k') | cc/trees/damage_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « cc/quads/render_pass_unittest.cc ('k') | cc/trees/damage_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698