OLD | NEW |
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/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 gfx::RectF expanded_damage_rect = *damage_rect; | 39 gfx::RectF expanded_damage_rect = *damage_rect; |
40 ExpandRectWithFilters(&expanded_damage_rect, filters); | 40 ExpandRectWithFilters(&expanded_damage_rect, filters); |
41 gfx::RectF filter_rect = pre_filter_rect; | 41 gfx::RectF filter_rect = pre_filter_rect; |
42 ExpandRectWithFilters(&filter_rect, filters); | 42 ExpandRectWithFilters(&filter_rect, filters); |
43 | 43 |
44 expanded_damage_rect.Intersect(filter_rect); | 44 expanded_damage_rect.Intersect(filter_rect); |
45 damage_rect->Union(expanded_damage_rect); | 45 damage_rect->Union(expanded_damage_rect); |
46 } | 46 } |
47 | 47 |
48 void DamageTracker::UpdateDamageTrackingState( | 48 void DamageTracker::UpdateDamageTrackingState( |
49 const std::vector<LayerImpl*>& layer_list, | 49 const LayerImplList& layer_list, |
50 int target_surface_layer_id, | 50 int target_surface_layer_id, |
51 bool target_surface_property_changed_only_from_descendant, | 51 bool target_surface_property_changed_only_from_descendant, |
52 gfx::Rect target_surface_content_rect, | 52 gfx::Rect target_surface_content_rect, |
53 LayerImpl* target_surface_mask_layer, | 53 LayerImpl* target_surface_mask_layer, |
54 const WebKit::WebFilterOperations& filters, | 54 const WebKit::WebFilterOperations& filters, |
55 SkImageFilter* filter) { | 55 SkImageFilter* filter) { |
56 // | 56 // |
57 // 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 |
58 // 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 |
59 // 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 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 void DamageTracker::SaveRectForNextFrame(int layer_id, | 178 void DamageTracker::SaveRectForNextFrame(int layer_id, |
179 const gfx::RectF& target_space_rect) { | 179 const gfx::RectF& target_space_rect) { |
180 // This layer should not yet exist in next frame's history. | 180 // This layer should not yet exist in next frame's history. |
181 DCHECK_GT(layer_id, 0); | 181 DCHECK_GT(layer_id, 0); |
182 DCHECK(next_rect_history_->find(layer_id) == next_rect_history_->end()); | 182 DCHECK(next_rect_history_->find(layer_id) == next_rect_history_->end()); |
183 (*next_rect_history_)[layer_id] = target_space_rect; | 183 (*next_rect_history_)[layer_id] = target_space_rect; |
184 } | 184 } |
185 | 185 |
186 gfx::RectF DamageTracker::TrackDamageFromActiveLayers( | 186 gfx::RectF DamageTracker::TrackDamageFromActiveLayers( |
187 const std::vector<LayerImpl*>& layer_list, | 187 const LayerImplList& layer_list, |
188 int target_surface_layer_id) { | 188 int target_surface_layer_id) { |
189 gfx::RectF damage_rect = gfx::RectF(); | 189 gfx::RectF damage_rect = gfx::RectF(); |
190 | 190 |
191 for (size_t layer_index = 0; layer_index < layer_list.size(); ++layer_index) { | 191 for (size_t layer_index = 0; layer_index < layer_list.size(); ++layer_index) { |
192 // Visit layers in back-to-front order. | 192 // Visit layers in back-to-front order. |
193 LayerImpl* layer = layer_list[layer_index]; | 193 LayerImpl* layer = layer_list[layer_index]; |
194 | 194 |
195 if (LayerTreeHostCommon::RenderSurfaceContributesToTarget<LayerImpl>( | 195 if (LayerTreeHostCommon::RenderSurfaceContributesToTarget<LayerImpl>( |
196 layer, target_surface_layer_id)) | 196 layer, target_surface_layer_id)) |
197 ExtendDamageForRenderSurface(layer, &damage_rect); | 197 ExtendDamageForRenderSurface(layer, &damage_rect); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 // one in them. This means we need to redraw any pixels in the surface being | 386 // one in them. This means we need to redraw any pixels in the surface being |
387 // used for the blur in this layer this frame. | 387 // used for the blur in this layer this frame. |
388 if (layer->background_filters().hasFilterThatMovesPixels()) { | 388 if (layer->background_filters().hasFilterThatMovesPixels()) { |
389 ExpandDamageRectInsideRectWithFilters(target_damage_rect, | 389 ExpandDamageRectInsideRectWithFilters(target_damage_rect, |
390 surface_rect_in_target_space, | 390 surface_rect_in_target_space, |
391 layer->background_filters()); | 391 layer->background_filters()); |
392 } | 392 } |
393 } | 393 } |
394 | 394 |
395 } // namespace cc | 395 } // namespace cc |
OLD | NEW |