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/heads_up_display_layer_impl.h" | 10 #include "cc/layers/heads_up_display_layer_impl.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 | 282 |
283 bool layer_is_new = false; | 283 bool layer_is_new = false; |
284 RectMapData& data = RectDataForLayer(layer->id(), &layer_is_new); | 284 RectMapData& data = RectDataForLayer(layer->id(), &layer_is_new); |
285 gfx::RectF old_rect_in_target_space = data.rect_; | 285 gfx::RectF old_rect_in_target_space = data.rect_; |
286 | 286 |
287 gfx::RectF rect_in_target_space = MathUtil::MapClippedRect( | 287 gfx::RectF rect_in_target_space = MathUtil::MapClippedRect( |
288 layer->draw_transform(), | 288 layer->draw_transform(), |
289 gfx::RectF(gfx::PointF(), layer->content_bounds())); | 289 gfx::RectF(gfx::PointF(), layer->content_bounds())); |
290 data.Update(rect_in_target_space, mailboxId_); | 290 data.Update(rect_in_target_space, mailboxId_); |
291 | 291 |
292 // Union layer's update_rect with damage_rect | |
293 if (!layer->damage_rect().IsEmpty()) { | |
294 gfx::RectF rect = layer->update_rect(); | |
295 gfx::RectF layer_rect = gfx::ScaleRect(layer->damage_rect(), | |
296 1 / layer->contents_scale_x(), | |
297 1 / layer->contents_scale_y()); | |
298 layer->SetUpdateRect(gfx::UnionRects(rect, layer_rect)); | |
danakj
2014/04/14 17:17:07
instead of setting the UpdateRect on the layer, ju
sohanjg
2014/04/15 10:03:48
Done.
| |
299 layer->ResetDamageRect(); | |
danakj
2014/04/14 17:17:07
Instead of clearing the damage rect here, you can
sohanjg
2014/04/15 10:03:48
Done.
| |
300 } | |
301 | |
292 if (layer_is_new || layer->LayerPropertyChanged()) { | 302 if (layer_is_new || layer->LayerPropertyChanged()) { |
293 // If a layer is new or has changed, then its entire layer rect affects the | 303 // If a layer is new or has changed, then its entire layer rect affects the |
294 // target surface. | 304 // target surface. |
295 target_damage_rect->Union(rect_in_target_space); | 305 target_damage_rect->Union(rect_in_target_space); |
296 | 306 |
297 // The layer's old region is now exposed on the target surface, too. | 307 // The layer's old region is now exposed on the target surface, too. |
298 // Note old_rect_in_target_space is already in target space. | 308 // Note old_rect_in_target_space is already in target space. |
299 target_damage_rect->Union(old_rect_in_target_space); | 309 target_damage_rect->Union(old_rect_in_target_space); |
300 } else if (!layer->update_rect().IsEmpty()) { | 310 } else if (!layer->update_rect().IsEmpty()) { |
301 // If the layer properties haven't changed, then the the target surface is | 311 // If the layer properties haven't changed, then the the target surface is |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 // one in them. This means we need to redraw any pixels in the surface being | 406 // one in them. This means we need to redraw any pixels in the surface being |
397 // used for the blur in this layer this frame. | 407 // used for the blur in this layer this frame. |
398 if (layer->background_filters().HasFilterThatMovesPixels()) { | 408 if (layer->background_filters().HasFilterThatMovesPixels()) { |
399 ExpandDamageRectInsideRectWithFilters(target_damage_rect, | 409 ExpandDamageRectInsideRectWithFilters(target_damage_rect, |
400 surface_rect_in_target_space, | 410 surface_rect_in_target_space, |
401 layer->background_filters()); | 411 layer->background_filters()); |
402 } | 412 } |
403 } | 413 } |
404 | 414 |
405 } // namespace cc | 415 } // namespace cc |
OLD | NEW |