| 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/IntRect.h" | 11 #include "platform/geometry/IntRect.h" |
| 11 #include "platform/graphics/paint/DisplayItem.h" | 12 #include "platform/graphics/paint/DisplayItem.h" |
| 12 #include "wtf/PassOwnPtr.h" | 13 #include "wtf/PassOwnPtr.h" |
| 13 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class RoundedRect; | |
| 18 | |
| 19 class PLATFORM_EXPORT ClipDisplayItem : public DisplayItem { | 18 class PLATFORM_EXPORT ClipDisplayItem : public DisplayItem { |
| 20 public: | 19 public: |
| 21 static PassOwnPtr<ClipDisplayItem> create(DisplayItemClient client, Type typ
e, const IntRect& clipRect, SkRegion::Op operation = SkRegion::kIntersect_Op) | 20 static PassOwnPtr<ClipDisplayItem> create(DisplayItemClient client, Type typ
e, const IntRect& clipRect, SkRegion::Op operation = SkRegion::kIntersect_Op) |
| 22 { | 21 { |
| 23 return adoptPtr(new ClipDisplayItem(client, type, clipRect, operation)); | 22 return adoptPtr(new ClipDisplayItem(client, type, clipRect, operation)); |
| 24 } | 23 } |
| 25 | 24 |
| 26 virtual void replay(GraphicsContext*) override; | 25 virtual void replay(GraphicsContext*) override; |
| 27 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 26 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 28 | 27 |
| 29 Vector<RoundedRect>& roundedRectClips() { return m_roundedRectClips; } | 28 Vector<FloatRoundedRect>& roundedRectClips() { return m_roundedRectClips; } |
| 30 | 29 |
| 31 protected: | 30 protected: |
| 32 ClipDisplayItem(DisplayItemClient client, Type type, const IntRect& clipRect
, SkRegion::Op operation) | 31 ClipDisplayItem(DisplayItemClient client, Type type, const IntRect& clipRect
, SkRegion::Op operation) |
| 33 : DisplayItem(client, type), m_clipRect(clipRect), m_operation(operation
) { } | 32 : DisplayItem(client, type), m_clipRect(clipRect), m_operation(operation
) { } |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 #ifndef NDEBUG | 35 #ifndef NDEBUG |
| 37 virtual const char* name() const override { return "Clip"; } | 36 virtual const char* name() const override { return "Clip"; } |
| 38 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 37 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
| 39 #endif | 38 #endif |
| 40 IntRect m_clipRect; | 39 IntRect m_clipRect; |
| 41 Vector<RoundedRect> m_roundedRectClips; | 40 Vector<FloatRoundedRect> m_roundedRectClips; |
| 42 SkRegion::Op m_operation; | 41 SkRegion::Op m_operation; |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 class PLATFORM_EXPORT EndClipDisplayItem : public DisplayItem { | 44 class PLATFORM_EXPORT EndClipDisplayItem : public DisplayItem { |
| 46 public: | 45 public: |
| 47 static PassOwnPtr<EndClipDisplayItem> create(DisplayItemClient client) { ret
urn adoptPtr(new EndClipDisplayItem(client)); } | 46 static PassOwnPtr<EndClipDisplayItem> create(DisplayItemClient client) { ret
urn adoptPtr(new EndClipDisplayItem(client)); } |
| 48 | 47 |
| 49 virtual void replay(GraphicsContext*) override; | 48 virtual void replay(GraphicsContext*) override; |
| 50 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 49 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 51 | 50 |
| 52 protected: | 51 protected: |
| 53 EndClipDisplayItem(DisplayItemClient client) : DisplayItem(client, EndClip)
{ } | 52 EndClipDisplayItem(DisplayItemClient client) : DisplayItem(client, EndClip)
{ } |
| 54 | 53 |
| 55 private: | 54 private: |
| 56 #ifndef NDEBUG | 55 #ifndef NDEBUG |
| 57 virtual const char* name() const override { return "EndClip"; } | 56 virtual const char* name() const override { return "EndClip"; } |
| 58 #endif | 57 #endif |
| 59 }; | 58 }; |
| 60 | 59 |
| 61 } // namespace blink | 60 } // namespace blink |
| 62 | 61 |
| 63 #endif // ClipDisplayItem_h | 62 #endif // ClipDisplayItem_h |
| OLD | NEW |