OLD | NEW |
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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 const gfx::Rect& clip, | 1398 const gfx::Rect& clip, |
1399 const gfx::Rect& viewport_rect_for_tile_priority, | 1399 const gfx::Rect& viewport_rect_for_tile_priority, |
1400 const gfx::Transform& transform_for_tile_priority, | 1400 const gfx::Transform& transform_for_tile_priority, |
1401 bool resourceless_software_draw) { | 1401 bool resourceless_software_draw) { |
1402 gfx::Rect viewport_rect_for_tile_priority_in_view_space; | 1402 gfx::Rect viewport_rect_for_tile_priority_in_view_space; |
1403 if (!resourceless_software_draw) { | 1403 if (!resourceless_software_draw) { |
1404 gfx::Transform screen_to_view(gfx::Transform::kSkipInitialization); | 1404 gfx::Transform screen_to_view(gfx::Transform::kSkipInitialization); |
1405 if (transform_for_tile_priority.GetInverse(&screen_to_view)) { | 1405 if (transform_for_tile_priority.GetInverse(&screen_to_view)) { |
1406 // Convert from screen space to view space. | 1406 // Convert from screen space to view space. |
1407 viewport_rect_for_tile_priority_in_view_space = | 1407 viewport_rect_for_tile_priority_in_view_space = |
1408 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 1408 MathUtil::ProjectEnclosingClippedRect( |
1409 screen_to_view, viewport_rect_for_tile_priority)); | 1409 screen_to_view, viewport_rect_for_tile_priority); |
1410 } | 1410 } |
1411 } | 1411 } |
1412 | 1412 |
1413 if (external_transform_ != transform || external_viewport_ != viewport || | 1413 if (external_transform_ != transform || external_viewport_ != viewport || |
1414 resourceless_software_draw_ != resourceless_software_draw || | 1414 resourceless_software_draw_ != resourceless_software_draw || |
1415 viewport_rect_for_tile_priority_ != | 1415 viewport_rect_for_tile_priority_ != |
1416 viewport_rect_for_tile_priority_in_view_space) { | 1416 viewport_rect_for_tile_priority_in_view_space) { |
1417 active_tree_->set_needs_update_draw_properties(); | 1417 active_tree_->set_needs_update_draw_properties(); |
1418 } | 1418 } |
1419 | 1419 |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2851 | 2851 |
2852 float LayerTreeHostImpl::DeviceSpaceDistanceToLayer( | 2852 float LayerTreeHostImpl::DeviceSpaceDistanceToLayer( |
2853 const gfx::PointF& device_viewport_point, | 2853 const gfx::PointF& device_viewport_point, |
2854 LayerImpl* layer_impl) { | 2854 LayerImpl* layer_impl) { |
2855 if (!layer_impl) | 2855 if (!layer_impl) |
2856 return std::numeric_limits<float>::max(); | 2856 return std::numeric_limits<float>::max(); |
2857 | 2857 |
2858 gfx::Rect layer_impl_bounds(layer_impl->bounds()); | 2858 gfx::Rect layer_impl_bounds(layer_impl->bounds()); |
2859 | 2859 |
2860 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( | 2860 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( |
2861 layer_impl->screen_space_transform(), | 2861 layer_impl->screen_space_transform(), gfx::RectF(layer_impl_bounds)); |
2862 layer_impl_bounds); | |
2863 | 2862 |
2864 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( | 2863 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( |
2865 device_viewport_point); | 2864 device_viewport_point); |
2866 } | 2865 } |
2867 | 2866 |
2868 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 2867 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
2869 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, | 2868 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, |
2870 device_scale_factor_); | 2869 device_scale_factor_); |
2871 LayerImpl* layer_impl = | 2870 LayerImpl* layer_impl = |
2872 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 2871 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3642 if (active_tree()) { | 3641 if (active_tree()) { |
3643 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3642 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
3644 if (layer) | 3643 if (layer) |
3645 return layer->ScrollOffsetForAnimation(); | 3644 return layer->ScrollOffsetForAnimation(); |
3646 } | 3645 } |
3647 | 3646 |
3648 return gfx::ScrollOffset(); | 3647 return gfx::ScrollOffset(); |
3649 } | 3648 } |
3650 | 3649 |
3651 } // namespace cc | 3650 } // namespace cc |
OLD | NEW |