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 TransformDisplayItem_h | 5 #ifndef TransformDisplayItem_h |
6 #define TransformDisplayItem_h | 6 #define TransformDisplayItem_h |
7 | 7 |
8 #include "platform/graphics/paint/DisplayItem.h" | 8 #include "platform/graphics/paint/DisplayItem.h" |
9 #include "platform/transforms/AffineTransform.h" | 9 #include "platform/transforms/AffineTransform.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class PLATFORM_EXPORT BeginTransformDisplayItem final | 13 class PLATFORM_EXPORT BeginTransformDisplayItem final |
14 : public PairedBeginDisplayItem { | 14 : public PairedBeginDisplayItem { |
15 public: | 15 public: |
16 BeginTransformDisplayItem(const DisplayItemClient& client, | 16 BeginTransformDisplayItem(const DisplayItemClient& client, |
17 const AffineTransform& transform) | 17 const AffineTransform& transform) |
18 : PairedBeginDisplayItem(client, kBeginTransform, sizeof(*this)), | 18 : PairedBeginDisplayItem(client, kBeginTransform, sizeof(*this)), |
19 transform_(transform) {} | 19 transform_(transform) {} |
20 | 20 |
21 void Replay(GraphicsContext&) const override; | 21 void Replay(GraphicsContext&) const override; |
22 void AppendToWebDisplayItemList(const IntRect&, | 22 void AppendToWebDisplayItemList(const LayoutSize&, |
23 WebDisplayItemList*) const override; | 23 WebDisplayItemList*) const override; |
24 | 24 |
25 const AffineTransform& Transform() const { return transform_; } | 25 const AffineTransform& Transform() const { return transform_; } |
26 | 26 |
27 private: | 27 private: |
28 #ifndef NDEBUG | 28 #ifndef NDEBUG |
29 void DumpPropertiesAsDebugString(WTF::StringBuilder&) const final; | 29 void DumpPropertiesAsDebugString(WTF::StringBuilder&) const final; |
30 #endif | 30 #endif |
31 bool Equals(const DisplayItem& other) const final { | 31 bool Equals(const DisplayItem& other) const final { |
32 return DisplayItem::Equals(other) && | 32 return DisplayItem::Equals(other) && |
33 transform_ == | 33 transform_ == |
34 static_cast<const BeginTransformDisplayItem&>(other).transform_; | 34 static_cast<const BeginTransformDisplayItem&>(other).transform_; |
35 } | 35 } |
36 | 36 |
37 const AffineTransform transform_; | 37 const AffineTransform transform_; |
38 }; | 38 }; |
39 | 39 |
40 class PLATFORM_EXPORT EndTransformDisplayItem final | 40 class PLATFORM_EXPORT EndTransformDisplayItem final |
41 : public PairedEndDisplayItem { | 41 : public PairedEndDisplayItem { |
42 public: | 42 public: |
43 EndTransformDisplayItem(const DisplayItemClient& client) | 43 EndTransformDisplayItem(const DisplayItemClient& client) |
44 : PairedEndDisplayItem(client, kEndTransform, sizeof(*this)) {} | 44 : PairedEndDisplayItem(client, kEndTransform, sizeof(*this)) {} |
45 | 45 |
46 void Replay(GraphicsContext&) const override; | 46 void Replay(GraphicsContext&) const override; |
47 void AppendToWebDisplayItemList(const IntRect&, | 47 void AppendToWebDisplayItemList(const LayoutSize&, |
48 WebDisplayItemList*) const override; | 48 WebDisplayItemList*) const override; |
49 | 49 |
50 private: | 50 private: |
51 #if DCHECK_IS_ON() | 51 #if DCHECK_IS_ON() |
52 bool IsEndAndPairedWith(DisplayItem::Type other_type) const final { | 52 bool IsEndAndPairedWith(DisplayItem::Type other_type) const final { |
53 return other_type == kBeginTransform; | 53 return other_type == kBeginTransform; |
54 } | 54 } |
55 #endif | 55 #endif |
56 }; | 56 }; |
57 | 57 |
58 } // namespace blink | 58 } // namespace blink |
59 | 59 |
60 #endif // TransformDisplayItem_h | 60 #endif // TransformDisplayItem_h |
OLD | NEW |