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

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

Issue 219963005: cc: Add support for partial swaps when using impl-side painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WIP - comments + nits Created 6 years, 8 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
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/layers/heads_up_display_layer_impl.h" 10 #include "cc/layers/heads_up_display_layer_impl.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // ancestor surface, ExtendDamageForRenderSurface() must be called instead. 280 // ancestor surface, ExtendDamageForRenderSurface() must be called instead.
281 281
282 bool layer_is_new = false; 282 bool layer_is_new = false;
283 RectMapData& data = RectDataForLayer(layer->id(), &layer_is_new); 283 RectMapData& data = RectDataForLayer(layer->id(), &layer_is_new);
284 gfx::Rect old_rect_in_target_space = data.rect_; 284 gfx::Rect old_rect_in_target_space = data.rect_;
285 285
286 gfx::Rect rect_in_target_space = MathUtil::MapEnclosingClippedRect( 286 gfx::Rect rect_in_target_space = MathUtil::MapEnclosingClippedRect(
287 layer->draw_transform(), gfx::Rect(layer->content_bounds())); 287 layer->draw_transform(), gfx::Rect(layer->content_bounds()));
288 data.Update(rect_in_target_space, mailboxId_); 288 data.Update(rect_in_target_space, mailboxId_);
289 289
290 // Union layer's update_rect with damage_rect
reveman 2014/04/15 16:25:59 nit: missing period at the end of the line.
291 gfx::RectF unified_update_and_damage_rect =
reveman 2014/04/15 16:25:59 The comment and variable names below are no longer
292 gfx::UnionRects(layer->update_rect(), layer->damage_content_rect());
293
290 if (layer_is_new || layer->LayerPropertyChanged()) { 294 if (layer_is_new || layer->LayerPropertyChanged()) {
291 // If a layer is new or has changed, then its entire layer rect affects the 295 // If a layer is new or has changed, then its entire layer rect affects the
292 // target surface. 296 // target surface.
293 target_damage_rect->Union(rect_in_target_space); 297 target_damage_rect->Union(rect_in_target_space);
294 298
295 // The layer's old region is now exposed on the target surface, too. 299 // The layer's old region is now exposed on the target surface, too.
296 // Note old_rect_in_target_space is already in target space. 300 // Note old_rect_in_target_space is already in target space.
297 target_damage_rect->Union(old_rect_in_target_space); 301 target_damage_rect->Union(old_rect_in_target_space);
298 } else if (!layer->update_rect().IsEmpty()) { 302 } else if (!unified_update_and_damage_rect.IsEmpty()) {
299 // If the layer properties haven't changed, then the the target surface is 303 // If the layer properties haven't changed, then the the target surface is
300 // only affected by the layer's update area, which could be empty. 304 // only affected by the layer's update area, which could be empty.
301 gfx::Rect update_content_rect = 305 gfx::Rect update_content_rect =
302 layer->LayerRectToContentRect(layer->update_rect()); 306 layer->LayerRectToContentRect(unified_update_and_damage_rect);
303 gfx::Rect update_rect_in_target_space = MathUtil::MapEnclosingClippedRect( 307 gfx::Rect update_rect_in_target_space = MathUtil::MapEnclosingClippedRect(
304 layer->draw_transform(), update_content_rect); 308 layer->draw_transform(), update_content_rect);
305 target_damage_rect->Union(update_rect_in_target_space); 309 target_damage_rect->Union(update_rect_in_target_space);
306 } 310 }
307 } 311 }
308 312
309 void DamageTracker::ExtendDamageForRenderSurface( 313 void DamageTracker::ExtendDamageForRenderSurface(
310 LayerImpl* layer, 314 LayerImpl* layer,
311 gfx::Rect* target_damage_rect) { 315 gfx::Rect* target_damage_rect) {
312 // There are two ways a "descendant surface" can damage regions of the "target 316 // There are two ways a "descendant surface" can damage regions of the "target
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // one in them. This means we need to redraw any pixels in the surface being 398 // 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. 399 // used for the blur in this layer this frame.
396 if (layer->background_filters().HasFilterThatMovesPixels()) { 400 if (layer->background_filters().HasFilterThatMovesPixels()) {
397 ExpandDamageRectInsideRectWithFilters(target_damage_rect, 401 ExpandDamageRectInsideRectWithFilters(target_damage_rect,
398 surface_rect_in_target_space, 402 surface_rect_in_target_space,
399 layer->background_filters()); 403 layer->background_filters());
400 } 404 }
401 } 405 }
402 406
403 } // namespace cc 407 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698