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 "third_party/skia/include/core/SkPath.h" | 11 #include "third_party/skia/include/core/SkPath.h" |
12 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class PLATFORM_EXPORT BeginClipPathDisplayItem : public PairedBeginDisplayItem { | 16 class PLATFORM_EXPORT BeginClipPathDisplayItem : public PairedBeginDisplayItem { |
17 WTF_MAKE_FAST_ALLOCATED(BeginClipPathDisplayItem); | |
18 public: | 17 public: |
19 static PassOwnPtr<BeginClipPathDisplayItem> create(const DisplayItemClientWr
apper& client, const Path& clipPath) | |
20 { | |
21 return adoptPtr(new BeginClipPathDisplayItem(client, clipPath)); | |
22 } | |
23 | |
24 BeginClipPathDisplayItem(const DisplayItemClientWrapper& client, const Path&
clipPath) | 18 BeginClipPathDisplayItem(const DisplayItemClientWrapper& client, const Path&
clipPath) |
25 : PairedBeginDisplayItem(client, BeginClipPath) | 19 : PairedBeginDisplayItem(client, BeginClipPath) |
26 , m_clipPath(clipPath.skPath()) { } | 20 , m_clipPath(clipPath.skPath()) { } |
27 | 21 |
28 virtual void replay(GraphicsContext&) override; | 22 virtual void replay(GraphicsContext&) override; |
29 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 23 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
30 | 24 |
31 private: | 25 private: |
32 const SkPath m_clipPath; | 26 const SkPath m_clipPath; |
33 #ifndef NDEBUG | 27 #ifndef NDEBUG |
34 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 28 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
35 #endif | 29 #endif |
36 }; | 30 }; |
37 | 31 |
38 class PLATFORM_EXPORT EndClipPathDisplayItem : public PairedEndDisplayItem { | 32 class PLATFORM_EXPORT EndClipPathDisplayItem : public PairedEndDisplayItem { |
39 WTF_MAKE_FAST_ALLOCATED(EndClipPathDisplayItem); | |
40 public: | 33 public: |
41 static PassOwnPtr<EndClipPathDisplayItem> create(const DisplayItemClientWrap
per& client) | |
42 { | |
43 return adoptPtr(new EndClipPathDisplayItem(client)); | |
44 } | |
45 | |
46 EndClipPathDisplayItem(const DisplayItemClientWrapper& client) | 34 EndClipPathDisplayItem(const DisplayItemClientWrapper& client) |
47 : PairedEndDisplayItem(client, EndClipPath) { } | 35 : PairedEndDisplayItem(client, EndClipPath) { } |
48 | 36 |
49 virtual void replay(GraphicsContext&) override; | 37 virtual void replay(GraphicsContext&) override; |
50 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 38 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
51 | 39 |
52 private: | 40 private: |
53 #if ENABLE(ASSERT) | 41 #if ENABLE(ASSERT) |
54 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return otherType == BeginClipPath; } | 42 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return otherType == BeginClipPath; } |
55 #endif | 43 #endif |
56 }; | 44 }; |
57 | 45 |
58 } // namespace blink | 46 } // namespace blink |
59 | 47 |
60 #endif // ClipPathDisplayItem_h | 48 #endif // ClipPathDisplayItem_h |
OLD | NEW |