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 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class PLATFORM_EXPORT BeginClipPathDisplayItem final : public PairedBeginDisplay
Item { | 15 class PLATFORM_EXPORT BeginClipPathDisplayItem final : public PairedBeginDisplay
Item { |
16 public: | 16 public: |
17 BeginClipPathDisplayItem(const DisplayItemClient& client, const Path& clipPa
th) | 17 BeginClipPathDisplayItem(const DisplayItemClient& client, const Path& clipPa
th) |
18 : PairedBeginDisplayItem(client, kBeginClipPath, sizeof(*this)) | 18 : PairedBeginDisplayItem(client, kBeginClipPath, sizeof(*this)) |
19 , m_clipPath(clipPath.getSkPath()) { } | 19 , m_clipPath(clipPath.getSkPath()) { } |
20 | 20 |
21 void replay(GraphicsContext&) const override; | 21 void replay(GraphicsContext&) const override; |
22 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 22 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
23 | 23 |
24 void analyzeForGpuRasterization(SkPictureGpuAnalyzer&) const override; | 24 void analyzeForGpuRasterization(SkPictureGpuAnalyzer&) const override; |
25 | 25 |
26 private: | 26 private: |
27 const SkPath m_clipPath; | |
28 #ifndef NDEBUG | 27 #ifndef NDEBUG |
29 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; | 28 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; |
30 #endif | 29 #endif |
31 #if ENABLE(ASSERT) | |
32 bool equals(const DisplayItem& other) const final | 30 bool equals(const DisplayItem& other) const final |
33 { | 31 { |
34 return DisplayItem::equals(other) | 32 return DisplayItem::equals(other) |
35 && m_clipPath == static_cast<const BeginClipPathDisplayItem&>(other)
.m_clipPath; | 33 && m_clipPath == static_cast<const BeginClipPathDisplayItem&>(other)
.m_clipPath; |
36 } | 34 } |
37 #endif | 35 |
| 36 const SkPath m_clipPath; |
38 }; | 37 }; |
39 | 38 |
40 class PLATFORM_EXPORT EndClipPathDisplayItem final : public PairedEndDisplayItem
{ | 39 class PLATFORM_EXPORT EndClipPathDisplayItem final : public PairedEndDisplayItem
{ |
41 public: | 40 public: |
42 EndClipPathDisplayItem(const DisplayItemClient& client) | 41 EndClipPathDisplayItem(const DisplayItemClient& client) |
43 : PairedEndDisplayItem(client, kEndClipPath, sizeof(*this)) { } | 42 : PairedEndDisplayItem(client, kEndClipPath, sizeof(*this)) { } |
44 | 43 |
45 void replay(GraphicsContext&) const override; | 44 void replay(GraphicsContext&) const override; |
46 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 45 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
47 | 46 |
48 private: | 47 private: |
49 #if ENABLE(ASSERT) | 48 #if ENABLE(ASSERT) |
50 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return ot
herType == kBeginClipPath; } | 49 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return ot
herType == kBeginClipPath; } |
51 #endif | 50 #endif |
52 }; | 51 }; |
53 | 52 |
54 } // namespace blink | 53 } // namespace blink |
55 | 54 |
56 #endif // ClipPathDisplayItem_h | 55 #endif // ClipPathDisplayItem_h |
OLD | NEW |