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