| 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 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 const gfx::Rect& clip, | 1371 const gfx::Rect& clip, |
| 1372 const gfx::Rect& viewport_rect_for_tile_priority, | 1372 const gfx::Rect& viewport_rect_for_tile_priority, |
| 1373 const gfx::Transform& transform_for_tile_priority, | 1373 const gfx::Transform& transform_for_tile_priority, |
| 1374 bool resourceless_software_draw) { | 1374 bool resourceless_software_draw) { |
| 1375 gfx::Rect viewport_rect_for_tile_priority_in_view_space; | 1375 gfx::Rect viewport_rect_for_tile_priority_in_view_space; |
| 1376 if (!resourceless_software_draw) { | 1376 if (!resourceless_software_draw) { |
| 1377 gfx::Transform screen_to_view(gfx::Transform::kSkipInitialization); | 1377 gfx::Transform screen_to_view(gfx::Transform::kSkipInitialization); |
| 1378 if (transform_for_tile_priority.GetInverse(&screen_to_view)) { | 1378 if (transform_for_tile_priority.GetInverse(&screen_to_view)) { |
| 1379 // Convert from screen space to view space. | 1379 // Convert from screen space to view space. |
| 1380 viewport_rect_for_tile_priority_in_view_space = | 1380 viewport_rect_for_tile_priority_in_view_space = |
| 1381 gfx::ToEnclosingRect(MathUtil::ProjectClippedRect( | 1381 MathUtil::ProjectEnclosingClippedRect( |
| 1382 screen_to_view, viewport_rect_for_tile_priority)); | 1382 screen_to_view, viewport_rect_for_tile_priority); |
| 1383 } | 1383 } |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 if (external_transform_ != transform || external_viewport_ != viewport || | 1386 if (external_transform_ != transform || external_viewport_ != viewport || |
| 1387 resourceless_software_draw_ != resourceless_software_draw || | 1387 resourceless_software_draw_ != resourceless_software_draw || |
| 1388 viewport_rect_for_tile_priority_ != | 1388 viewport_rect_for_tile_priority_ != |
| 1389 viewport_rect_for_tile_priority_in_view_space) { | 1389 viewport_rect_for_tile_priority_in_view_space) { |
| 1390 active_tree_->set_needs_update_draw_properties(); | 1390 active_tree_->set_needs_update_draw_properties(); |
| 1391 } | 1391 } |
| 1392 | 1392 |
| (...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2801 | 2801 |
| 2802 float LayerTreeHostImpl::DeviceSpaceDistanceToLayer( | 2802 float LayerTreeHostImpl::DeviceSpaceDistanceToLayer( |
| 2803 const gfx::PointF& device_viewport_point, | 2803 const gfx::PointF& device_viewport_point, |
| 2804 LayerImpl* layer_impl) { | 2804 LayerImpl* layer_impl) { |
| 2805 if (!layer_impl) | 2805 if (!layer_impl) |
| 2806 return std::numeric_limits<float>::max(); | 2806 return std::numeric_limits<float>::max(); |
| 2807 | 2807 |
| 2808 gfx::Rect layer_impl_bounds(layer_impl->bounds()); | 2808 gfx::Rect layer_impl_bounds(layer_impl->bounds()); |
| 2809 | 2809 |
| 2810 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( | 2810 gfx::RectF device_viewport_layer_impl_bounds = MathUtil::MapClippedRect( |
| 2811 layer_impl->screen_space_transform(), | 2811 layer_impl->screen_space_transform(), gfx::RectF(layer_impl_bounds)); |
| 2812 layer_impl_bounds); | |
| 2813 | 2812 |
| 2814 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( | 2813 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( |
| 2815 device_viewport_point); | 2814 device_viewport_point); |
| 2816 } | 2815 } |
| 2817 | 2816 |
| 2818 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 2817 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| 2819 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, | 2818 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, |
| 2820 device_scale_factor_); | 2819 device_scale_factor_); |
| 2821 LayerImpl* layer_impl = | 2820 LayerImpl* layer_impl = |
| 2822 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 2821 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3598 if (active_tree()) { | 3597 if (active_tree()) { |
| 3599 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3598 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
| 3600 if (layer) | 3599 if (layer) |
| 3601 return layer->ScrollOffsetForAnimation(); | 3600 return layer->ScrollOffsetForAnimation(); |
| 3602 } | 3601 } |
| 3603 | 3602 |
| 3604 return gfx::ScrollOffset(); | 3603 return gfx::ScrollOffset(); |
| 3605 } | 3604 } |
| 3606 | 3605 |
| 3607 } // namespace cc | 3606 } // namespace cc |
| OLD | NEW |