| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 ClipDisplayItem_h | 5 #ifndef ClipDisplayItem_h |
| 6 #define ClipDisplayItem_h | 6 #define ClipDisplayItem_h |
| 7 | 7 |
| 8 #include "SkRegion.h" | 8 #include "SkRegion.h" |
| 9 #include "platform/PlatformExport.h" | 9 #include "platform/PlatformExport.h" |
| 10 #include "platform/geometry/FloatRoundedRect.h" | 10 #include "platform/geometry/FloatRoundedRect.h" |
| 11 #include "platform/geometry/IntRect.h" | 11 #include "platform/geometry/IntRect.h" |
| 12 #include "platform/graphics/paint/DisplayItem.h" | 12 #include "platform/graphics/paint/DisplayItem.h" |
| 13 #include "wtf/Vector.h" | 13 #include "wtf/Vector.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class PLATFORM_EXPORT ClipDisplayItem final : public PairedBeginDisplayItem { | 17 class PLATFORM_EXPORT ClipDisplayItem final : public PairedBeginDisplayItem<Clip
DisplayItem> { |
| 18 public: | 18 public: |
| 19 ClipDisplayItem(const DisplayItemClient& client, Type type, const IntRect& c
lipRect) | 19 ClipDisplayItem(const DisplayItemClient& client, Type type, const IntRect& c
lipRect) |
| 20 : PairedBeginDisplayItem(client, type, sizeof(*this)) | 20 : PairedBeginDisplayItem(client, type) |
| 21 , m_clipRect(clipRect) | 21 , m_clipRect(clipRect) |
| 22 { | 22 { |
| 23 ASSERT(isClipType(type)); | 23 ASSERT(isClipType(type)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 ClipDisplayItem(const DisplayItemClient& client, Type type, const IntRect& c
lipRect, Vector<FloatRoundedRect>& roundedRectClips) | 26 ClipDisplayItem(const DisplayItemClient& client, Type type, const IntRect& c
lipRect, Vector<FloatRoundedRect>& roundedRectClips) |
| 27 : ClipDisplayItem(client, type, clipRect) | 27 : ClipDisplayItem(client, type, clipRect) |
| 28 { | 28 { |
| 29 m_roundedRectClips.swap(roundedRectClips); | 29 m_roundedRectClips.swap(roundedRectClips); |
| 30 } | 30 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 42 return DisplayItem::equals(other) | 42 return DisplayItem::equals(other) |
| 43 && m_clipRect == static_cast<const ClipDisplayItem&>(other).m_clipRe
ct | 43 && m_clipRect == static_cast<const ClipDisplayItem&>(other).m_clipRe
ct |
| 44 && m_roundedRectClips == static_cast<const ClipDisplayItem&>(other).
m_roundedRectClips; | 44 && m_roundedRectClips == static_cast<const ClipDisplayItem&>(other).
m_roundedRectClips; |
| 45 } | 45 } |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 const IntRect m_clipRect; | 48 const IntRect m_clipRect; |
| 49 Vector<FloatRoundedRect> m_roundedRectClips; | 49 Vector<FloatRoundedRect> m_roundedRectClips; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 class PLATFORM_EXPORT EndClipDisplayItem final : public PairedEndDisplayItem { | 52 class PLATFORM_EXPORT EndClipDisplayItem final : public PairedEndDisplayItem<End
ClipDisplayItem> { |
| 53 public: | 53 public: |
| 54 EndClipDisplayItem(const DisplayItemClient& client, Type type) | 54 EndClipDisplayItem(const DisplayItemClient& client, Type type) |
| 55 : PairedEndDisplayItem(client, type, sizeof(*this)) | 55 : PairedEndDisplayItem(client, type) |
| 56 { | 56 { |
| 57 ASSERT(isEndClipType(type)); | 57 ASSERT(isEndClipType(type)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void replay(GraphicsContext&) const override; | 60 void replay(GraphicsContext&) const override; |
| 61 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 61 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 #if ENABLE(ASSERT) | 64 #if ENABLE(ASSERT) |
| 65 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return Di
splayItem::isClipType(otherType); } | 65 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return Di
splayItem::isClipType(otherType); } |
| 66 #endif | 66 #endif |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace blink | 69 } // namespace blink |
| 70 | 70 |
| 71 #endif // ClipDisplayItem_h | 71 #endif // ClipDisplayItem_h |
| OLD | NEW |