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

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

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: Rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/damage_tracker.h ('k') | cc/trees/damage_tracker_unittest.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 #include "cc/trees/damage_tracker.h" 5 #include "cc/trees/damage_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/layers/heads_up_display_layer_impl.h" 10 #include "cc/layers/heads_up_display_layer_impl.h"
11 #include "cc/layers/layer_impl.h" 11 #include "cc/layers/layer_impl.h"
12 #include "cc/layers/render_surface_impl.h" 12 #include "cc/layers/render_surface_impl.h"
13 #include "cc/trees/layer_tree_host_common.h" 13 #include "cc/trees/layer_tree_host_common.h"
14 #include "cc/trees/layer_tree_impl.h" 14 #include "cc/trees/layer_tree_impl.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h"
16 16
17 namespace cc { 17 namespace cc {
18 18
19 scoped_ptr<DamageTracker> DamageTracker::Create() { 19 scoped_ptr<DamageTracker> DamageTracker::Create() {
20 return make_scoped_ptr(new DamageTracker()); 20 return make_scoped_ptr(new DamageTracker());
21 } 21 }
22 22
23 DamageTracker::DamageTracker() 23 DamageTracker::DamageTracker()
24 : current_rect_history_(new RectMap), 24 : current_rect_history_(new RectMap),
25 next_rect_history_(new RectMap), 25 next_rect_history_(new RectMap) {}
26 force_full_damage_next_update_(false) {}
27 26
28 DamageTracker::~DamageTracker() {} 27 DamageTracker::~DamageTracker() {}
29 28
30 static inline void ExpandRectWithFilters( 29 static inline void ExpandRectWithFilters(
31 gfx::RectF* rect, const WebKit::WebFilterOperations& filters) { 30 gfx::RectF* rect, const WebKit::WebFilterOperations& filters) {
32 int top, right, bottom, left; 31 int top, right, bottom, left;
33 filters.getOutsets(top, right, bottom, left); 32 filters.getOutsets(top, right, bottom, left);
34 rect->Inset(-left, -top, -right, -bottom); 33 rect->Inset(-left, -top, -right, -bottom);
35 } 34 }
36 35
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // the damage will be for this frame, because we need to update the damage 127 // the damage will be for this frame, because we need to update the damage
129 // tracker state to correctly track the next frame. 128 // tracker state to correctly track the next frame.
130 gfx::RectF damage_from_active_layers = 129 gfx::RectF damage_from_active_layers =
131 TrackDamageFromActiveLayers(layer_list, target_surface_layer_id); 130 TrackDamageFromActiveLayers(layer_list, target_surface_layer_id);
132 gfx::RectF damage_from_surface_mask = 131 gfx::RectF damage_from_surface_mask =
133 TrackDamageFromSurfaceMask(target_surface_mask_layer); 132 TrackDamageFromSurfaceMask(target_surface_mask_layer);
134 gfx::RectF damage_from_leftover_rects = TrackDamageFromLeftoverRects(); 133 gfx::RectF damage_from_leftover_rects = TrackDamageFromLeftoverRects();
135 134
136 gfx::RectF damage_rect_for_this_update; 135 gfx::RectF damage_rect_for_this_update;
137 136
138 if (force_full_damage_next_update_ || 137 if (target_surface_property_changed_only_from_descendant) {
139 target_surface_property_changed_only_from_descendant) {
140 damage_rect_for_this_update = target_surface_content_rect; 138 damage_rect_for_this_update = target_surface_content_rect;
141 force_full_damage_next_update_ = false;
142 } else { 139 } else {
143 // TODO(shawnsingh): can we clamp this damage to the surface's content rect? 140 // TODO(shawnsingh): can we clamp this damage to the surface's content rect?
144 // (affects performance, but not correctness) 141 // (affects performance, but not correctness)
145 damage_rect_for_this_update = damage_from_active_layers; 142 damage_rect_for_this_update = damage_from_active_layers;
146 damage_rect_for_this_update.Union(damage_from_surface_mask); 143 damage_rect_for_this_update.Union(damage_from_surface_mask);
147 damage_rect_for_this_update.Union(damage_from_leftover_rects); 144 damage_rect_for_this_update.Union(damage_from_leftover_rects);
148 145
149 if (filters.hasFilterThatMovesPixels()) { 146 if (filters.hasFilterThatMovesPixels()) {
150 ExpandRectWithFilters(&damage_rect_for_this_update, filters); 147 ExpandRectWithFilters(&damage_rect_for_this_update, filters);
151 } else if (filter) { 148 } else if (filter) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // one in them. This means we need to redraw any pixels in the surface being 391 // one in them. This means we need to redraw any pixels in the surface being
395 // used for the blur in this layer this frame. 392 // used for the blur in this layer this frame.
396 if (layer->background_filters().hasFilterThatMovesPixels()) { 393 if (layer->background_filters().hasFilterThatMovesPixels()) {
397 ExpandDamageRectInsideRectWithFilters(target_damage_rect, 394 ExpandDamageRectInsideRectWithFilters(target_damage_rect,
398 surface_rect_in_target_space, 395 surface_rect_in_target_space,
399 layer->background_filters()); 396 layer->background_filters());
400 } 397 }
401 } 398 }
402 399
403 } // namespace cc 400 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/damage_tracker.h ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698