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

Side by Side Diff: cc/trees/damage_tracker.cc

Issue 1935613002: cc: Move filter outset in content rect calculation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@visiblerectcleanup
Patch Set: rebase Created 4 years, 7 months 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
« no previous file with comments | « cc/layers/render_surface_impl.cc ('k') | cc/trees/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/trees/damage_tracker.h" 5 #include "cc/trees/damage_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 328
329 bool surface_is_new = false; 329 bool surface_is_new = false;
330 RectMapData& data = RectDataForLayer(layer->id(), &surface_is_new); 330 RectMapData& data = RectDataForLayer(layer->id(), &surface_is_new);
331 gfx::Rect old_surface_rect = data.rect_; 331 gfx::Rect old_surface_rect = data.rect_;
332 332
333 // The drawableContextRect() already includes the replica if it exists. 333 // The drawableContextRect() already includes the replica if it exists.
334 gfx::Rect surface_rect_in_target_space = 334 gfx::Rect surface_rect_in_target_space =
335 gfx::ToEnclosingRect(render_surface->DrawableContentRect()); 335 gfx::ToEnclosingRect(render_surface->DrawableContentRect());
336 data.Update(surface_rect_in_target_space, mailboxId_); 336 data.Update(surface_rect_in_target_space, mailboxId_);
337 337
338 gfx::Rect damage_rect_in_local_space;
339 if (surface_is_new || render_surface->SurfacePropertyChanged()) { 338 if (surface_is_new || render_surface->SurfacePropertyChanged()) {
340 // The entire surface contributes damage. 339 // The entire surface contributes damage.
341 damage_rect_in_local_space = render_surface->content_rect(); 340 target_damage_rect->Union(surface_rect_in_target_space);
342 341
343 // The surface's old region is now exposed on the target surface, too. 342 // The surface's old region is now exposed on the target surface, too.
344 target_damage_rect->Union(old_surface_rect); 343 target_damage_rect->Union(old_surface_rect);
345 } else { 344 } else {
346 // Only the surface's damage_rect will damage the target surface. 345 // Only the surface's damage_rect will damage the target surface.
347 damage_rect_in_local_space = 346 gfx::Rect damage_rect_in_local_space =
348 render_surface->damage_tracker()->current_damage_rect(); 347 render_surface->damage_tracker()->current_damage_rect();
349 }
350 348
351 // If there was damage, transform it to target space, and possibly contribute 349 // If there was damage, transform it to target space, and possibly
352 // its reflection if needed. 350 // contribute its reflection if needed.
353 if (!damage_rect_in_local_space.IsEmpty()) { 351 if (!damage_rect_in_local_space.IsEmpty()) {
354 const gfx::Transform& draw_transform = render_surface->draw_transform(); 352 const gfx::Transform& draw_transform = render_surface->draw_transform();
355 gfx::Rect damage_rect_in_target_space = MathUtil::MapEnclosingClippedRect( 353 gfx::Rect damage_rect_in_target_space = MathUtil::MapEnclosingClippedRect(
356 draw_transform, damage_rect_in_local_space); 354 draw_transform, damage_rect_in_local_space);
357 target_damage_rect->Union(damage_rect_in_target_space); 355 target_damage_rect->Union(damage_rect_in_target_space);
358 356
359 if (layer->replica_layer()) { 357 if (layer->replica_layer()) {
360 const gfx::Transform& replica_draw_transform = 358 const gfx::Transform& replica_draw_transform =
361 render_surface->replica_draw_transform(); 359 render_surface->replica_draw_transform();
362 target_damage_rect->Union(MathUtil::MapEnclosingClippedRect( 360 target_damage_rect->Union(MathUtil::MapEnclosingClippedRect(
363 replica_draw_transform, damage_rect_in_local_space)); 361 replica_draw_transform, damage_rect_in_local_space));
362 }
364 } 363 }
365 } 364 }
366 365
367 // If there was damage on the replica's mask, then the target surface receives 366 // If there was damage on the replica's mask, then the target surface receives
368 // that damage as well. 367 // that damage as well.
369 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) { 368 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) {
370 LayerImpl* replica_mask_layer = layer->replica_layer()->mask_layer(); 369 LayerImpl* replica_mask_layer = layer->replica_layer()->mask_layer();
371 370
372 bool replica_is_new = false; 371 bool replica_is_new = false;
373 RectMapData& data = 372 RectMapData& data =
(...skipping 20 matching lines...) Expand all
394 // one in them. This means we need to redraw any pixels in the surface being 393 // one in them. This means we need to redraw any pixels in the surface being
395 // used for the blur in this layer this frame. 394 // used for the blur in this layer this frame.
396 if (layer->background_filters().HasFilterThatMovesPixels()) { 395 if (layer->background_filters().HasFilterThatMovesPixels()) {
397 ExpandDamageRectInsideRectWithFilters(target_damage_rect, 396 ExpandDamageRectInsideRectWithFilters(target_damage_rect,
398 surface_rect_in_target_space, 397 surface_rect_in_target_space,
399 layer->background_filters()); 398 layer->background_filters());
400 } 399 }
401 } 400 }
402 401
403 } // namespace cc 402 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/render_surface_impl.cc ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698