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

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

Issue 12662021: cc: Don't draw and swap if the frame will not change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add perf test Created 7 years, 9 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 | Annotate | Revision Log
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 <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 17 matching lines...) Expand all
28 28
29 // Computes the region where pixels have actually changed on a 29 // Computes the region where pixels have actually changed on a
30 // RenderSurfaceImpl. This region is used to scissor what is actually drawn to 30 // RenderSurfaceImpl. This region is used to scissor what is actually drawn to
31 // the screen to save GPU computation and bandwidth. 31 // the screen to save GPU computation and bandwidth.
32 class CC_EXPORT DamageTracker { 32 class CC_EXPORT DamageTracker {
33 public: 33 public:
34 static scoped_ptr<DamageTracker> Create(); 34 static scoped_ptr<DamageTracker> Create();
35 ~DamageTracker(); 35 ~DamageTracker();
36 36
37 void DidDrawDamagedArea() { current_damage_rect_ = gfx::RectF(); } 37 void DidDrawDamagedArea() { current_damage_rect_ = gfx::RectF(); }
38 void ForceFullDamageNextUpdate() { force_full_damage_next_update_ = true; } 38 void AddDamageNextUpdate(gfx::RectF dmg) { current_damage_rect_.Union(dmg); }
39 void UpdateDamageTrackingState( 39 void UpdateDamageTrackingState(
40 const std::vector<LayerImpl*>& layer_list, 40 const std::vector<LayerImpl*>& layer_list,
41 int target_surface_layer_id, 41 int target_surface_layer_id,
42 bool target_surface_property_changed_only_from_descendant, 42 bool target_surface_property_changed_only_from_descendant,
43 gfx::Rect target_surface_content_rect, 43 gfx::Rect target_surface_content_rect,
44 LayerImpl* target_surface_mask_layer, 44 LayerImpl* target_surface_mask_layer,
45 const WebKit::WebFilterOperations& filters, 45 const WebKit::WebFilterOperations& filters,
46 SkImageFilter* filter); 46 SkImageFilter* filter);
47 47
48 gfx::RectF current_damage_rect() { return current_damage_rect_; } 48 gfx::RectF current_damage_rect() { return current_damage_rect_; }
(...skipping 17 matching lines...) Expand all
66 66
67 // To correctly track exposed regions, two hashtables of rects are maintained. 67 // To correctly track exposed regions, two hashtables of rects are maintained.
68 // The "current" map is used to compute exposed regions of the current frame, 68 // The "current" map is used to compute exposed regions of the current frame,
69 // while the "next" map is used to collect layer rects that are used in the 69 // while the "next" map is used to collect layer rects that are used in the
70 // next frame. 70 // next frame.
71 typedef base::hash_map<int, gfx::RectF> RectMap; 71 typedef base::hash_map<int, gfx::RectF> RectMap;
72 scoped_ptr<RectMap> current_rect_history_; 72 scoped_ptr<RectMap> current_rect_history_;
73 scoped_ptr<RectMap> next_rect_history_; 73 scoped_ptr<RectMap> next_rect_history_;
74 74
75 gfx::RectF current_damage_rect_; 75 gfx::RectF current_damage_rect_;
76 bool force_full_damage_next_update_;
77 76
78 DISALLOW_COPY_AND_ASSIGN(DamageTracker); 77 DISALLOW_COPY_AND_ASSIGN(DamageTracker);
79 }; 78 };
80 79
81 } // namespace cc 80 } // namespace cc
82 81
83 #endif // CC_TREES_DAMAGE_TRACKER_H_ 82 #endif // CC_TREES_DAMAGE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698