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

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

Issue 2814273003: cc: Make DamageTracker use the effect tree and layer list (Closed)
Patch Set: Rebase Created 3 years, 8 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/layers/effect_tree_layer_list_iterator.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
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "cc/cc_export.h" 12 #include "cc/cc_export.h"
13 #include "cc/layers/layer_collections.h" 13 #include "cc/layers/layer_collections.h"
14 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
15 15
16 namespace gfx { 16 namespace gfx {
17 class Rect; 17 class Rect;
18 } 18 }
19 19
20 namespace cc { 20 namespace cc {
21 21
22 class FilterOperations; 22 class FilterOperations;
23 class LayerImpl; 23 class LayerImpl;
24 class LayerTreeImpl;
24 class RenderSurfaceImpl; 25 class RenderSurfaceImpl;
25 26
26 // Computes the region where pixels have actually changed on a 27 // Computes the region where pixels have actually changed on a
27 // 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
28 // the screen to save GPU computation and bandwidth. 29 // the screen to save GPU computation and bandwidth.
29 class CC_EXPORT DamageTracker { 30 class CC_EXPORT DamageTracker {
30 public: 31 public:
31 static std::unique_ptr<DamageTracker> Create(); 32 static std::unique_ptr<DamageTracker> Create();
32 ~DamageTracker(); 33 ~DamageTracker();
33 34
35 static void UpdateDamageTracking(LayerTreeImpl* layer_tree_impl,
36 const LayerImplList& render_surface_list);
37
34 void DidDrawDamagedArea() { current_damage_ = DamageAccumulator(); } 38 void DidDrawDamagedArea() { current_damage_ = DamageAccumulator(); }
35 void AddDamageNextUpdate(const gfx::Rect& dmg) { current_damage_.Union(dmg); } 39 void AddDamageNextUpdate(const gfx::Rect& dmg) { current_damage_.Union(dmg); }
36 void UpdateDamageTrackingState(
37 const LayerImplList& layer_list,
38 const RenderSurfaceImpl* target_surface,
39 bool target_surface_property_changed_only_from_descendant,
40 const gfx::Rect& target_surface_content_rect,
41 LayerImpl* target_surface_mask_layer,
42 const FilterOperations& filters);
43 40
44 bool GetDamageRectIfValid(gfx::Rect* rect); 41 bool GetDamageRectIfValid(gfx::Rect* rect);
45 42
46 private: 43 private:
47 DamageTracker(); 44 DamageTracker();
48 45
49 class DamageAccumulator { 46 class DamageAccumulator {
50 public: 47 public:
51 template <typename Type> 48 template <typename Type>
52 void Union(const Type& rect) { 49 void Union(const Type& rect) {
(...skipping 24 matching lines...) Expand all
77 bool GetAsRect(gfx::Rect* rect); 74 bool GetAsRect(gfx::Rect* rect);
78 75
79 private: 76 private:
80 bool is_valid_rect_ = true; 77 bool is_valid_rect_ = true;
81 int x_ = 0; 78 int x_ = 0;
82 int y_ = 0; 79 int y_ = 0;
83 int right_ = 0; 80 int right_ = 0;
84 int bottom_ = 0; 81 int bottom_ = 0;
85 }; 82 };
86 83
87 DamageAccumulator TrackDamageFromActiveLayers(
88 const LayerImplList& layer_list,
89 const RenderSurfaceImpl* target_surface);
90 DamageAccumulator TrackDamageFromSurfaceMask( 84 DamageAccumulator TrackDamageFromSurfaceMask(
91 LayerImpl* target_surface_mask_layer); 85 LayerImpl* target_surface_mask_layer);
92 DamageAccumulator TrackDamageFromLeftoverRects(); 86 DamageAccumulator TrackDamageFromLeftoverRects();
93 void PrepareRectHistoryForUpdate();
94 87
95 // These helper functions are used only in TrackDamageFromActiveLayers(). 88 // These helper functions are used only during UpdateDamageTracking().
96 void ExtendDamageForLayer(LayerImpl* layer, DamageAccumulator* target_damage); 89 void PrepareForUpdate();
97 void ExtendDamageForRenderSurface(RenderSurfaceImpl* render_surface, 90 void AccumulateDamageFromLayer(LayerImpl* layer);
98 DamageAccumulator* target_damage); 91 void AccumulateDamageFromRenderSurface(RenderSurfaceImpl* render_surface);
92 void ComputeSurfaceDamage(RenderSurfaceImpl* render_surface);
99 void ExpandDamageInsideRectWithFilters(const gfx::Rect& pre_filter_rect, 93 void ExpandDamageInsideRectWithFilters(const gfx::Rect& pre_filter_rect,
100 const FilterOperations& filters, 94 const FilterOperations& filters);
101 DamageAccumulator* damage);
102 95
103 struct LayerRectMapData { 96 struct LayerRectMapData {
104 LayerRectMapData() : layer_id_(0), mailboxId_(0) {} 97 LayerRectMapData() : layer_id_(0), mailboxId_(0) {}
105 explicit LayerRectMapData(int layer_id) 98 explicit LayerRectMapData(int layer_id)
106 : layer_id_(layer_id), mailboxId_(0) {} 99 : layer_id_(layer_id), mailboxId_(0) {}
107 void Update(const gfx::Rect& rect, unsigned int mailboxId) { 100 void Update(const gfx::Rect& rect, unsigned int mailboxId) {
108 mailboxId_ = mailboxId; 101 mailboxId_ = mailboxId;
109 rect_ = rect; 102 rect_ = rect;
110 } 103 }
111 104
(...skipping 28 matching lines...) Expand all
140 133
141 LayerRectMapData& RectDataForLayer(int layer_id, bool* layer_is_new); 134 LayerRectMapData& RectDataForLayer(int layer_id, bool* layer_is_new);
142 SurfaceRectMapData& RectDataForSurface(int layer_id, bool* layer_is_new); 135 SurfaceRectMapData& RectDataForSurface(int layer_id, bool* layer_is_new);
143 136
144 SortedRectMapForLayers rect_history_for_layers_; 137 SortedRectMapForLayers rect_history_for_layers_;
145 SortedRectMapForSurfaces rect_history_for_surfaces_; 138 SortedRectMapForSurfaces rect_history_for_surfaces_;
146 139
147 unsigned int mailboxId_; 140 unsigned int mailboxId_;
148 DamageAccumulator current_damage_; 141 DamageAccumulator current_damage_;
149 142
143 // Damage accumulated since the last call to PrepareForUpdate().
144 DamageAccumulator damage_for_this_update_;
145
150 DISALLOW_COPY_AND_ASSIGN(DamageTracker); 146 DISALLOW_COPY_AND_ASSIGN(DamageTracker);
151 }; 147 };
152 148
153 } // namespace cc 149 } // namespace cc
154 150
155 #endif // CC_TREES_DAMAGE_TRACKER_H_ 151 #endif // CC_TREES_DAMAGE_TRACKER_H_
OLDNEW
« no previous file with comments | « cc/layers/effect_tree_layer_list_iterator.cc ('k') | cc/trees/damage_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698