| 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" | |
| 11 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 12 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
| 13 #include "cc/layer_impl.h" | 12 #include "cc/layer_impl.h" |
| 13 #include "ui/gfx/rect_f.h" |
| 14 | 14 |
| 15 #if defined(COMPILER_GCC) | 15 #if defined(COMPILER_GCC) |
| 16 namespace cc | 16 namespace cc |
| 17 { | 17 { |
| 18 struct GraphEdge; | 18 struct GraphEdge; |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 namespace BASE_HASH_NAMESPACE { | 21 namespace BASE_HASH_NAMESPACE { |
| 22 template<> | 22 template<> |
| 23 struct hash<cc::GraphEdge*> { | 23 struct hash<cc::GraphEdge*> { |
| 24 size_t operator()(cc::GraphEdge* ptr) const { | 24 size_t operator()(cc::GraphEdge* ptr) const { |
| 25 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 25 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| 26 } | 26 } |
| 27 }; | 27 }; |
| 28 } // namespace BASE_HASH_NAMESPACE | 28 } // namespace BASE_HASH_NAMESPACE |
| 29 #endif // COMPILER | 29 #endif // COMPILER |
| 30 | 30 |
| 31 namespace WebKit { | 31 namespace WebKit { |
| 32 class WebTransformationMatrix; | 32 class WebTransformationMatrix; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace cc { | 35 namespace cc { |
| 36 | 36 |
| 37 struct GraphEdge; | 37 struct GraphEdge; |
| 38 | 38 |
| 39 // Holds various useful properties derived from a layer's 3D outline. | 39 // Holds various useful properties derived from a layer's 3D outline. |
| 40 struct LayerShape { | 40 struct LayerShape { |
| 41 LayerShape(); | 41 LayerShape(); |
| 42 LayerShape(float width, float height, const WebKit::WebTransformationMatrix&
drawTransform); | 42 LayerShape(float width, float height, const WebKit::WebTransformationMatrix&
drawTransform); |
| 43 ~LayerShape(); |
| 43 | 44 |
| 44 float layerZFromProjectedPoint(const FloatPoint&) const; | 45 float layerZFromProjectedPoint(const gfx::PointF&) 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 gfx::RectF projectedBounds; |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 struct GraphNode { | 53 struct GraphNode { |
| 53 explicit GraphNode(LayerImpl* layerImpl); | 54 explicit GraphNode(LayerImpl* layerImpl); |
| 54 ~GraphNode(); | 55 ~GraphNode(); |
| 55 | 56 |
| 56 LayerImpl* layer; | 57 LayerImpl* layer; |
| 57 LayerShape shape; | 58 LayerShape shape; |
| 58 std::vector<GraphEdge*> incoming; | 59 std::vector<GraphEdge*> incoming; |
| 59 std::vector<GraphEdge*> outgoing; | 60 std::vector<GraphEdge*> outgoing; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |