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

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

Issue 637913003: Revert of "Converted LayerImpl::bounds() to return SizeF." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/test/layer_tree_json_parser.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 <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"
11 #include "cc/layers/layer_impl.h" 11 #include "cc/layers/layer_impl.h"
12 #include "cc/layers/render_surface_impl.h" 12 #include "cc/layers/render_surface_impl.h"
13 #include "cc/output/filter_operations.h" 13 #include "cc/output/filter_operations.h"
14 #include "cc/trees/layer_tree_host_common.h" 14 #include "cc/trees/layer_tree_host_common.h"
15 #include "cc/trees/layer_tree_impl.h" 15 #include "cc/trees/layer_tree_impl.h"
16 #include "ui/gfx/geometry/rect_conversions.h" 16 #include "ui/gfx/geometry/rect_conversions.h"
17 #include "ui/gfx/geometry/size_conversions.h"
18 17
19 namespace cc { 18 namespace cc {
20 19
21 scoped_ptr<DamageTracker> DamageTracker::Create() { 20 scoped_ptr<DamageTracker> DamageTracker::Create() {
22 return make_scoped_ptr(new DamageTracker()); 21 return make_scoped_ptr(new DamageTracker());
23 } 22 }
24 23
25 DamageTracker::DamageTracker() 24 DamageTracker::DamageTracker()
26 : mailboxId_(0) {} 25 : mailboxId_(0) {}
27 26
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 gfx::Rect damage_rect; 202 gfx::Rect damage_rect;
204 203
205 if (!target_surface_mask_layer) 204 if (!target_surface_mask_layer)
206 return damage_rect; 205 return damage_rect;
207 206
208 // Currently, if there is any change to the mask, we choose to damage the 207 // Currently, if there is any change to the mask, we choose to damage the
209 // entire surface. This could potentially be optimized later, but it is not 208 // entire surface. This could potentially be optimized later, but it is not
210 // expected to be a common case. 209 // expected to be a common case.
211 if (target_surface_mask_layer->LayerPropertyChanged() || 210 if (target_surface_mask_layer->LayerPropertyChanged() ||
212 !target_surface_mask_layer->update_rect().IsEmpty()) { 211 !target_surface_mask_layer->update_rect().IsEmpty()) {
213 damage_rect = gfx::Rect( 212 damage_rect = gfx::Rect(target_surface_mask_layer->bounds());
214 gfx::ToCeiledSize(target_surface_mask_layer->bounds()));
215 } 213 }
216 214
217 return damage_rect; 215 return damage_rect;
218 } 216 }
219 217
220 void DamageTracker::PrepareRectHistoryForUpdate() { 218 void DamageTracker::PrepareRectHistoryForUpdate() {
221 mailboxId_++; 219 mailboxId_++;
222 } 220 }
223 221
224 gfx::Rect DamageTracker::TrackDamageFromLeftoverRects() { 222 gfx::Rect DamageTracker::TrackDamageFromLeftoverRects() {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) { 371 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) {
374 LayerImpl* replica_mask_layer = layer->replica_layer()->mask_layer(); 372 LayerImpl* replica_mask_layer = layer->replica_layer()->mask_layer();
375 373
376 bool replica_is_new = false; 374 bool replica_is_new = false;
377 RectMapData& data = 375 RectMapData& data =
378 RectDataForLayer(replica_mask_layer->id(), &replica_is_new); 376 RectDataForLayer(replica_mask_layer->id(), &replica_is_new);
379 377
380 const gfx::Transform& replica_draw_transform = 378 const gfx::Transform& replica_draw_transform =
381 render_surface->replica_draw_transform(); 379 render_surface->replica_draw_transform();
382 gfx::Rect replica_mask_layer_rect = MathUtil::MapEnclosingClippedRect( 380 gfx::Rect replica_mask_layer_rect = MathUtil::MapEnclosingClippedRect(
383 replica_draw_transform, 381 replica_draw_transform, gfx::Rect(replica_mask_layer->bounds()));
384 gfx::Rect(gfx::ToCeiledSize(replica_mask_layer->bounds())));
385 data.Update(replica_mask_layer_rect, mailboxId_); 382 data.Update(replica_mask_layer_rect, mailboxId_);
386 383
387 // In the current implementation, a change in the replica mask damages the 384 // In the current implementation, a change in the replica mask damages the
388 // entire replica region. 385 // entire replica region.
389 if (replica_is_new || 386 if (replica_is_new ||
390 replica_mask_layer->LayerPropertyChanged() || 387 replica_mask_layer->LayerPropertyChanged() ||
391 !replica_mask_layer->update_rect().IsEmpty()) 388 !replica_mask_layer->update_rect().IsEmpty())
392 target_damage_rect->Union(replica_mask_layer_rect); 389 target_damage_rect->Union(replica_mask_layer_rect);
393 } 390 }
394 391
395 // If the layer has a background filter, this may cause pixels in our surface 392 // If the layer has a background filter, this may cause pixels in our surface
396 // to be expanded, so we will need to expand any damage at or below this 393 // to be expanded, so we will need to expand any damage at or below this
397 // layer. We expand the damage from this layer too, as we need to readback 394 // layer. We expand the damage from this layer too, as we need to readback
398 // those pixels from the surface with only the contents of layers below this 395 // those pixels from the surface with only the contents of layers below this
399 // one in them. This means we need to redraw any pixels in the surface being 396 // one in them. This means we need to redraw any pixels in the surface being
400 // used for the blur in this layer this frame. 397 // used for the blur in this layer this frame.
401 if (layer->background_filters().HasFilterThatMovesPixels()) { 398 if (layer->background_filters().HasFilterThatMovesPixels()) {
402 ExpandDamageRectInsideRectWithFilters(target_damage_rect, 399 ExpandDamageRectInsideRectWithFilters(target_damage_rect,
403 surface_rect_in_target_space, 400 surface_rect_in_target_space,
404 layer->background_filters()); 401 layer->background_filters());
405 } 402 }
406 } 403 }
407 404
408 } // namespace cc 405 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_json_parser.cc ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698