Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / graphics / paint / TransformDisplayItem.h
blobe29248d97a11d092064e628a98f6348a81c519d6
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
3 // found in the LICENSE file.
5 #ifndef TransformDisplayItem_h
6 #define TransformDisplayItem_h
8 #include "platform/graphics/paint/DisplayItem.h"
9 #include "platform/transforms/AffineTransform.h"
10 #include "wtf/PassOwnPtr.h"
12 namespace blink {
14 class PLATFORM_EXPORT BeginTransformDisplayItem final : public PairedBeginDisplayItem {
15 public:
16 BeginTransformDisplayItem(const DisplayItemClientWrapper& client, const AffineTransform& transform)
17 : PairedBeginDisplayItem(client, BeginTransform, sizeof(*this))
18 , m_transform(transform) { }
20 void replay(GraphicsContext&) override;
21 void appendToWebDisplayItemList(WebDisplayItemList*) const override;
23 const AffineTransform& transform() const { return m_transform; }
25 private:
26 #ifndef NDEBUG
27 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const final;
28 #endif
29 #if ENABLE(ASSERT)
30 bool equals(const DisplayItem& other) const final
32 return DisplayItem::equals(other)
33 && m_transform == static_cast<const BeginTransformDisplayItem&>(other).m_transform;
35 #endif
37 const AffineTransform m_transform;
40 class PLATFORM_EXPORT EndTransformDisplayItem final : public PairedEndDisplayItem {
41 public:
42 EndTransformDisplayItem(const DisplayItemClientWrapper& client)
43 : PairedEndDisplayItem(client, EndTransform, sizeof(*this)) { }
45 void replay(GraphicsContext&) override;
46 void appendToWebDisplayItemList(WebDisplayItemList*) const override;
48 private:
49 #if ENABLE(ASSERT)
50 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return otherType == BeginTransform; }
51 #endif
54 } // namespace blink
56 #endif // TransformDisplayItem_h