Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: cc/damage_tracker.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/animation_curve.h ('k') | cc/damage_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
14
15 namespace cc { 13 namespace cc {
16 14
17 scoped_ptr<DamageTracker> DamageTracker::create() 15 scoped_ptr<DamageTracker> DamageTracker::create()
18 { 16 {
19 return make_scoped_ptr(new DamageTracker()); 17 return make_scoped_ptr(new DamageTracker());
20 } 18 }
21 19
22 DamageTracker::DamageTracker() 20 DamageTracker::DamageTracker()
23 : m_forceFullDamageNextUpdate(false), 21 : m_forceFullDamageNextUpdate(false),
24 m_currentRectHistory(new RectMap), 22 m_currentRectHistory(new RectMap),
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 297
300 // The surface's old region is now exposed on the target surface, too. 298 // The surface's old region is now exposed on the target surface, too.
301 targetDamageRect.Union(oldSurfaceRect); 299 targetDamageRect.Union(oldSurfaceRect);
302 } else { 300 } else {
303 // Only the surface's damageRect will damage the target surface. 301 // Only the surface's damageRect will damage the target surface.
304 damageRectInLocalSpace = renderSurface->damageTracker()->currentDamageRe ct(); 302 damageRectInLocalSpace = renderSurface->damageTracker()->currentDamageRe ct();
305 } 303 }
306 304
307 // If there was damage, transform it to target space, and possibly contribut e its reflection if needed. 305 // If there was damage, transform it to target space, and possibly contribut e its reflection if needed.
308 if (!damageRectInLocalSpace.IsEmpty()) { 306 if (!damageRectInLocalSpace.IsEmpty()) {
309 const WebTransformationMatrix& drawTransform = renderSurface->drawTransf orm(); 307 const gfx::Transform& drawTransform = renderSurface->drawTransform();
310 gfx::RectF damageRectInTargetSpace = MathUtil::mapClippedRect(drawTransf orm, damageRectInLocalSpace); 308 gfx::RectF damageRectInTargetSpace = MathUtil::mapClippedRect(drawTransf orm, damageRectInLocalSpace);
311 targetDamageRect.Union(damageRectInTargetSpace); 309 targetDamageRect.Union(damageRectInTargetSpace);
312 310
313 if (layer->replicaLayer()) { 311 if (layer->replicaLayer()) {
314 const WebTransformationMatrix& replicaDrawTransform = renderSurface- >replicaDrawTransform(); 312 const gfx::Transform& replicaDrawTransform = renderSurface->replicaD rawTransform();
315 targetDamageRect.Union(MathUtil::mapClippedRect(replicaDrawTransform , damageRectInLocalSpace)); 313 targetDamageRect.Union(MathUtil::mapClippedRect(replicaDrawTransform , damageRectInLocalSpace));
316 } 314 }
317 } 315 }
318 316
319 // If there was damage on the replica's mask, then the target surface receiv es that damage as well. 317 // 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()) { 318 if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) {
321 LayerImpl* replicaMaskLayer = layer->replicaLayer()->maskLayer(); 319 LayerImpl* replicaMaskLayer = layer->replicaLayer()->maskLayer();
322 320
323 bool replicaIsNew = false; 321 bool replicaIsNew = false;
324 removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew); 322 removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew);
325 323
326 const WebTransformationMatrix& replicaDrawTransform = renderSurface->rep licaDrawTransform(); 324 const gfx::Transform& replicaDrawTransform = renderSurface->replicaDrawT ransform();
327 gfx::RectF replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTr ansform, gfx::RectF(gfx::PointF(), replicaMaskLayer->bounds())); 325 gfx::RectF replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTr ansform, gfx::RectF(gfx::PointF(), replicaMaskLayer->bounds()));
328 saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect); 326 saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect);
329 327
330 // In the current implementation, a change in the replica mask damages t he entire replica region. 328 // 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()) 329 if (replicaIsNew || replicaMaskLayer->layerPropertyChanged() || !replica MaskLayer->updateRect().IsEmpty())
332 targetDamageRect.Union(replicaMaskLayerRect); 330 targetDamageRect.Union(replicaMaskLayerRect);
333 } 331 }
334 332
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 333 // 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 334 // 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 335 // 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. 336 // this layer this frame.
339 if (layer->backgroundFilters().hasFilterThatMovesPixels()) 337 if (layer->backgroundFilters().hasFilterThatMovesPixels())
340 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar getSpace, layer->backgroundFilters()); 338 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar getSpace, layer->backgroundFilters());
341 } 339 }
342 340
343 } // namespace cc 341 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation_curve.h ('k') | cc/damage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698