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 #ifndef CC_TREES_LAYER_SORTER_H_ | 5 #ifndef CC_TREES_LAYER_SORTER_H_ |
6 #define CC_TREES_LAYER_SORTER_H_ | 6 #define CC_TREES_LAYER_SORTER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 | 62 |
63 | 63 |
64 class CC_EXPORT LayerSorter { | 64 class CC_EXPORT LayerSorter { |
65 public: | 65 public: |
66 LayerSorter(); | 66 LayerSorter(); |
67 ~LayerSorter(); | 67 ~LayerSorter(); |
68 | 68 |
69 void Sort(LayerImplList::iterator first, LayerImplList::iterator last); | 69 void Sort(LayerImplList::iterator first, LayerImplList::iterator last); |
70 | 70 |
71 enum ABCompareResult { A_BEFORE_B, B_BEFORE_A, NONE }; | 71 enum ABCompareResult { |
| 72 ABeforeB, |
| 73 BBeforeA, |
| 74 None |
| 75 }; |
72 | 76 |
73 static ABCompareResult CheckOverlap(LayerShape* a, | 77 static ABCompareResult CheckOverlap(LayerShape* a, |
74 LayerShape* b, | 78 LayerShape* b, |
75 float z_threshold, | 79 float z_threshold, |
76 float* weight); | 80 float* weight); |
77 | 81 |
78 private: | 82 private: |
79 typedef std::vector<GraphNode> NodeList; | 83 typedef std::vector<GraphNode> NodeList; |
80 typedef std::vector<GraphEdge> EdgeList; | 84 typedef std::vector<GraphEdge> EdgeList; |
81 NodeList nodes_; | 85 NodeList nodes_; |
82 EdgeList edges_; | 86 EdgeList edges_; |
83 float z_range_; | 87 float z_range_; |
84 | 88 |
85 typedef base::hash_map<GraphEdge*, GraphEdge*> EdgeMap; | 89 typedef base::hash_map<GraphEdge*, GraphEdge*> EdgeMap; |
86 EdgeMap active_edges_; | 90 EdgeMap active_edges_; |
87 | 91 |
88 void CreateGraphNodes(LayerImplList::iterator first, | 92 void CreateGraphNodes(LayerImplList::iterator first, |
89 LayerImplList::iterator last); | 93 LayerImplList::iterator last); |
90 void CreateGraphEdges(); | 94 void CreateGraphEdges(); |
91 void RemoveEdgeFromList(GraphEdge* graph, std::vector<GraphEdge*>* list); | 95 void RemoveEdgeFromList(GraphEdge* graph, std::vector<GraphEdge*>* list); |
92 | 96 |
93 DISALLOW_COPY_AND_ASSIGN(LayerSorter); | 97 DISALLOW_COPY_AND_ASSIGN(LayerSorter); |
94 }; | 98 }; |
95 | 99 |
96 } // namespace cc | 100 } // namespace cc |
97 #endif // CC_TREES_LAYER_SORTER_H_ | 101 #endif // CC_TREES_LAYER_SORTER_H_ |
OLD | NEW |