Chromium Code Reviews| 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/damage_tracker.h" | 5 #include "cc/damage_tracker.h" |
| 6 | 6 |
| 7 #include "cc/layer_impl.h" | 7 #include "cc/layer_impl.h" |
| 8 #include "cc/layer_tree_host_common.h" | 8 #include "cc/layer_tree_host_common.h" |
| 9 #include "cc/math_util.h" | 9 #include "cc/math_util.h" |
| 10 #include "cc/render_surface_impl.h" | 10 #include "cc/render_surface_impl.h" |
| 11 #include <public/WebFilterOperations.h> | 11 #include <public/WebFilterOperations.h> |
| 12 | 12 |
| 13 using WebKit::WebTransformationMatrix; | 13 using gfx::Transform; |
|
danakj
2012/11/24 02:34:54
don't using it, let's say gfx:: explicitly at each
| |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 scoped_ptr<DamageTracker> DamageTracker::create() | 17 scoped_ptr<DamageTracker> DamageTracker::create() |
| 18 { | 18 { |
| 19 return make_scoped_ptr(new DamageTracker()); | 19 return make_scoped_ptr(new DamageTracker()); |
| 20 } | 20 } |
| 21 | 21 |
| 22 DamageTracker::DamageTracker() | 22 DamageTracker::DamageTracker() |
| 23 : m_forceFullDamageNextUpdate(false), | 23 : m_forceFullDamageNextUpdate(false), |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 | 299 |
| 300 // The surface's old region is now exposed on the target surface, too. | 300 // The surface's old region is now exposed on the target surface, too. |
| 301 targetDamageRect.Union(oldSurfaceRect); | 301 targetDamageRect.Union(oldSurfaceRect); |
| 302 } else { | 302 } else { |
| 303 // Only the surface's damageRect will damage the target surface. | 303 // Only the surface's damageRect will damage the target surface. |
| 304 damageRectInLocalSpace = renderSurface->damageTracker()->currentDamageRe ct(); | 304 damageRectInLocalSpace = renderSurface->damageTracker()->currentDamageRe ct(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 // If there was damage, transform it to target space, and possibly contribut e its reflection if needed. | 307 // If there was damage, transform it to target space, and possibly contribut e its reflection if needed. |
| 308 if (!damageRectInLocalSpace.IsEmpty()) { | 308 if (!damageRectInLocalSpace.IsEmpty()) { |
| 309 const WebTransformationMatrix& drawTransform = renderSurface->drawTransf orm(); | 309 const Transform& drawTransform = renderSurface->drawTransform(); |
| 310 gfx::RectF damageRectInTargetSpace = MathUtil::mapClippedRect(drawTransf orm, damageRectInLocalSpace); | 310 gfx::RectF damageRectInTargetSpace = MathUtil::mapClippedRect(drawTransf orm, damageRectInLocalSpace); |
| 311 targetDamageRect.Union(damageRectInTargetSpace); | 311 targetDamageRect.Union(damageRectInTargetSpace); |
| 312 | 312 |
| 313 if (layer->replicaLayer()) { | 313 if (layer->replicaLayer()) { |
| 314 const WebTransformationMatrix& replicaDrawTransform = renderSurface- >replicaDrawTransform(); | 314 const Transform& replicaDrawTransform = renderSurface->replicaDrawTr ansform(); |
| 315 targetDamageRect.Union(MathUtil::mapClippedRect(replicaDrawTransform , damageRectInLocalSpace)); | 315 targetDamageRect.Union(MathUtil::mapClippedRect(replicaDrawTransform , damageRectInLocalSpace)); |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 | 318 |
| 319 // If there was damage on the replica's mask, then the target surface receiv es that damage as well. | 319 // If there was damage on the replica's mask, then the target surface receiv es that damage as well. |
| 320 if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) { | 320 if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) { |
| 321 LayerImpl* replicaMaskLayer = layer->replicaLayer()->maskLayer(); | 321 LayerImpl* replicaMaskLayer = layer->replicaLayer()->maskLayer(); |
| 322 | 322 |
| 323 bool replicaIsNew = false; | 323 bool replicaIsNew = false; |
| 324 removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew); | 324 removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew); |
| 325 | 325 |
| 326 const WebTransformationMatrix& replicaDrawTransform = renderSurface->rep licaDrawTransform(); | 326 const Transform& replicaDrawTransform = renderSurface->replicaDrawTransf orm(); |
| 327 gfx::RectF replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTr ansform, gfx::RectF(gfx::PointF(), replicaMaskLayer->bounds())); | 327 gfx::RectF replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTr ansform, gfx::RectF(gfx::PointF(), replicaMaskLayer->bounds())); |
| 328 saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect); | 328 saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect); |
| 329 | 329 |
| 330 // In the current implementation, a change in the replica mask damages t he entire replica region. | 330 // In the current implementation, a change in the replica mask damages t he entire replica region. |
| 331 if (replicaIsNew || replicaMaskLayer->layerPropertyChanged() || !replica MaskLayer->updateRect().IsEmpty()) | 331 if (replicaIsNew || replicaMaskLayer->layerPropertyChanged() || !replica MaskLayer->updateRect().IsEmpty()) |
| 332 targetDamageRect.Union(replicaMaskLayerRect); | 332 targetDamageRect.Union(replicaMaskLayerRect); |
| 333 } | 333 } |
| 334 | 334 |
| 335 // 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 | 335 // 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 |
| 336 // 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 | 336 // 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 |
| 337 // 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 | 337 // 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 |
| 338 // this layer this frame. | 338 // this layer this frame. |
| 339 if (layer->backgroundFilters().hasFilterThatMovesPixels()) | 339 if (layer->backgroundFilters().hasFilterThatMovesPixels()) |
| 340 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar getSpace, layer->backgroundFilters()); | 340 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar getSpace, layer->backgroundFilters()); |
| 341 } | 341 } |
| 342 | 342 |
| 343 } // namespace cc | 343 } // namespace cc |
| OLD | NEW |