OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 ClipPathDisplayItem_h | 5 #ifndef ClipPathDisplayItem_h |
6 #define ClipPathDisplayItem_h | 6 #define ClipPathDisplayItem_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/graphics/Path.h" | 9 #include "platform/graphics/Path.h" |
10 #include "platform/graphics/paint/DisplayItem.h" | 10 #include "platform/graphics/paint/DisplayItem.h" |
11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class PLATFORM_EXPORT BeginClipPathDisplayItem : public DisplayItem { | 15 class PLATFORM_EXPORT BeginClipPathDisplayItem : public PairedBeginDisplayItem { |
16 WTF_MAKE_FAST_ALLOCATED; | 16 WTF_MAKE_FAST_ALLOCATED; |
17 public: | 17 public: |
18 static PassOwnPtr<BeginClipPathDisplayItem> create(DisplayItemClient client,
const Path& clipPath, WindRule windRule) | 18 static PassOwnPtr<BeginClipPathDisplayItem> create(DisplayItemClient client,
const Path& clipPath, WindRule windRule) |
19 { | 19 { |
20 return adoptPtr(new BeginClipPathDisplayItem(client, clipPath, windRule)
); | 20 return adoptPtr(new BeginClipPathDisplayItem(client, clipPath, windRule)
); |
21 } | 21 } |
22 | 22 |
23 BeginClipPathDisplayItem(DisplayItemClient client, const Path& clipPath, Win
dRule windRule) | 23 BeginClipPathDisplayItem(DisplayItemClient client, const Path& clipPath, Win
dRule windRule) |
24 : DisplayItem(client, BeginClipPath) | 24 : PairedBeginDisplayItem(client, BeginClipPath) |
25 , m_clipPath(clipPath) | 25 , m_clipPath(clipPath) |
26 , m_windRule(windRule) { } | 26 , m_windRule(windRule) { } |
27 | 27 |
28 virtual void replay(GraphicsContext*) override; | 28 virtual void replay(GraphicsContext*) override; |
29 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 29 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
30 | 30 |
31 private: | 31 private: |
32 const Path m_clipPath; | 32 const Path m_clipPath; |
33 const WindRule m_windRule; | 33 const WindRule m_windRule; |
34 #ifndef NDEBUG | 34 #ifndef NDEBUG |
35 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 35 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
36 #endif | 36 #endif |
37 }; | 37 }; |
38 | 38 |
39 class PLATFORM_EXPORT EndClipPathDisplayItem : public DisplayItem { | 39 class PLATFORM_EXPORT EndClipPathDisplayItem : public PairedEndDisplayItem { |
40 WTF_MAKE_FAST_ALLOCATED; | 40 WTF_MAKE_FAST_ALLOCATED; |
41 public: | 41 public: |
42 static PassOwnPtr<EndClipPathDisplayItem> create(DisplayItemClient client) | 42 static PassOwnPtr<EndClipPathDisplayItem> create(DisplayItemClient client) |
43 { | 43 { |
44 return adoptPtr(new EndClipPathDisplayItem(client)); | 44 return adoptPtr(new EndClipPathDisplayItem(client)); |
45 } | 45 } |
46 | 46 |
47 EndClipPathDisplayItem(DisplayItemClient client) | 47 EndClipPathDisplayItem(DisplayItemClient client) |
48 : DisplayItem(client, EndClipPath) { } | 48 : PairedEndDisplayItem(client, EndClipPath) { } |
49 | 49 |
50 virtual void replay(GraphicsContext*) override; | 50 virtual void replay(GraphicsContext*) override; |
51 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 51 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 52 |
| 53 private: |
| 54 #if ENABLE(ASSERT) |
| 55 virtual bool isEndAndPairedWith(const DisplayItem& other) const override fin
al { return other.type() == BeginClipPath; } |
| 56 #endif |
52 }; | 57 }; |
53 | 58 |
54 } // namespace blink | 59 } // namespace blink |
55 | 60 |
56 #endif // ClipPathDisplayItem_h | 61 #endif // ClipPathDisplayItem_h |
OLD | NEW |