OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/draw_property_utils.h" | 5 #include "cc/trees/draw_property_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 420 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( |
421 target_to_content, combined_clip_rect_in_target_space)); | 421 target_to_content, combined_clip_rect_in_target_space)); |
422 visible_rect.Intersect(gfx::Rect(layer_bounds)); | 422 visible_rect.Intersect(gfx::Rect(layer_bounds)); |
423 layer->set_visible_layer_rect(visible_rect); | 423 layer->set_visible_layer_rect(visible_rect); |
424 } else { | 424 } else { |
425 layer->set_visible_layer_rect(gfx::Rect(layer_bounds)); | 425 layer->set_visible_layer_rect(gfx::Rect(layer_bounds)); |
426 } | 426 } |
427 continue; | 427 continue; |
428 } | 428 } |
429 | 429 |
430 // When both the layer and the target are unclipped, the entire layer | 430 // When both the layer and the target are unclipped, we only have to apply |
431 // content rect is visible. | 431 // the viewport clip. |
432 const bool fully_visible = | 432 const bool fully_visible = |
433 !clip_node->layers_are_clipped && !clip_node->target_is_clipped; | 433 !clip_node->layers_are_clipped && !clip_node->target_is_clipped; |
434 | 434 |
435 if (fully_visible) { | 435 if (fully_visible) { |
436 layer->set_visible_layer_rect(gfx::Rect(layer_bounds)); | 436 if (!transform_node->ancestors_are_invertible) { |
| 437 // An animated singular transform may become non-singular during the |
| 438 // animation, so we still need to compute a visible rect. In this |
| 439 // situation, we treat the entire layer as visible. |
| 440 layer->set_visible_layer_rect(gfx::Rect(layer_bounds)); |
| 441 } else { |
| 442 gfx::Transform from_screen; |
| 443 from_screen.Translate(-layer->offset_to_transform_parent().x(), |
| 444 -layer->offset_to_transform_parent().y()); |
| 445 from_screen.PreconcatTransform( |
| 446 property_trees->transform_tree.FromScreen(transform_node->id)); |
| 447 gfx::Rect visible_rect = |
| 448 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( |
| 449 from_screen, property_trees->clip_tree.ViewportClip())); |
| 450 visible_rect.Intersect(gfx::Rect(layer_bounds)); |
| 451 layer->set_visible_layer_rect(visible_rect); |
| 452 } |
437 continue; | 453 continue; |
438 } | 454 } |
439 | 455 |
440 int target_node_id = transform_tree.ContentTargetId(transform_node->id); | 456 int target_node_id = transform_tree.ContentTargetId(transform_node->id); |
441 | 457 |
442 // The clip node stores clip rect in its target space. If required, | 458 // The clip node stores clip rect in its target space. If required, |
443 // this clip rect should be mapped to the current layer's target space. | 459 // this clip rect should be mapped to the current layer's target space. |
444 gfx::RectF combined_clip_rect_in_target_space; | 460 gfx::RectF combined_clip_rect_in_target_space; |
445 | 461 |
446 if (clip_node->target_transform_id != target_node_id) { | 462 if (clip_node->target_transform_id != target_node_id) { |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 void UpdateElasticOverscroll(PropertyTrees* property_trees, | 1601 void UpdateElasticOverscroll(PropertyTrees* property_trees, |
1586 const Layer* overscroll_elasticity_layer, | 1602 const Layer* overscroll_elasticity_layer, |
1587 const gfx::Vector2dF& elastic_overscroll) { | 1603 const gfx::Vector2dF& elastic_overscroll) { |
1588 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, | 1604 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, |
1589 elastic_overscroll); | 1605 elastic_overscroll); |
1590 } | 1606 } |
1591 | 1607 |
1592 } // namespace draw_property_utils | 1608 } // namespace draw_property_utils |
1593 | 1609 |
1594 } // namespace cc | 1610 } // namespace cc |
OLD | NEW |