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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 havent changed, then the the target surface i s 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->updateRect(); |
271 float widthScale = layer->contentBounds().width() / static_cast<float>(l ayer->bounds().width()); | 271 updateContentRect.scale(layer->contentsScaleX(), layer->contentsScaleY() ); |
danakj
2012/10/29 20:06:51
Can we use Layer::layerRectToContentRect() here? T
wangxianzhu
2012/10/30 02:14:21
Done. However, I'm wondering if enclosingIntRect()
danakj
2012/10/30 15:56:19
Right, but part of a pixel can't be invalid, so I
| |
272 float heightScale = layer->contentBounds().height() / static_cast<float> (layer->bounds().height()); | |
273 updateContentRect.scale(widthScale, heightScale); | |
274 | 272 |
275 FloatRect updateRectInTargetSpace = MathUtil::mapClippedRect(layer->draw Transform(), updateContentRect); | 273 FloatRect updateRectInTargetSpace = MathUtil::mapClippedRect(layer->draw Transform(), updateContentRect); |
276 targetDamageRect.uniteIfNonZero(updateRectInTargetSpace); | 274 targetDamageRect.uniteIfNonZero(updateRectInTargetSpace); |
277 } | 275 } |
278 } | 276 } |
279 | 277 |
280 void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& ta rgetDamageRect) | 278 void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& ta rgetDamageRect) |
281 { | 279 { |
282 // There are two ways a "descendant surface" can damage regions of the "targ et surface": | 280 // There are two ways a "descendant surface" can damage regions of the "targ et surface": |
283 // 1. Property change: | 281 // 1. Property change: |
(...skipping 58 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 | 340 // 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 | 341 // 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 | 342 // 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. | 343 // this layer this frame. |
346 if (layer->backgroundFilters().hasFilterThatMovesPixels()) | 344 if (layer->backgroundFilters().hasFilterThatMovesPixels()) |
347 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar getSpace, layer->backgroundFilters()); | 345 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar getSpace, layer->backgroundFilters()); |
348 } | 346 } |
349 | 347 |
350 } // namespace cc | 348 } // namespace cc |
351 | 349 |
OLD | NEW |