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_sorter.h" | 5 #include "cc/trees/layer_sorter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 #include <limits> | 9 #include <limits> |
10 #include <vector> | 10 #include <vector> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 : layer(layer_impl), | 63 : layer(layer_impl), |
64 incoming_edge_weight(0.f) {} | 64 incoming_edge_weight(0.f) {} |
65 | 65 |
66 GraphNode::~GraphNode() {} | 66 GraphNode::~GraphNode() {} |
67 | 67 |
68 LayerSorter::LayerSorter() | 68 LayerSorter::LayerSorter() |
69 : z_range_(0.f) {} | 69 : z_range_(0.f) {} |
70 | 70 |
71 LayerSorter::~LayerSorter() {} | 71 LayerSorter::~LayerSorter() {} |
72 | 72 |
73 static float CheckFloatingPointNumericAccuracy(float a, float b) { | 73 static float const CheckFloatingPointNumericAccuracy(float a, float b) { |
74 float abs_dif = std::abs(b - a); | 74 float abs_dif = std::abs(b - a); |
75 float abs_max = std::max(std::abs(b), std::abs(a)); | 75 float abs_max = std::max(std::abs(b), std::abs(a)); |
76 // Check to see if we've got a result with a reasonable amount of error. | 76 // Check to see if we've got a result with a reasonable amount of error. |
77 return abs_dif / abs_max; | 77 return abs_dif / abs_max; |
78 } | 78 } |
79 | 79 |
80 // Checks whether layer "a" draws on top of layer "b". The weight value returned | 80 // Checks whether layer "a" draws on top of layer "b". The weight value returned |
81 // is an indication of the maximum z-depth difference between the layers or zero | 81 // is an indication of the maximum z-depth difference between the layers or zero |
82 // if the layers are found to be intesecting (some features are in front and | 82 // if the layers are found to be intesecting (some features are in front and |
83 // some are behind). | 83 // some are behind). |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 *it = sorted_list[count++]->layer; | 458 *it = sorted_list[count++]->layer; |
459 | 459 |
460 DVLOG(2) << "Sorting end ----"; | 460 DVLOG(2) << "Sorting end ----"; |
461 | 461 |
462 nodes_.clear(); | 462 nodes_.clear(); |
463 edges_.clear(); | 463 edges_.clear(); |
464 active_edges_.clear(); | 464 active_edges_.clear(); |
465 } | 465 } |
466 | 466 |
467 } // namespace cc | 467 } // namespace cc |
OLD | NEW |