| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 // viewport, try to inverse project the viewport into layer space and use | 462 // viewport, try to inverse project the viewport into layer space and use |
| 463 // that. Otherwise just use visible_rect_for_tile_priority_ | 463 // that. Otherwise just use visible_rect_for_tile_priority_ |
| 464 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; | 464 gfx::Rect visible_rect_in_content_space = visible_rect_for_tile_priority_; |
| 465 gfx::Rect viewport_rect_for_tile_priority = | 465 gfx::Rect viewport_rect_for_tile_priority = |
| 466 layer_tree_impl()->ViewportRectForTilePriority(); | 466 layer_tree_impl()->ViewportRectForTilePriority(); |
| 467 if (visible_rect_in_content_space.IsEmpty() || | 467 if (visible_rect_in_content_space.IsEmpty() || |
| 468 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority) { | 468 layer_tree_impl()->DeviceViewport() != viewport_rect_for_tile_priority) { |
| 469 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); | 469 gfx::Transform view_to_layer(gfx::Transform::kSkipInitialization); |
| 470 if (screen_space_transform().GetInverse(&view_to_layer)) { | 470 if (screen_space_transform().GetInverse(&view_to_layer)) { |
| 471 // Transform from view space to content space. | 471 // Transform from view space to content space. |
| 472 visible_rect_in_content_space = | 472 visible_rect_in_content_space = MathUtil::ProjectEnclosingClippedRect( |
| 473 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 473 view_to_layer, viewport_rect_for_tile_priority); |
| 474 view_to_layer, viewport_rect_for_tile_priority)); | |
| 475 | 474 |
| 476 // We have to allow for a viewport that is outside of the layer bounds in | 475 // We have to allow for a viewport that is outside of the layer bounds in |
| 477 // order to compute tile priorities correctly for offscreen content that | 476 // order to compute tile priorities correctly for offscreen content that |
| 478 // is going to make it on screen. However, we also have to limit the | 477 // is going to make it on screen. However, we also have to limit the |
| 479 // viewport since it can be very large due to screen_space_transforms. As | 478 // viewport since it can be very large due to screen_space_transforms. As |
| 480 // a heuristic, we clip to bounds padded by skewport_extrapolation_limit * | 479 // a heuristic, we clip to bounds padded by skewport_extrapolation_limit * |
| 481 // maximum tiling scale, since this should allow sufficient room for | 480 // maximum tiling scale, since this should allow sufficient room for |
| 482 // skewport calculations. | 481 // skewport calculations. |
| 483 gfx::Rect padded_bounds(bounds()); | 482 gfx::Rect padded_bounds(bounds()); |
| 484 int padding_amount = layer_tree_impl() | 483 int padding_amount = layer_tree_impl() |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 | 1235 |
| 1237 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1236 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1238 return !layer_tree_impl()->IsRecycleTree(); | 1237 return !layer_tree_impl()->IsRecycleTree(); |
| 1239 } | 1238 } |
| 1240 | 1239 |
| 1241 bool PictureLayerImpl::HasValidTilePriorities() const { | 1240 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1242 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1241 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1243 } | 1242 } |
| 1244 | 1243 |
| 1245 } // namespace cc | 1244 } // namespace cc |
| OLD | NEW |