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" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 DCHECK_GT(layer_id, 0); | 179 DCHECK_GT(layer_id, 0); |
180 DCHECK(next_rect_history_->find(layer_id) == next_rect_history_->end()); | 180 DCHECK(next_rect_history_->find(layer_id) == next_rect_history_->end()); |
181 (*next_rect_history_)[layer_id] = target_space_rect; | 181 (*next_rect_history_)[layer_id] = target_space_rect; |
182 } | 182 } |
183 | 183 |
184 gfx::RectF DamageTracker::TrackDamageFromActiveLayers( | 184 gfx::RectF DamageTracker::TrackDamageFromActiveLayers( |
185 const std::vector<LayerImpl*>& layer_list, | 185 const std::vector<LayerImpl*>& layer_list, |
186 int target_surface_layer_id) { | 186 int target_surface_layer_id) { |
187 gfx::RectF damage_rect = gfx::RectF(); | 187 gfx::RectF damage_rect = gfx::RectF(); |
188 | 188 |
189 for (unsigned layerIndex = 0; layerIndex < layer_list.size(); ++layerIndex) { | 189 for (size_t layer_index = 0; layer_index < layer_list.size(); ++layer_index) { |
190 // Visit layers in back-to-front order. | 190 // Visit layers in back-to-front order. |
191 LayerImpl* layer = layer_list[layerIndex]; | 191 LayerImpl* layer = layer_list[layer_index]; |
192 | 192 |
193 if (LayerTreeHostCommon::RenderSurfaceContributesToTarget<LayerImpl>( | 193 if (LayerTreeHostCommon::RenderSurfaceContributesToTarget<LayerImpl>( |
194 layer, target_surface_layer_id)) | 194 layer, target_surface_layer_id)) |
195 ExtendDamageForRenderSurface(layer, &damage_rect); | 195 ExtendDamageForRenderSurface(layer, &damage_rect); |
196 else | 196 else |
197 ExtendDamageForLayer(layer, &damage_rect); | 197 ExtendDamageForLayer(layer, &damage_rect); |
198 } | 198 } |
199 | 199 |
200 return damage_rect; | 200 return damage_rect; |
201 } | 201 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // is now exposed. | 256 // is now exposed. |
257 // - note that in many cases the old and new layer rects may overlap, | 257 // - note that in many cases the old and new layer rects may overlap, |
258 // which is fine. | 258 // which is fine. |
259 // | 259 // |
260 // 2. Repaint/update: If a region of the layer that was repainted/updated, | 260 // 2. Repaint/update: If a region of the layer that was repainted/updated, |
261 // that region damages the surface. | 261 // that region damages the surface. |
262 // | 262 // |
263 // Property changes take priority over update rects. | 263 // Property changes take priority over update rects. |
264 // | 264 // |
265 // This method is called when we want to consider how a layer contributes to | 265 // This method is called when we want to consider how a layer contributes to |
266 // its targetRenderSurface, even if that layer owns the targetRenderSurface | 266 // its target RenderSurface, even if that layer owns the target RenderSurface |
267 // itself. To consider how a layer's targetSurface contributes to the | 267 // itself. To consider how a layer's target surface contributes to the |
268 // ancestorSurface, ExtendDamageForRenderSurface() must be called instead. | 268 // ancestor surface, ExtendDamageForRenderSurface() must be called instead. |
269 | 269 |
270 bool layer_is_new = false; | 270 bool layer_is_new = false; |
271 gfx::RectF old_rect_in_target_space = | 271 gfx::RectF old_rect_in_target_space = |
272 RemoveRectFromCurrentFrame(layer->id(), &layer_is_new); | 272 RemoveRectFromCurrentFrame(layer->id(), &layer_is_new); |
273 | 273 |
274 gfx::RectF rect_in_target_space = MathUtil::MapClippedRect( | 274 gfx::RectF rect_in_target_space = MathUtil::MapClippedRect( |
275 layer->draw_transform(), | 275 layer->draw_transform(), |
276 gfx::RectF(gfx::PointF(), layer->content_bounds())); | 276 gfx::RectF(gfx::PointF(), layer->content_bounds())); |
277 SaveRectForNextFrame(layer->id(), rect_in_target_space); | 277 SaveRectForNextFrame(layer->id(), rect_in_target_space); |
278 | 278 |
(...skipping 105 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 | 384 // 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. | 385 // used for the blur in this layer this frame. |
386 if (layer->background_filters().hasFilterThatMovesPixels()) { | 386 if (layer->background_filters().hasFilterThatMovesPixels()) { |
387 ExpandDamageRectInsideRectWithFilters(target_damage_rect, | 387 ExpandDamageRectInsideRectWithFilters(target_damage_rect, |
388 surface_rect_in_target_space, | 388 surface_rect_in_target_space, |
389 layer->background_filters()); | 389 layer->background_filters()); |
390 } | 390 } |
391 } | 391 } |
392 | 392 |
393 } // namespace cc | 393 } // namespace cc |
OLD | NEW |