| 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 "CCLayerImpl.h" | 8 #include "CCLayerImpl.h" |
| 9 #include "FloatPoint3D.h" | 9 #include "FloatPoint3D.h" |
| 10 #include "FloatQuad.h" | 10 #include "FloatQuad.h" |
| 11 #include "FloatRect.h" | 11 #include "FloatRect.h" |
| 12 #include <wtf/HashMap.h> | 12 #include <wtf/HashMap.h> |
| 13 #include <wtf/Noncopyable.h> | 13 #include <wtf/Noncopyable.h> |
| 14 #include <wtf/Vector.h> | 14 #include <wtf/Vector.h> |
| 15 | 15 |
| 16 namespace WebKit { | 16 namespace WebKit { |
| 17 class WebTransformationMatrix; | 17 class WebTransformationMatrix; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 class CCLayerSorter { | 22 class CCLayerSorter { |
| 23 WTF_MAKE_NONCOPYABLE(CCLayerSorter); | 23 WTF_MAKE_NONCOPYABLE(CCLayerSorter); |
| 24 public: | 24 public: |
| 25 CCLayerSorter() : m_zRange(0) { } | 25 CCLayerSorter(); |
| 26 ~CCLayerSorter(); |
| 26 | 27 |
| 27 typedef Vector<CCLayerImpl*> LayerList; | 28 typedef Vector<CCLayerImpl*> LayerList; |
| 28 | 29 |
| 29 void sort(LayerList::iterator first, LayerList::iterator last); | 30 void sort(LayerList::iterator first, LayerList::iterator last); |
| 30 | 31 |
| 31 // Holds various useful properties derived from a layer's 3D outline. | 32 // Holds various useful properties derived from a layer's 3D outline. |
| 32 struct LayerShape { | 33 struct LayerShape { |
| 33 LayerShape() { } | 34 LayerShape(); |
| 34 LayerShape(float width, float height, const WebKit::WebTransformationMat
rix& drawTransform); | 35 LayerShape(float width, float height, const WebKit::WebTransformationMat
rix& drawTransform); |
| 35 | 36 |
| 36 float layerZFromProjectedPoint(const FloatPoint&) const; | 37 float layerZFromProjectedPoint(const FloatPoint&) const; |
| 37 | 38 |
| 38 FloatPoint3D layerNormal; | 39 FloatPoint3D layerNormal; |
| 39 FloatPoint3D transformOrigin; | 40 FloatPoint3D transformOrigin; |
| 40 FloatQuad projectedQuad; | 41 FloatQuad projectedQuad; |
| 41 FloatRect projectedBounds; | 42 FloatRect projectedBounds; |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 enum ABCompareResult { | 45 enum ABCompareResult { |
| 45 ABeforeB, | 46 ABeforeB, |
| 46 BBeforeA, | 47 BBeforeA, |
| 47 None | 48 None |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 static ABCompareResult checkOverlap(LayerShape*, LayerShape*, float zThresho
ld, float& weight); | 51 static ABCompareResult checkOverlap(LayerShape*, LayerShape*, float zThresho
ld, float& weight); |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 struct GraphEdge; | 54 struct GraphEdge; |
| 54 | 55 |
| 55 struct GraphNode { | 56 struct GraphNode { |
| 56 explicit GraphNode(CCLayerImpl* cclayer) : layer(cclayer), incomingEdgeW
eight(0) { } | 57 explicit GraphNode(CCLayerImpl* cclayer); |
| 58 ~GraphNode(); |
| 57 | 59 |
| 58 CCLayerImpl* layer; | 60 CCLayerImpl* layer; |
| 59 LayerShape shape; | 61 LayerShape shape; |
| 60 Vector<GraphEdge*> incoming; | 62 Vector<GraphEdge*> incoming; |
| 61 Vector<GraphEdge*> outgoing; | 63 Vector<GraphEdge*> outgoing; |
| 62 float incomingEdgeWeight; | 64 float incomingEdgeWeight; |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 struct GraphEdge { | 67 struct GraphEdge { |
| 66 GraphEdge(GraphNode* fromNode, GraphNode* toNode, float weight) : from(f
romNode), to(toNode), weight(weight) { }; | 68 GraphEdge(GraphNode* fromNode, GraphNode* toNode, float weight) : from(f
romNode), to(toNode), weight(weight) { }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 typedef HashMap<GraphEdge*, GraphEdge*> EdgeMap; | 81 typedef HashMap<GraphEdge*, GraphEdge*> EdgeMap; |
| 80 EdgeMap m_activeEdges; | 82 EdgeMap m_activeEdges; |
| 81 | 83 |
| 82 void createGraphNodes(LayerList::iterator first, LayerList::iterator last); | 84 void createGraphNodes(LayerList::iterator first, LayerList::iterator last); |
| 83 void createGraphEdges(); | 85 void createGraphEdges(); |
| 84 void removeEdgeFromList(GraphEdge*, Vector<GraphEdge*>&); | 86 void removeEdgeFromList(GraphEdge*, Vector<GraphEdge*>&); |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 } | 89 } |
| 88 #endif | 90 #endif |
| OLD | NEW |