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/graphics/paint/DisplayItem.h" | 8 #include "platform/graphics/paint/DisplayItem.h" |
9 #include "platform/transforms/TransformationMatrix.h" | 9 #include "platform/transforms/TransformationMatrix.h" |
| 10 #include "wtf/Assertions.h" |
10 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class PLATFORM_EXPORT BeginTransform3DDisplayItem : public PairedBeginDisplayIte
m { | 15 class PLATFORM_EXPORT BeginTransform3DDisplayItem : public PairedBeginDisplayIte
m { |
15 WTF_MAKE_FAST_ALLOCATED; | 16 WTF_MAKE_FAST_ALLOCATED; |
16 public: | 17 public: |
17 static PassOwnPtr<BeginTransform3DDisplayItem> create(DisplayItemClient clie
nt, const TransformationMatrix& transform) | 18 static PassOwnPtr<BeginTransform3DDisplayItem> create(DisplayItemClient clie
nt, DisplayItem::Type type, const TransformationMatrix& transform) |
18 { | 19 { |
19 return adoptPtr(new BeginTransform3DDisplayItem(client, transform)); | 20 return adoptPtr(new BeginTransform3DDisplayItem(client, type, transform)
); |
20 } | 21 } |
21 | 22 |
22 BeginTransform3DDisplayItem(DisplayItemClient client, const TransformationMa
trix& transform) | 23 BeginTransform3DDisplayItem(DisplayItemClient client, DisplayItem::Type type
, const TransformationMatrix& transform) |
23 : PairedBeginDisplayItem(client, BeginTransform3D) | 24 : PairedBeginDisplayItem(client, type) |
24 , m_transform(transform) { } | 25 , m_transform(transform) |
| 26 { |
| 27 ASSERT(DisplayItem::isTransform3DType(type)); |
| 28 } |
25 | 29 |
26 virtual void replay(GraphicsContext*) override; | 30 virtual void replay(GraphicsContext*) override; |
27 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 31 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
28 | 32 |
29 const TransformationMatrix& transform() const { return m_transform; } | 33 const TransformationMatrix& transform() const { return m_transform; } |
30 | 34 |
31 private: | 35 private: |
32 const TransformationMatrix m_transform; | 36 const TransformationMatrix m_transform; |
33 FloatPoint3D m_transformOrigin; | 37 FloatPoint3D m_transformOrigin; |
34 }; | 38 }; |
35 | 39 |
36 class PLATFORM_EXPORT EndTransform3DDisplayItem : public PairedEndDisplayItem { | 40 class PLATFORM_EXPORT EndTransform3DDisplayItem : public PairedEndDisplayItem { |
37 WTF_MAKE_FAST_ALLOCATED; | 41 WTF_MAKE_FAST_ALLOCATED; |
38 public: | 42 public: |
39 static PassOwnPtr<EndTransform3DDisplayItem> create(DisplayItemClient client
) | 43 static PassOwnPtr<EndTransform3DDisplayItem> create(DisplayItemClient client
, DisplayItem::Type type) |
40 { | 44 { |
41 return adoptPtr(new EndTransform3DDisplayItem(client)); | 45 return adoptPtr(new EndTransform3DDisplayItem(client, type)); |
42 } | 46 } |
43 | 47 |
44 EndTransform3DDisplayItem(DisplayItemClient client) | 48 EndTransform3DDisplayItem(DisplayItemClient client, DisplayItem::Type type) |
45 : PairedEndDisplayItem(client, EndTransform3D) { } | 49 : PairedEndDisplayItem(client, type) |
| 50 { |
| 51 ASSERT(DisplayItem::isEndTransform3DType(type)); |
| 52 } |
46 | 53 |
47 virtual void replay(GraphicsContext*) override; | 54 virtual void replay(GraphicsContext*) override; |
48 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 55 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
49 | 56 |
50 private: | 57 private: |
51 #if ENABLE(ASSERT) | 58 #if ENABLE(ASSERT) |
52 virtual bool isEndAndPairedWith(const DisplayItem& other) const override fin
al { return other.type() == BeginTransform3D; } | 59 virtual bool isEndAndPairedWith(const DisplayItem& other) const override fin
al |
| 60 { |
| 61 return DisplayItem::transform3DTypeToEndTransform3DType(other.type()) ==
type(); |
| 62 } |
53 #endif | 63 #endif |
54 }; | 64 }; |
55 | 65 |
56 } // namespace blink | 66 } // namespace blink |
57 | 67 |
58 #endif // Transform3DDisplayItem_h | 68 #endif // Transform3DDisplayItem_h |
OLD | NEW |