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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 float weight; | 72 float weight; |
73 }; | 73 }; |
74 | 74 |
75 | 75 |
76 | 76 |
77 class CC_EXPORT LayerSorter { | 77 class CC_EXPORT LayerSorter { |
78 public: | 78 public: |
79 LayerSorter(); | 79 LayerSorter(); |
80 ~LayerSorter(); | 80 ~LayerSorter(); |
81 | 81 |
82 typedef std::vector<LayerImpl*> LayerList; | 82 void Sort(LayerImplList::iterator first, LayerImplList::iterator last); |
83 | |
84 void Sort(LayerList::iterator first, LayerList::iterator last); | |
85 | 83 |
86 enum ABCompareResult { | 84 enum ABCompareResult { |
87 ABeforeB, | 85 ABeforeB, |
88 BBeforeA, | 86 BBeforeA, |
89 None | 87 None |
90 }; | 88 }; |
91 | 89 |
92 static ABCompareResult CheckOverlap(LayerShape* a, | 90 static ABCompareResult CheckOverlap(LayerShape* a, |
93 LayerShape* b, | 91 LayerShape* b, |
94 float z_threshold, | 92 float z_threshold, |
95 float* weight); | 93 float* weight); |
96 | 94 |
97 private: | 95 private: |
98 typedef std::vector<GraphNode> NodeList; | 96 typedef std::vector<GraphNode> NodeList; |
99 typedef std::vector<GraphEdge> EdgeList; | 97 typedef std::vector<GraphEdge> EdgeList; |
100 NodeList nodes_; | 98 NodeList nodes_; |
101 EdgeList edges_; | 99 EdgeList edges_; |
102 float z_range_; | 100 float z_range_; |
103 | 101 |
104 typedef base::hash_map<GraphEdge*, GraphEdge*> EdgeMap; | 102 typedef base::hash_map<GraphEdge*, GraphEdge*> EdgeMap; |
105 EdgeMap active_edges_; | 103 EdgeMap active_edges_; |
106 | 104 |
107 void CreateGraphNodes(LayerList::iterator first, LayerList::iterator last); | 105 void CreateGraphNodes(LayerImplList::iterator first, |
| 106 LayerImplList::iterator last); |
108 void CreateGraphEdges(); | 107 void CreateGraphEdges(); |
109 void RemoveEdgeFromList(GraphEdge* graph, std::vector<GraphEdge*>* list); | 108 void RemoveEdgeFromList(GraphEdge* graph, std::vector<GraphEdge*>* list); |
110 | 109 |
111 DISALLOW_COPY_AND_ASSIGN(LayerSorter); | 110 DISALLOW_COPY_AND_ASSIGN(LayerSorter); |
112 }; | 111 }; |
113 | 112 |
114 } // namespace cc | 113 } // namespace cc |
115 #endif // CC_TREES_LAYER_SORTER_H_ | 114 #endif // CC_TREES_LAYER_SORTER_H_ |
OLD | NEW |