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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/damage_tracker.h" | 7 #include "cc/damage_tracker.h" |
8 | 8 |
9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
10 #include "cc/layer_tree_host_common.h" | 10 #include "cc/layer_tree_host_common.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 saveRectForNextFrame(layer->id(), rectInTargetSpace); | 258 saveRectForNextFrame(layer->id(), rectInTargetSpace); |
259 | 259 |
260 if (layerIsNew || layerNeedsToRedrawOntoItsTargetSurface(layer)) { | 260 if (layerIsNew || layerNeedsToRedrawOntoItsTargetSurface(layer)) { |
261 // If a layer is new or has changed, then its entire layer rect affects
the target surface. | 261 // If a layer is new or has changed, then its entire layer rect affects
the target surface. |
262 targetDamageRect.uniteIfNonZero(rectInTargetSpace); | 262 targetDamageRect.uniteIfNonZero(rectInTargetSpace); |
263 | 263 |
264 // The layer's old region is now exposed on the target surface, too. | 264 // The layer's old region is now exposed on the target surface, too. |
265 // Note oldRectInTargetSpace is already in target space. | 265 // Note oldRectInTargetSpace is already in target space. |
266 targetDamageRect.uniteIfNonZero(oldRectInTargetSpace); | 266 targetDamageRect.uniteIfNonZero(oldRectInTargetSpace); |
267 } else if (!layer->updateRect().isEmpty()) { | 267 } else if (!layer->updateRect().isEmpty()) { |
268 // If the layer properties havent changed, then the the target surface i
s only | 268 // If the layer properties haven't changed, then the the target surface
is only |
269 // affected by the layer's update area, which could be empty. | 269 // affected by the layer's update area, which could be empty. |
270 FloatRect updateContentRect = layer->updateRect(); | 270 FloatRect updateContentRect = layer->layerRectToContentRect(layer->updat
eRect()); |
271 float widthScale = layer->contentBounds().width() / static_cast<float>(l
ayer->bounds().width()); | |
272 float heightScale = layer->contentBounds().height() / static_cast<float>
(layer->bounds().height()); | |
273 updateContentRect.scale(widthScale, heightScale); | |
274 | |
275 FloatRect updateRectInTargetSpace = MathUtil::mapClippedRect(layer->draw
Transform(), updateContentRect); | 271 FloatRect updateRectInTargetSpace = MathUtil::mapClippedRect(layer->draw
Transform(), updateContentRect); |
276 targetDamageRect.uniteIfNonZero(updateRectInTargetSpace); | 272 targetDamageRect.uniteIfNonZero(updateRectInTargetSpace); |
277 } | 273 } |
278 } | 274 } |
279 | 275 |
280 void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& ta
rgetDamageRect) | 276 void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& ta
rgetDamageRect) |
281 { | 277 { |
282 // There are two ways a "descendant surface" can damage regions of the "targ
et surface": | 278 // There are two ways a "descendant surface" can damage regions of the "targ
et surface": |
283 // 1. Property change: | 279 // 1. Property change: |
284 // - a surface's geometry can change because of | 280 // - a surface's geometry can change because of |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 // If the layer has a background filter, this may cause pixels in our surfac
e to be expanded, so we will need to expand any damage | 338 // If the layer has a background filter, this may cause pixels in our surfac
e to be expanded, so we will need to expand any damage |
343 // at or below this layer. We expand the damage from this layer too, as we n
eed to readback those pixels from the surface with only | 339 // at or below this layer. We expand the damage from this layer too, as we n
eed to readback those pixels from the surface with only |
344 // the contents of layers below this one in them. This means we need to redr
aw any pixels in the surface being used for the blur in | 340 // the contents of layers below this one in them. This means we need to redr
aw any pixels in the surface being used for the blur in |
345 // this layer this frame. | 341 // this layer this frame. |
346 if (layer->backgroundFilters().hasFilterThatMovesPixels()) | 342 if (layer->backgroundFilters().hasFilterThatMovesPixels()) |
347 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar
getSpace, layer->backgroundFilters()); | 343 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar
getSpace, layer->backgroundFilters()); |
348 } | 344 } |
349 | 345 |
350 } // namespace cc | 346 } // namespace cc |
351 | 347 |
OLD | NEW |