| 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 "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
| 8 #include "cc/layers/layer_impl.h" | 8 #include "cc/layers/layer_impl.h" |
| 9 #include "cc/layers/render_surface_impl.h" | 9 #include "cc/layers/render_surface_impl.h" |
| 10 #include "cc/trees/layer_tree_host_common.h" | 10 #include "cc/trees/layer_tree_host_common.h" |
| 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 scoped_ptr<DamageTracker> DamageTracker::Create() { | 15 scoped_ptr<DamageTracker> DamageTracker::Create() { |
| 16 return make_scoped_ptr(new DamageTracker()); | 16 return make_scoped_ptr(new DamageTracker()); |
| 17 } | 17 } |
| 18 | 18 |
| 19 DamageTracker::DamageTracker() | 19 DamageTracker::DamageTracker() |
| 20 : current_rect_history_(new RectMap), | 20 : current_rect_history_(new RectMap), |
| 21 next_rect_history_(new RectMap), | 21 next_rect_history_(new RectMap) {} |
| 22 force_full_damage_next_update_(false) {} | |
| 23 | 22 |
| 24 DamageTracker::~DamageTracker() {} | 23 DamageTracker::~DamageTracker() {} |
| 25 | 24 |
| 26 static inline void ExpandRectWithFilters( | 25 static inline void ExpandRectWithFilters( |
| 27 gfx::RectF* rect, const WebKit::WebFilterOperations& filters) { | 26 gfx::RectF* rect, const WebKit::WebFilterOperations& filters) { |
| 28 int top, right, bottom, left; | 27 int top, right, bottom, left; |
| 29 filters.getOutsets(top, right, bottom, left); | 28 filters.getOutsets(top, right, bottom, left); |
| 30 rect->Inset(-left, -top, -right, -bottom); | 29 rect->Inset(-left, -top, -right, -bottom); |
| 31 } | 30 } |
| 32 | 31 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // the damage will be for this frame, because we need to update the damage | 123 // the damage will be for this frame, because we need to update the damage |
| 125 // tracker state to correctly track the next frame. | 124 // tracker state to correctly track the next frame. |
| 126 gfx::RectF damage_from_active_layers = | 125 gfx::RectF damage_from_active_layers = |
| 127 TrackDamageFromActiveLayers(layer_list, target_surface_layer_id); | 126 TrackDamageFromActiveLayers(layer_list, target_surface_layer_id); |
| 128 gfx::RectF damage_from_surface_mask = | 127 gfx::RectF damage_from_surface_mask = |
| 129 TrackDamageFromSurfaceMask(target_surface_mask_layer); | 128 TrackDamageFromSurfaceMask(target_surface_mask_layer); |
| 130 gfx::RectF damage_from_leftover_rects = TrackDamageFromLeftoverRects(); | 129 gfx::RectF damage_from_leftover_rects = TrackDamageFromLeftoverRects(); |
| 131 | 130 |
| 132 gfx::RectF damage_rect_for_this_update; | 131 gfx::RectF damage_rect_for_this_update; |
| 133 | 132 |
| 134 if (force_full_damage_next_update_ || | 133 if (target_surface_property_changed_only_from_descendant) { |
| 135 target_surface_property_changed_only_from_descendant) { | |
| 136 damage_rect_for_this_update = target_surface_content_rect; | 134 damage_rect_for_this_update = target_surface_content_rect; |
| 137 force_full_damage_next_update_ = false; | |
| 138 } else { | 135 } else { |
| 139 // TODO(shawnsingh): can we clamp this damage to the surface's content rect? | 136 // TODO(shawnsingh): can we clamp this damage to the surface's content rect? |
| 140 // (affects performance, but not correctness) | 137 // (affects performance, but not correctness) |
| 141 damage_rect_for_this_update = damage_from_active_layers; | 138 damage_rect_for_this_update = damage_from_active_layers; |
| 142 damage_rect_for_this_update.Union(damage_from_surface_mask); | 139 damage_rect_for_this_update.Union(damage_from_surface_mask); |
| 143 damage_rect_for_this_update.Union(damage_from_leftover_rects); | 140 damage_rect_for_this_update.Union(damage_from_leftover_rects); |
| 144 | 141 |
| 145 if (filters.hasFilterThatMovesPixels()) { | 142 if (filters.hasFilterThatMovesPixels()) { |
| 146 ExpandRectWithFilters(&damage_rect_for_this_update, filters); | 143 ExpandRectWithFilters(&damage_rect_for_this_update, filters); |
| 147 } else if (filter) { | 144 } else if (filter) { |
| (...skipping 236 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 | 381 // 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. | 382 // used for the blur in this layer this frame. |
| 386 if (layer->background_filters().hasFilterThatMovesPixels()) { | 383 if (layer->background_filters().hasFilterThatMovesPixels()) { |
| 387 ExpandDamageRectInsideRectWithFilters(target_damage_rect, | 384 ExpandDamageRectInsideRectWithFilters(target_damage_rect, |
| 388 surface_rect_in_target_space, | 385 surface_rect_in_target_space, |
| 389 layer->background_filters()); | 386 layer->background_filters()); |
| 390 } | 387 } |
| 391 } | 388 } |
| 392 | 389 |
| 393 } // namespace cc | 390 } // namespace cc |
| OLD | NEW |