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> |
| 8 |
7 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
8 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
9 #include "cc/layers/render_surface_impl.h" | 11 #include "cc/layers/render_surface_impl.h" |
10 #include "cc/trees/layer_tree_host_common.h" | 12 #include "cc/trees/layer_tree_host_common.h" |
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
12 | 14 |
13 namespace cc { | 15 namespace cc { |
14 | 16 |
15 scoped_ptr<DamageTracker> DamageTracker::Create() { | 17 scoped_ptr<DamageTracker> DamageTracker::Create() { |
16 return make_scoped_ptr(new DamageTracker()); | 18 return make_scoped_ptr(new DamageTracker()); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 damage_rect.Union(it->second); | 234 damage_rect.Union(it->second); |
233 | 235 |
234 current_rect_history_->clear(); | 236 current_rect_history_->clear(); |
235 | 237 |
236 return damage_rect; | 238 return damage_rect; |
237 } | 239 } |
238 | 240 |
239 static bool LayerNeedsToRedrawOntoItsTargetSurface(LayerImpl* layer) { | 241 static bool LayerNeedsToRedrawOntoItsTargetSurface(LayerImpl* layer) { |
240 // If the layer does NOT own a surface but has SurfacePropertyChanged, | 242 // If the layer does NOT own a surface but has SurfacePropertyChanged, |
241 // this means that its target surface is affected and needs to be redrawn. | 243 // this means that its target surface is affected and needs to be redrawn. |
242 // However, if the layer DOES own a surface, then the SurfacePropertyChanged | 244 // However, if the layer DOES own a surface, then the SurfacePropertyChanged |
243 // flag should not be used here, because that flag represents whether the | 245 // flag should not be used here, because that flag represents whether the |
244 // layer's surface has changed. | 246 // layer's surface has changed. |
245 if (layer->render_surface()) | 247 if (layer->render_surface()) |
246 return layer->LayerPropertyChanged(); | 248 return layer->LayerPropertyChanged(); |
247 return layer->LayerPropertyChanged() || layer->LayerSurfacePropertyChanged(); | 249 return layer->LayerPropertyChanged() || layer->LayerSurfacePropertyChanged(); |
248 } | 250 } |
249 | 251 |
250 void DamageTracker::ExtendDamageForLayer(LayerImpl* layer, | 252 void DamageTracker::ExtendDamageForLayer(LayerImpl* layer, |
251 gfx::RectF* target_damage_rect) { | 253 gfx::RectF* target_damage_rect) { |
252 // There are two ways that a layer can damage a region of the target surface: | 254 // There are two ways that a layer can damage a region of the target surface: |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 // 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 |
385 // used for the blur in this layer this frame. | 387 // used for the blur in this layer this frame. |
386 if (layer->background_filters().hasFilterThatMovesPixels()) { | 388 if (layer->background_filters().hasFilterThatMovesPixels()) { |
387 ExpandDamageRectInsideRectWithFilters(target_damage_rect, | 389 ExpandDamageRectInsideRectWithFilters(target_damage_rect, |
388 surface_rect_in_target_space, | 390 surface_rect_in_target_space, |
389 layer->background_filters()); | 391 layer->background_filters()); |
390 } | 392 } |
391 } | 393 } |
392 | 394 |
393 } // namespace cc | 395 } // namespace cc |
OLD | NEW |