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"
14 class PLATFORM_EXPORT BeginTransformDisplayItem final
: public PairedBeginDisplayItem
{
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
; }
27 void dumpPropertiesAsDebugString(WTF::StringBuilder
&) const final
;
30 bool equals(const DisplayItem
& other
) const final
32 return DisplayItem::equals(other
)
33 && m_transform
== static_cast<const BeginTransformDisplayItem
&>(other
).m_transform
;
37 const AffineTransform m_transform
;
40 class PLATFORM_EXPORT EndTransformDisplayItem final
: public PairedEndDisplayItem
{
42 EndTransformDisplayItem(const DisplayItemClientWrapper
& client
)
43 : PairedEndDisplayItem(client
, EndTransform
, sizeof(*this)) { }
45 void replay(GraphicsContext
&) override
;
46 void appendToWebDisplayItemList(WebDisplayItemList
*) const override
;
50 bool isEndAndPairedWith(DisplayItem::Type otherType
) const final
{ return otherType
== BeginTransform
; }
56 #endif // TransformDisplayItem_h