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

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

Issue 12259027: cc: Simplify the logic for deciding to update tile priorities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sper simple x2 Created 7 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 | Annotate | Revision Log
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/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // If the opacity is being animated then the opacity on the main thread is 245 // If the opacity is being animated then the opacity on the main thread is
246 // unreliable (since the impl thread may be using a different opacity), so it 246 // unreliable (since the impl thread may be using a different opacity), so it
247 // should not be trusted. 247 // should not be trusted.
248 // In particular, it should not cause the subtree to be skipped. 248 // In particular, it should not cause the subtree to be skipped.
249 // Similarly, for layers that might animate opacity using an impl-only 249 // Similarly, for layers that might animate opacity using an impl-only
250 // animation, their subtree should also not be skipped. 250 // animation, their subtree should also not be skipped.
251 return !layer->opacity() && !layer->OpacityIsAnimating() && 251 return !layer->opacity() && !layer->OpacityIsAnimating() &&
252 !layer->OpacityCanAnimateOnImplThread(); 252 !layer->OpacityCanAnimateOnImplThread();
253 } 253 }
254 254
255 static inline bool NeedsFirstTimeUpdateTilePrioritiesForLayer(
256 LayerImpl* layer) {
257 return layer->NeedsFirstTimeUpdateTilePriorities();
258 }
259
260 static inline bool NeedsFirstTimeUpdateTilePrioritiesForLayer(Layer* layer) {
261 return false;
262 }
263
255 // Called on each layer that could be drawn after all information from 264 // Called on each layer that could be drawn after all information from
256 // CalcDrawProperties has been updated on that layer. May have some false 265 // CalcDrawProperties has been updated on that layer. May have some false
257 // positives (e.g. layers get this called on them but don't actually get drawn). 266 // positives (e.g. layers get this called on them but don't actually get drawn).
258 static inline void UpdateTilePrioritiesForLayer(LayerImpl* layer) { 267 static inline void UpdateTilePrioritiesForLayer(LayerImpl* layer) {
259 layer->UpdateTilePriorities(); 268 layer->UpdateTilePriorities();
260 269
261 // Mask layers don't get this call, so explicitly update them so they can 270 // Mask layers don't get this call, so explicitly update them so they can
262 // kick off tile rasterization. 271 // kick off tile rasterization.
263 if (layer->mask_layer()) 272 if (layer->mask_layer())
264 layer->mask_layer()->UpdateTilePriorities(); 273 layer->mask_layer()->UpdateTilePriorities();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // Note: Again, Concat is used to conver the result coordinate space from 414 // Note: Again, Concat is used to conver the result coordinate space from
406 // the container render surface to the container layer. 415 // the container render surface to the container layer.
407 target_surface_space_to_container_layer_space.ConcatTransform( 416 target_surface_space_to_container_layer_space.ConcatTransform(
408 container_target_surface_space_to_container_layer_space); 417 container_target_surface_space_to_container_layer_space);
409 } 418 }
410 } 419 }
411 420
412 // Apply step 3 421 // Apply step 3
413 gfx::Transform container_layer_space_to_target_surface_space; 422 gfx::Transform container_layer_space_to_target_surface_space;
414 if (target_surface_space_to_container_layer_space.GetInverse( 423 if (target_surface_space_to_container_layer_space.GetInverse(
415 &container_layer_space_to_target_surface_space)) 424 &container_layer_space_to_target_surface_space)) {
416 result_transform.PreconcatTransform( 425 result_transform.PreconcatTransform(
417 container_layer_space_to_target_surface_space); 426 container_layer_space_to_target_surface_space);
418 else { 427 } else {
419 // FIXME: A non-invertible matrix could still make meaningful projection. 428 // FIXME: A non-invertible matrix could still make meaningful projection.
420 // For example ScaleZ(0) is non-invertible but the layer is still visible. 429 // For example ScaleZ(0) is non-invertible but the layer is still visible.
421 return gfx::Transform(); 430 return gfx::Transform();
422 } 431 }
423 432
424 // Apply step 2 433 // Apply step 2
425 result_transform.Translate(position_offset.x(), position_offset.y()); 434 result_transform.Translate(position_offset.x(), position_offset.y());
426 435
427 // Apply step 1 436 // Apply step 1
428 result_transform.PreconcatTransform( 437 result_transform.PreconcatTransform(
429 target_surface_space_to_container_layer_space); 438 target_surface_space_to_container_layer_space);
430 439
431 return result_transform; 440 return result_transform;
432 } 441 }
433 442
434 void ApplyPositionAdjustment( 443 void ApplyPositionAdjustment(
435 Layer* layer, 444 Layer* layer,
436 Layer* container, 445 Layer* container,
437 const gfx::Transform& scroll_compensation, 446 const gfx::Transform& scroll_compensation,
438 gfx::Transform* combined_transform) { } 447 gfx::Transform* combined_transform) { }
439 void ApplyPositionAdjustment( 448 void ApplyPositionAdjustment(
440 LayerImpl* layer, 449 LayerImpl* layer,
441 LayerImpl* container, 450 LayerImpl* container,
442 const gfx::Transform& scroll_compensation, 451 const gfx::Transform& scroll_compensation,
443 gfx::Transform* combined_transform) 452 gfx::Transform* combined_transform) {
444 {
445 if (!layer->position_constraint().is_fixed_position()) 453 if (!layer->position_constraint().is_fixed_position())
446 return; 454 return;
447 455
448 // Special case: this layer is a composited fixed-position layer; we need to 456 // Special case: this layer is a composited fixed-position layer; we need to
449 // explicitly compensate for all ancestors' nonzero scroll_deltas to keep 457 // explicitly compensate for all ancestors' nonzero scroll_deltas to keep
450 // this layer fixed correctly. 458 // this layer fixed correctly.
451 // Note carefully: this is Concat, not Preconcat 459 // Note carefully: this is Concat, not Preconcat
452 // (current_scroll_compensation * combined_transform). 460 // (current_scroll_compensation * combined_transform).
453 combined_transform->ConcatTransform(scroll_compensation); 461 combined_transform->ConcatTransform(scroll_compensation);
454 462
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 // Compute the replica's "screen_space_transform" that maps from the 1392 // Compute the replica's "screen_space_transform" that maps from the
1385 // replica's origin space to the screen's origin space. 1393 // replica's origin space to the screen's origin space.
1386 gfx::Transform replica_screen_space_transform = 1394 gfx::Transform replica_screen_space_transform =
1387 layer->render_surface()->screen_space_transform() * 1395 layer->render_surface()->screen_space_transform() *
1388 surface_origin_to_replica_origin_transform; 1396 surface_origin_to_replica_origin_transform;
1389 render_surface->SetReplicaScreenSpaceTransform( 1397 render_surface->SetReplicaScreenSpaceTransform(
1390 replica_screen_space_transform); 1398 replica_screen_space_transform);
1391 } 1399 }
1392 } 1400 }
1393 1401
1394 if (update_tile_priorities) 1402 if (update_tile_priorities ||
1403 NeedsFirstTimeUpdateTilePrioritiesForLayer(layer))
enne (OOO) 2013/04/22 17:03:48 I'm a little ಠ_ಠ at adding yet another virtual fun
danakj 2013/04/22 18:37:30 I could certainly call the current function always
enne (OOO) 2013/04/22 18:44:13 You have LayerTreeImpl::frame_time_last_update_til
danakj 2013/04/22 18:59:38 Hm... right. Okay! Just using that now. PTAL.
1395 UpdateTilePrioritiesForLayer(layer); 1404 UpdateTilePrioritiesForLayer(layer);
1396 1405
1397 // If neither this layer nor any of its children were added, early out. 1406 // If neither this layer nor any of its children were added, early out.
1398 if (sorting_start_index == descendants.size()) 1407 if (sorting_start_index == descendants.size())
1399 return; 1408 return;
1400 1409
1401 // If preserves-3d then sort all the descendants in 3D so that they can be 1410 // If preserves-3d then sort all the descendants in 3D so that they can be
1402 // drawn from back to front. If the preserves-3d property is also set on the 1411 // drawn from back to front. If the preserves-3d property is also set on the
1403 // parent then skip the sorting as the parent will sort all the descendants 1412 // parent then skip the sorting as the parent will sort all the descendants
1404 // anyway. 1413 // anyway.
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 // At this point, we think the point does hit the touch event handler region 1724 // At this point, we think the point does hit the touch event handler region
1716 // on the layer, but we need to walk up the parents to ensure that the layer 1725 // on the layer, but we need to walk up the parents to ensure that the layer
1717 // was not clipped in such a way that the hit point actually should not hit 1726 // was not clipped in such a way that the hit point actually should not hit
1718 // the layer. 1727 // the layer.
1719 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) 1728 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl))
1720 return false; 1729 return false;
1721 1730
1722 return true; 1731 return true;
1723 } 1732 }
1724 } // namespace cc 1733 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698