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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Property changes take priority over update rects. | 246 // Property changes take priority over update rects. |
247 // | 247 // |
248 // This method is called when we want to consider how a layer contributes to
its | 248 // This method is called when we want to consider how a layer contributes to
its |
249 // targetRenderSurface, even if that layer owns the targetRenderSurface itse
lf. | 249 // targetRenderSurface, even if that layer owns the targetRenderSurface itse
lf. |
250 // To consider how a layer's targetSurface contributes to the ancestorSurfac
e, | 250 // To consider how a layer's targetSurface contributes to the ancestorSurfac
e, |
251 // extendDamageForRenderSurface() must be called instead. | 251 // extendDamageForRenderSurface() must be called instead. |
252 | 252 |
253 bool layerIsNew = false; | 253 bool layerIsNew = false; |
254 gfx::RectF oldRectInTargetSpace = removeRectFromCurrentFrame(layer->id(), la
yerIsNew); | 254 gfx::RectF oldRectInTargetSpace = removeRectFromCurrentFrame(layer->id(), la
yerIsNew); |
255 | 255 |
256 gfx::RectF rectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform
(), gfx::RectF(FloatPoint(), layer->contentBounds())); | 256 gfx::RectF rectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform
(), gfx::RectF(gfx::PointF(), layer->contentBounds())); |
257 saveRectForNextFrame(layer->id(), rectInTargetSpace); | 257 saveRectForNextFrame(layer->id(), rectInTargetSpace); |
258 | 258 |
259 if (layerIsNew || layerNeedsToRedrawOntoItsTargetSurface(layer)) { | 259 if (layerIsNew || layerNeedsToRedrawOntoItsTargetSurface(layer)) { |
260 // If a layer is new or has changed, then its entire layer rect affects
the target surface. | 260 // If a layer is new or has changed, then its entire layer rect affects
the target surface. |
261 targetDamageRect.Union(rectInTargetSpace); | 261 targetDamageRect.Union(rectInTargetSpace); |
262 | 262 |
263 // The layer's old region is now exposed on the target surface, too. | 263 // The layer's old region is now exposed on the target surface, too. |
264 // Note oldRectInTargetSpace is already in target space. | 264 // Note oldRectInTargetSpace is already in target space. |
265 targetDamageRect.Union(oldRectInTargetSpace); | 265 targetDamageRect.Union(oldRectInTargetSpace); |
266 } else if (!layer->updateRect().IsEmpty()) { | 266 } else if (!layer->updateRect().IsEmpty()) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 } | 319 } |
320 | 320 |
321 // If there was damage on the replica's mask, then the target surface receiv
es that damage as well. | 321 // If there was damage on the replica's mask, then the target surface receiv
es that damage as well. |
322 if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) { | 322 if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) { |
323 LayerImpl* replicaMaskLayer = layer->replicaLayer()->maskLayer(); | 323 LayerImpl* replicaMaskLayer = layer->replicaLayer()->maskLayer(); |
324 | 324 |
325 bool replicaIsNew = false; | 325 bool replicaIsNew = false; |
326 removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew); | 326 removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew); |
327 | 327 |
328 const WebTransformationMatrix& replicaDrawTransform = renderSurface->rep
licaDrawTransform(); | 328 const WebTransformationMatrix& replicaDrawTransform = renderSurface->rep
licaDrawTransform(); |
329 gfx::RectF replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTr
ansform, gfx::RectF(FloatPoint(), FloatSize(replicaMaskLayer->bounds().width(),
replicaMaskLayer->bounds().height()))); | 329 gfx::RectF replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTr
ansform, gfx::RectF(gfx::PointF(), replicaMaskLayer->bounds())); |
330 saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect); | 330 saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect); |
331 | 331 |
332 // In the current implementation, a change in the replica mask damages t
he entire replica region. | 332 // In the current implementation, a change in the replica mask damages t
he entire replica region. |
333 if (replicaIsNew || replicaMaskLayer->layerPropertyChanged() || !replica
MaskLayer->updateRect().IsEmpty()) | 333 if (replicaIsNew || replicaMaskLayer->layerPropertyChanged() || !replica
MaskLayer->updateRect().IsEmpty()) |
334 targetDamageRect.Union(replicaMaskLayerRect); | 334 targetDamageRect.Union(replicaMaskLayerRect); |
335 } | 335 } |
336 | 336 |
337 // 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 | 337 // 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 // 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 | 338 // 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 // 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 | 339 // 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 // this layer this frame. | 340 // this layer this frame. |
341 if (layer->backgroundFilters().hasFilterThatMovesPixels()) | 341 if (layer->backgroundFilters().hasFilterThatMovesPixels()) |
342 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar
getSpace, layer->backgroundFilters()); | 342 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar
getSpace, layer->backgroundFilters()); |
343 } | 343 } |
344 | 344 |
345 } // namespace cc | 345 } // namespace cc |
346 | 346 |
OLD | NEW |