| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Transform3DDisplayItem_h | 5 #ifndef Transform3DDisplayItem_h |
| 6 #define Transform3DDisplayItem_h | 6 #define Transform3DDisplayItem_h |
| 7 | 7 |
| 8 #include "platform/geometry/FloatPoint3D.h" | 8 #include "platform/geometry/FloatPoint3D.h" |
| 9 #include "platform/graphics/paint/DisplayItem.h" | 9 #include "platform/graphics/paint/DisplayItem.h" |
| 10 #include "platform/transforms/TransformationMatrix.h" | 10 #include "platform/transforms/TransformationMatrix.h" |
| 11 #include "wtf/Assertions.h" | 11 #include "wtf/Assertions.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class PLATFORM_EXPORT BeginTransform3DDisplayItem final : public PairedBeginDisp
layItem { | 15 class PLATFORM_EXPORT BeginTransform3DDisplayItem final : public PairedBeginDisp
layItem<BeginTransform3DDisplayItem> { |
| 16 public: | 16 public: |
| 17 BeginTransform3DDisplayItem( | 17 BeginTransform3DDisplayItem( |
| 18 const DisplayItemClient& client, | 18 const DisplayItemClient& client, |
| 19 Type type, | 19 Type type, |
| 20 const TransformationMatrix& transform, | 20 const TransformationMatrix& transform, |
| 21 const FloatPoint3D& transformOrigin) | 21 const FloatPoint3D& transformOrigin) |
| 22 : PairedBeginDisplayItem(client, type, sizeof(*this)) | 22 : PairedBeginDisplayItem(client, type) |
| 23 , m_transform(transform) | 23 , m_transform(transform) |
| 24 , m_transformOrigin(transformOrigin) | 24 , m_transformOrigin(transformOrigin) |
| 25 { | 25 { |
| 26 ASSERT(DisplayItem::isTransform3DType(type)); | 26 ASSERT(DisplayItem::isTransform3DType(type)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void replay(GraphicsContext&) const override; | 29 void replay(GraphicsContext&) const override; |
| 30 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 30 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
| 31 | 31 |
| 32 const TransformationMatrix& transform() const { return m_transform; } | 32 const TransformationMatrix& transform() const { return m_transform; } |
| 33 const FloatPoint3D& transformOrigin() const { return m_transformOrigin; } | 33 const FloatPoint3D& transformOrigin() const { return m_transformOrigin; } |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 #ifndef NDEBUG | 36 #ifndef NDEBUG |
| 37 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const final; | 37 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const final; |
| 38 #endif | 38 #endif |
| 39 #if ENABLE(ASSERT) | 39 #if ENABLE(ASSERT) |
| 40 bool equals(const DisplayItem& other) const final | 40 bool equals(const DisplayItem& other) const final |
| 41 { | 41 { |
| 42 return DisplayItem::equals(other) | 42 return DisplayItem::equals(other) |
| 43 && m_transform == static_cast<const BeginTransform3DDisplayItem&>(ot
her).m_transform | 43 && m_transform == static_cast<const BeginTransform3DDisplayItem&>(ot
her).m_transform |
| 44 && m_transformOrigin == static_cast<const BeginTransform3DDisplayIte
m&>(other).m_transformOrigin; | 44 && m_transformOrigin == static_cast<const BeginTransform3DDisplayIte
m&>(other).m_transformOrigin; |
| 45 } | 45 } |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 const TransformationMatrix m_transform; | 48 const TransformationMatrix m_transform; |
| 49 const FloatPoint3D m_transformOrigin; | 49 const FloatPoint3D m_transformOrigin; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 class PLATFORM_EXPORT EndTransform3DDisplayItem final : public PairedEndDisplayI
tem { | 52 class PLATFORM_EXPORT EndTransform3DDisplayItem final : public PairedEndDisplayI
tem<EndTransform3DDisplayItem> { |
| 53 public: | 53 public: |
| 54 EndTransform3DDisplayItem(const DisplayItemClient& client, Type type) | 54 EndTransform3DDisplayItem(const DisplayItemClient& client, Type type) |
| 55 : PairedEndDisplayItem(client, type, sizeof(*this)) | 55 : PairedEndDisplayItem(client, type) |
| 56 { | 56 { |
| 57 ASSERT(DisplayItem::isEndTransform3DType(type)); | 57 ASSERT(DisplayItem::isEndTransform3DType(type)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void replay(GraphicsContext&) const override; | 60 void replay(GraphicsContext&) const override; |
| 61 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 61 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 #if ENABLE(ASSERT) | 64 #if ENABLE(ASSERT) |
| 65 bool isEndAndPairedWith(DisplayItem::Type otherType) const final | 65 bool isEndAndPairedWith(DisplayItem::Type otherType) const final |
| 66 { | 66 { |
| 67 return DisplayItem::transform3DTypeToEndTransform3DType(otherType) == ge
tType(); | 67 return DisplayItem::transform3DTypeToEndTransform3DType(otherType) == ge
tType(); |
| 68 } | 68 } |
| 69 #endif | 69 #endif |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace blink | 72 } // namespace blink |
| 73 | 73 |
| 74 #endif // Transform3DDisplayItem_h | 74 #endif // Transform3DDisplayItem_h |
| OLD | NEW |