| 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 CCLayerSorter_h | 5 #ifndef CCLayerSorter_h |
| 6 #define CCLayerSorter_h | 6 #define CCLayerSorter_h |
| 7 | 7 |
| 8 #include "FloatPoint3D.h" | 8 #include "FloatPoint3D.h" |
| 9 #include "FloatQuad.h" | 9 #include "FloatQuad.h" |
| 10 #include "FloatRect.h" | 10 #include "FloatRect.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
| 13 #include "cc/cc_export.h" |
| 13 #include "cc/layer_impl.h" | 14 #include "cc/layer_impl.h" |
| 14 | 15 |
| 15 #if defined(COMPILER_GCC) | 16 #if defined(COMPILER_GCC) |
| 16 namespace cc | 17 namespace cc |
| 17 { | 18 { |
| 18 struct GraphEdge; | 19 struct GraphEdge; |
| 19 }; | 20 }; |
| 20 | 21 |
| 21 namespace BASE_HASH_NAMESPACE { | 22 namespace BASE_HASH_NAMESPACE { |
| 22 template<> | 23 template<> |
| 23 struct hash<cc::GraphEdge*> { | 24 struct hash<cc::GraphEdge*> { |
| 24 size_t operator()(cc::GraphEdge* ptr) const { | 25 size_t operator()(cc::GraphEdge* ptr) const { |
| 25 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 26 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| 26 } | 27 } |
| 27 }; | 28 }; |
| 28 } // namespace BASE_HASH_NAMESPACE | 29 } // namespace BASE_HASH_NAMESPACE |
| 29 #endif // COMPILER | 30 #endif // COMPILER |
| 30 | 31 |
| 31 namespace WebKit { | 32 namespace WebKit { |
| 32 class WebTransformationMatrix; | 33 class WebTransformationMatrix; |
| 33 } | 34 } |
| 34 | 35 |
| 35 namespace cc { | 36 namespace cc { |
| 36 | 37 |
| 37 struct GraphEdge; | 38 struct GraphEdge; |
| 38 | 39 |
| 39 // Holds various useful properties derived from a layer's 3D outline. | 40 // Holds various useful properties derived from a layer's 3D outline. |
| 40 struct LayerShape { | 41 struct CC_EXPORT LayerShape { |
| 41 LayerShape(); | 42 LayerShape(); |
| 42 LayerShape(float width, float height, const WebKit::WebTransformationMatrix&
drawTransform); | 43 LayerShape(float width, float height, const WebKit::WebTransformationMatrix&
drawTransform); |
| 43 | 44 |
| 44 float layerZFromProjectedPoint(const FloatPoint&) const; | 45 float layerZFromProjectedPoint(const FloatPoint&) const; |
| 45 | 46 |
| 46 FloatPoint3D layerNormal; | 47 FloatPoint3D layerNormal; |
| 47 FloatPoint3D transformOrigin; | 48 FloatPoint3D transformOrigin; |
| 48 FloatQuad projectedQuad; | 49 FloatQuad projectedQuad; |
| 49 FloatRect projectedBounds; | 50 FloatRect projectedBounds; |
| 50 }; | 51 }; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 68 { | 69 { |
| 69 } | 70 } |
| 70 | 71 |
| 71 GraphNode* from; | 72 GraphNode* from; |
| 72 GraphNode* to; | 73 GraphNode* to; |
| 73 float weight; | 74 float weight; |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 | 77 |
| 77 | 78 |
| 78 class LayerSorter { | 79 class CC_EXPORT LayerSorter { |
| 79 public: | 80 public: |
| 80 LayerSorter(); | 81 LayerSorter(); |
| 81 ~LayerSorter(); | 82 ~LayerSorter(); |
| 82 | 83 |
| 83 typedef std::vector<LayerImpl*> LayerList; | 84 typedef std::vector<LayerImpl*> LayerList; |
| 84 | 85 |
| 85 void sort(LayerList::iterator first, LayerList::iterator last); | 86 void sort(LayerList::iterator first, LayerList::iterator last); |
| 86 | 87 |
| 87 enum ABCompareResult { | 88 enum ABCompareResult { |
| 88 ABeforeB, | 89 ABeforeB, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 104 | 105 |
| 105 void createGraphNodes(LayerList::iterator first, LayerList::iterator last); | 106 void createGraphNodes(LayerList::iterator first, LayerList::iterator last); |
| 106 void createGraphEdges(); | 107 void createGraphEdges(); |
| 107 void removeEdgeFromList(GraphEdge*, std::vector<GraphEdge*>&); | 108 void removeEdgeFromList(GraphEdge*, std::vector<GraphEdge*>&); |
| 108 | 109 |
| 109 DISALLOW_COPY_AND_ASSIGN(LayerSorter); | 110 DISALLOW_COPY_AND_ASSIGN(LayerSorter); |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 } | 113 } |
| 113 #endif | 114 #endif |
| OLD | NEW |