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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1354 // closer in this case, counterintuitively. | 1354 // closer in this case, counterintuitively. |
1355 float closest_distance; | 1355 float closest_distance; |
1356 }; | 1356 }; |
1357 | 1357 |
1358 template <typename Functor> | 1358 template <typename Functor> |
1359 static void FindClosestMatchingLayer( | 1359 static void FindClosestMatchingLayer( |
1360 const gfx::PointF& screen_space_point, | 1360 const gfx::PointF& screen_space_point, |
1361 LayerImpl* layer, | 1361 LayerImpl* layer, |
1362 const Functor& func, | 1362 const Functor& func, |
1363 FindClosestMatchingLayerDataForRecursion* data_for_recursion) { | 1363 FindClosestMatchingLayerDataForRecursion* data_for_recursion) { |
1364 for (int i = layer->children().size() - 1; i >= 0; --i) { | 1364 for (size_t i = 0; i < layer->children().size(); ++i) { |
danakj
2015/06/09 17:39:49
we could cache the size() for each of these and th
vmpstr
2015/06/09 18:37:17
Done.
| |
1365 FindClosestMatchingLayer( | 1365 size_t index = layer->children().size() - 1 - i; |
1366 screen_space_point, layer->children()[i], func, data_for_recursion); | 1366 FindClosestMatchingLayer(screen_space_point, layer->children()[index], func, |
1367 data_for_recursion); | |
1367 } | 1368 } |
1368 | 1369 |
1369 float distance_to_intersection = 0.f; | 1370 float distance_to_intersection = 0.f; |
1370 if (func(layer) && | 1371 if (func(layer) && |
1371 PointHitsLayer(layer, screen_space_point, &distance_to_intersection) && | 1372 PointHitsLayer(layer, screen_space_point, &distance_to_intersection) && |
1372 ((!data_for_recursion->closest_match || | 1373 ((!data_for_recursion->closest_match || |
1373 distance_to_intersection > data_for_recursion->closest_distance))) { | 1374 distance_to_intersection > data_for_recursion->closest_distance))) { |
1374 data_for_recursion->closest_distance = distance_to_intersection; | 1375 data_for_recursion->closest_distance = distance_to_intersection; |
1375 data_for_recursion->closest_match = layer; | 1376 data_for_recursion->closest_match = layer; |
1376 } | 1377 } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1589 scoped_ptr<PendingPageScaleAnimation> pending_animation) { | 1590 scoped_ptr<PendingPageScaleAnimation> pending_animation) { |
1590 pending_page_scale_animation_ = pending_animation.Pass(); | 1591 pending_page_scale_animation_ = pending_animation.Pass(); |
1591 } | 1592 } |
1592 | 1593 |
1593 scoped_ptr<PendingPageScaleAnimation> | 1594 scoped_ptr<PendingPageScaleAnimation> |
1594 LayerTreeImpl::TakePendingPageScaleAnimation() { | 1595 LayerTreeImpl::TakePendingPageScaleAnimation() { |
1595 return pending_page_scale_animation_.Pass(); | 1596 return pending_page_scale_animation_.Pass(); |
1596 } | 1597 } |
1597 | 1598 |
1598 } // namespace cc | 1599 } // namespace cc |
OLD | NEW |