| 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 { | 71 enum ABCompareResult { A_BEFORE_B, B_BEFORE_A, NONE }; |
| 72 ABeforeB, | |
| 73 BBeforeA, | |
| 74 None | |
| 75 }; | |
| 76 | 72 |
| 77 static ABCompareResult CheckOverlap(LayerShape* a, | 73 static ABCompareResult CheckOverlap(LayerShape* a, |
| 78 LayerShape* b, | 74 LayerShape* b, |
| 79 float z_threshold, | 75 float z_threshold, |
| 80 float* weight); | 76 float* weight); |
| 81 | 77 |
| 82 private: | 78 private: |
| 83 typedef std::vector<GraphNode> NodeList; | 79 typedef std::vector<GraphNode> NodeList; |
| 84 typedef std::vector<GraphEdge> EdgeList; | 80 typedef std::vector<GraphEdge> EdgeList; |
| 85 NodeList nodes_; | 81 NodeList nodes_; |
| 86 EdgeList edges_; | 82 EdgeList edges_; |
| 87 float z_range_; | 83 float z_range_; |
| 88 | 84 |
| 89 typedef base::hash_map<GraphEdge*, GraphEdge*> EdgeMap; | 85 typedef base::hash_map<GraphEdge*, GraphEdge*> EdgeMap; |
| 90 EdgeMap active_edges_; | 86 EdgeMap active_edges_; |
| 91 | 87 |
| 92 void CreateGraphNodes(LayerImplList::iterator first, | 88 void CreateGraphNodes(LayerImplList::iterator first, |
| 93 LayerImplList::iterator last); | 89 LayerImplList::iterator last); |
| 94 void CreateGraphEdges(); | 90 void CreateGraphEdges(); |
| 95 void RemoveEdgeFromList(GraphEdge* graph, std::vector<GraphEdge*>* list); | 91 void RemoveEdgeFromList(GraphEdge* graph, std::vector<GraphEdge*>* list); |
| 96 | 92 |
| 97 DISALLOW_COPY_AND_ASSIGN(LayerSorter); | 93 DISALLOW_COPY_AND_ASSIGN(LayerSorter); |
| 98 }; | 94 }; |
| 99 | 95 |
| 100 } // namespace cc | 96 } // namespace cc |
| 101 #endif // CC_TREES_LAYER_SORTER_H_ | 97 #endif // CC_TREES_LAYER_SORTER_H_ |
| OLD | NEW |