| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 WebDisplayItemTransformTree_h | 5 #ifndef WebDisplayItemTransformTree_h |
| 6 #define WebDisplayItemTransformTree_h | 6 #define WebDisplayItemTransformTree_h |
| 7 | 7 |
| 8 #include "public/platform/WebCommon.h" | 8 #include "public/platform/WebCommon.h" |
| 9 #include "public/platform/WebFloatSize.h" | 9 #include "public/platform/WebFloatSize.h" |
| 10 #include "public/platform/WebPrivateOwnPtr.h" | 10 #include "public/platform/WebPrivateOwnPtr.h" |
| 11 #include "third_party/skia/include/core/SkPoint3.h" |
| 11 #include "third_party/skia/include/utils/SkMatrix44.h" | 12 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class DisplayItemTransformTree; | 16 class DisplayItemTransformTree; |
| 16 | 17 |
| 17 // Represents the hierarchy of transforms which apply to ranges of a display | 18 // Represents the hierarchy of transforms which apply to ranges of a display |
| 18 // item list and may be of interest to the compositor. | 19 // item list and may be of interest to the compositor. |
| 19 // | 20 // |
| 20 // It consists of a tree of "transform nodes", stored in a flattened | 21 // It consists of a tree of "transform nodes", stored in a flattened |
| 21 // representation in which their order is not guaranteed. Each node has a | 22 // representation in which their order is not guaranteed. Each node has a |
| 22 // parent, relative to whom its transform should be interpreted (i.e. the | 23 // parent, relative to whom its transform should be interpreted (i.e. the |
| 23 // total transform at a node is the product of its transform and its parent's | 24 // total transform at a node is the product of its transform and its parent's |
| 24 // total transform). | 25 // total transform). |
| 25 class BLINK_PLATFORM_EXPORT WebDisplayItemTransformTree { | 26 class BLINK_PLATFORM_EXPORT WebDisplayItemTransformTree { |
| 26 public: | 27 public: |
| 27 enum : size_t { kInvalidIndex = static_cast<size_t>(-1) }; | 28 enum : size_t { kInvalidIndex = static_cast<size_t>(-1) }; |
| 28 | 29 |
| 29 struct TransformNode { | 30 struct TransformNode { |
| 30 TransformNode(size_t parent, const SkMatrix44& matrix44) | 31 TransformNode(size_t parent, const SkMatrix44& matrix44, const SkPoint3&
origin) |
| 31 : parentNodeIndex(parent) | 32 : parentNodeIndex(parent) |
| 32 , matrix(matrix44) | 33 , matrix(matrix44) |
| 34 , transformOrigin(origin) |
| 33 { | 35 { |
| 34 } | 36 } |
| 35 | 37 |
| 36 bool isRoot() const { return parentNodeIndex == kInvalidIndex; } | 38 bool isRoot() const { return parentNodeIndex == kInvalidIndex; } |
| 37 | 39 |
| 38 // Index of parent in m_nodes (kInvalidIndex for root). | 40 // Index of parent in m_nodes (kInvalidIndex for root). |
| 39 size_t parentNodeIndex; | 41 size_t parentNodeIndex; |
| 40 | 42 |
| 41 // Transformation matrix of this node, relative to its parent. | 43 // Transformation matrix of this node, relative to its parent. |
| 42 SkMatrix44 matrix; | 44 SkMatrix44 matrix; |
| 45 |
| 46 // Origin of the transform given by |matrix|. |
| 47 SkPoint3 transformOrigin; |
| 43 }; | 48 }; |
| 44 | 49 |
| 45 WebDisplayItemTransformTree(); | 50 WebDisplayItemTransformTree(); |
| 46 #if INSIDE_BLINK | 51 #if INSIDE_BLINK |
| 47 WebDisplayItemTransformTree(const WTF::PassOwnPtr<DisplayItemTransformTree>&
); | 52 WebDisplayItemTransformTree(const WTF::PassOwnPtr<DisplayItemTransformTree>&
); |
| 48 #endif | 53 #endif |
| 49 | 54 |
| 50 ~WebDisplayItemTransformTree(); | 55 ~WebDisplayItemTransformTree(); |
| 51 | 56 |
| 52 // Returns the number of nodes in the transform tree. | 57 // Returns the number of nodes in the transform tree. |
| 53 size_t nodeCount() const; | 58 size_t nodeCount() const; |
| 54 | 59 |
| 55 // Returns a node in the transform tree by its index (from 0 to nodeCount()
- 1). | 60 // Returns a node in the transform tree by its index (from 0 to nodeCount()
- 1). |
| 56 const TransformNode& nodeAt(size_t index) const; | 61 const TransformNode& nodeAt(size_t index) const; |
| 57 | 62 |
| 58 private: | 63 private: |
| 59 WebPrivateOwnPtr<const DisplayItemTransformTree> m_private; | 64 WebPrivateOwnPtr<const DisplayItemTransformTree> m_private; |
| 60 }; | 65 }; |
| 61 | 66 |
| 62 } // namespace blink | 67 } // namespace blink |
| 63 | 68 |
| 64 #endif // WebDisplayItemTransformTree_h | 69 #endif // WebDisplayItemTransformTree_h |
| OLD | NEW |