OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 // viewport, try to inverse project the viewport into layer space and use | 470 // viewport, try to inverse project the viewport into layer space and use |
471 // that. Otherwise just use visible_rect_for_tile_priority_ | 471 // that. Otherwise just use visible_rect_for_tile_priority_ |
472 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; | 472 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; |
473 gfx::Rect viewport_rect_for_tile_priority = | 473 gfx::Rect viewport_rect_for_tile_priority = |
474 layer_tree_impl()->ViewportRectForTilePriority(); | 474 layer_tree_impl()->ViewportRectForTilePriority(); |
475 if (visible_rect_in_content_space.IsEmpty() || | 475 if (visible_rect_in_content_space.IsEmpty() || |
476 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority) { | 476 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority) { |
477 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); | 477 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); |
478 if (screen_space_transform().GetInverse(&view_to_layer)) { | 478 if (screen_space_transform().GetInverse(&view_to_layer)) { |
479 // Transform from view space to content space. | 479 // Transform from view space to content space. |
480 visible_rect_in_content_space = | 480 visible_rect_in_content_space = MathUtil::ProjectEnclosingClippedRect( |
481 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 481 view_to_layer, viewport_rect_for_tile_priority); |
482 view_to_layer, viewport_rect_for_tile_priority)); | |
483 | 482 |
484 // We have to allow for a viewport that is outside of the layer bounds in | 483 // We have to allow for a viewport that is outside of the layer bounds in |
485 // order to compute tile priorities correctly for offscreen content that | 484 // order to compute tile priorities correctly for offscreen content that |
486 // is going to make it on screen. However, we also have to limit the | 485 // is going to make it on screen. However, we also have to limit the |
487 // viewport since it can be very large due to screen_space_transforms. As | 486 // viewport since it can be very large due to screen_space_transforms. As |
488 // a heuristic, we clip to bounds padded by skewport_extrapolation_limit * | 487 // a heuristic, we clip to bounds padded by skewport_extrapolation_limit * |
489 // maximum tiling scale, since this should allow sufficient room for | 488 // maximum tiling scale, since this should allow sufficient room for |
490 // skewport calculations. | 489 // skewport calculations. |
491 gfx::Rect padded_bounds(bounds()); | 490 gfx::Rect padded_bounds(bounds()); |
492 int padding_amount = layer_tree_impl() | 491 int padding_amount = layer_tree_impl() |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 | 1243 |
1245 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1244 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1246 return !layer_tree_impl()->IsRecycleTree(); | 1245 return !layer_tree_impl()->IsRecycleTree(); |
1247 } | 1246 } |
1248 | 1247 |
1249 bool PictureLayerImpl::HasValidTilePriorities() const { | 1248 bool PictureLayerImpl::HasValidTilePriorities() const { |
1250 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1249 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
1251 } | 1250 } |
1252 | 1251 |
1253 } // namespace cc | 1252 } // namespace cc |
OLD | NEW |