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

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

Issue 21154002: Add support for converting cc::FilterOperations into an SkImageFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 3 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"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 expanded_damage_rect.Intersect(filter_rect); 45 expanded_damage_rect.Intersect(filter_rect);
46 damage_rect->Union(expanded_damage_rect); 46 damage_rect->Union(expanded_damage_rect);
47 } 47 }
48 48
49 void DamageTracker::UpdateDamageTrackingState( 49 void DamageTracker::UpdateDamageTrackingState(
50 const LayerImplList& layer_list, 50 const LayerImplList& layer_list,
51 int target_surface_layer_id, 51 int target_surface_layer_id,
52 bool target_surface_property_changed_only_from_descendant, 52 bool target_surface_property_changed_only_from_descendant,
53 gfx::Rect target_surface_content_rect, 53 gfx::Rect target_surface_content_rect,
54 LayerImpl* target_surface_mask_layer, 54 LayerImpl* target_surface_mask_layer,
55 const FilterOperations& filters, 55 const FilterOperations& filters) {
56 SkImageFilter* filter) {
57 // 56 //
58 // This function computes the "damage rect" of a target surface, and updates 57 // This function computes the "damage rect" of a target surface, and updates
59 // the state that is used to correctly track damage across frames. The damage 58 // the state that is used to correctly track damage across frames. The damage
60 // rect is the region of the surface that may have changed and needs to be 59 // rect is the region of the surface that may have changed and needs to be
61 // redrawn. This can be used to scissor what is actually drawn, to save GPU 60 // redrawn. This can be used to scissor what is actually drawn, to save GPU
62 // computation and bandwidth. 61 // computation and bandwidth.
63 // 62 //
64 // The surface's damage rect is computed as the union of all possible changes 63 // The surface's damage rect is computed as the union of all possible changes
65 // that have happened to the surface since the last frame was drawn. This 64 // that have happened to the surface since the last frame was drawn. This
66 // includes: 65 // includes:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 135
137 if (target_surface_property_changed_only_from_descendant) { 136 if (target_surface_property_changed_only_from_descendant) {
138 damage_rect_for_this_update = target_surface_content_rect; 137 damage_rect_for_this_update = target_surface_content_rect;
139 } else { 138 } else {
140 // TODO(shawnsingh): can we clamp this damage to the surface's content rect? 139 // TODO(shawnsingh): can we clamp this damage to the surface's content rect?
141 // (affects performance, but not correctness) 140 // (affects performance, but not correctness)
142 damage_rect_for_this_update = damage_from_active_layers; 141 damage_rect_for_this_update = damage_from_active_layers;
143 damage_rect_for_this_update.Union(damage_from_surface_mask); 142 damage_rect_for_this_update.Union(damage_from_surface_mask);
144 damage_rect_for_this_update.Union(damage_from_leftover_rects); 143 damage_rect_for_this_update.Union(damage_from_leftover_rects);
145 144
146 if (filters.HasFilterThatMovesPixels()) { 145 if (filters.HasReferenceFilter()) {
147 ExpandRectWithFilters(&damage_rect_for_this_update, filters);
148 } else if (filter) {
149 // TODO(senorblanco): Once SkImageFilter reports its outsets, use 146 // TODO(senorblanco): Once SkImageFilter reports its outsets, use
150 // those here to limit damage. 147 // those here to limit damage.
151 damage_rect_for_this_update = target_surface_content_rect; 148 damage_rect_for_this_update = target_surface_content_rect;
149 } else if (filters.HasFilterThatMovesPixels()) {
150 ExpandRectWithFilters(&damage_rect_for_this_update, filters);
152 } 151 }
153 } 152 }
154 153
155 // Damage accumulates until we are notified that we actually did draw on that 154 // Damage accumulates until we are notified that we actually did draw on that
156 // frame. 155 // frame.
157 current_damage_rect_.Union(damage_rect_for_this_update); 156 current_damage_rect_.Union(damage_rect_for_this_update);
158 157
159 // The next history map becomes the current map for the next frame. Note this 158 // The next history map becomes the current map for the next frame. Note this
160 // must happen every frame to correctly track changes, even if damage 159 // must happen every frame to correctly track changes, even if damage
161 // accumulates over multiple frames before actually being drawn. 160 // accumulates over multiple frames before actually being drawn.
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // one in them. This means we need to redraw any pixels in the surface being 390 // one in them. This means we need to redraw any pixels in the surface being
392 // used for the blur in this layer this frame. 391 // used for the blur in this layer this frame.
393 if (layer->background_filters().HasFilterThatMovesPixels()) { 392 if (layer->background_filters().HasFilterThatMovesPixels()) {
394 ExpandDamageRectInsideRectWithFilters(target_damage_rect, 393 ExpandDamageRectInsideRectWithFilters(target_damage_rect,
395 surface_rect_in_target_space, 394 surface_rect_in_target_space,
396 layer->background_filters()); 395 layer->background_filters());
397 } 396 }
398 } 397 }
399 398
400 } // namespace cc 399 } // 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