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 FilterDisplayItem_h | 5 #ifndef FilterDisplayItem_h |
6 #define FilterDisplayItem_h | 6 #define FilterDisplayItem_h |
7 | 7 |
8 #include "platform/geometry/FloatRect.h" | 8 #include "platform/geometry/FloatRect.h" |
9 #include "platform/graphics/CompositorFilterOperations.h" | 9 #include "platform/graphics/CompositorFilterOperations.h" |
10 #include "platform/graphics/paint/DisplayItem.h" | 10 #include "platform/graphics/paint/DisplayItem.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 void replay(GraphicsContext&) const override; | 33 void replay(GraphicsContext&) const override; |
34 void appendToWebDisplayItemList(const IntRect&, | 34 void appendToWebDisplayItemList(const IntRect&, |
35 WebDisplayItemList*) const override; | 35 WebDisplayItemList*) const override; |
36 bool drawsContent() const override; | 36 bool drawsContent() const override; |
37 | 37 |
38 private: | 38 private: |
39 #ifndef NDEBUG | 39 #ifndef NDEBUG |
40 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; | 40 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; |
41 #endif | 41 #endif |
42 bool equals(const DisplayItem& other) const final { | 42 bool equals(const DisplayItem& other) const final { |
43 return DisplayItem::equals(other) | 43 // TODO(wangxianzhu): compare m_imageFilter and m_webFilterOperations. |
44 // TODO(wangxianzhu): compare m_imageFilter and m_webFilterOperations
. | 44 const auto& other_display_item = |
45 && | 45 static_cast<const BeginFilterDisplayItem&>(other); |
46 m_bounds == | 46 return DisplayItem::equals(other) && |
47 static_cast<const BeginFilterDisplayItem&>(other).m_bounds && | 47 m_bounds == other_display_item.m_bounds && |
48 m_origin == | 48 m_origin == other_display_item.m_origin; |
49 static_cast<const BeginFilterDisplayItem&>(other).m_origin; | |
50 } | 49 } |
51 | 50 |
52 // FIXME: m_imageFilter should be replaced with m_webFilterOperations when cop
ying data to the compositor. | 51 // FIXME: m_imageFilter should be replaced with m_webFilterOperations when |
| 52 // copying data to the compositor. |
53 sk_sp<SkImageFilter> m_imageFilter; | 53 sk_sp<SkImageFilter> m_imageFilter; |
54 CompositorFilterOperations m_compositorFilterOperations; | 54 CompositorFilterOperations m_compositorFilterOperations; |
55 const FloatRect m_bounds; | 55 const FloatRect m_bounds; |
56 const FloatPoint m_origin; | 56 const FloatPoint m_origin; |
57 }; | 57 }; |
58 | 58 |
59 class PLATFORM_EXPORT EndFilterDisplayItem final : public PairedEndDisplayItem { | 59 class PLATFORM_EXPORT EndFilterDisplayItem final : public PairedEndDisplayItem { |
60 public: | 60 public: |
61 EndFilterDisplayItem(const DisplayItemClient& client) | 61 EndFilterDisplayItem(const DisplayItemClient& client) |
62 : PairedEndDisplayItem(client, kEndFilter, sizeof(*this)) {} | 62 : PairedEndDisplayItem(client, kEndFilter, sizeof(*this)) {} |
63 | 63 |
64 void replay(GraphicsContext&) const override; | 64 void replay(GraphicsContext&) const override; |
65 void appendToWebDisplayItemList(const IntRect&, | 65 void appendToWebDisplayItemList(const IntRect&, |
66 WebDisplayItemList*) const override; | 66 WebDisplayItemList*) const override; |
67 | 67 |
68 private: | 68 private: |
69 #if ENABLE(ASSERT) | 69 #if ENABLE(ASSERT) |
70 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { | 70 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { |
71 return otherType == kBeginFilter; | 71 return otherType == kBeginFilter; |
72 } | 72 } |
73 #endif | 73 #endif |
74 }; | 74 }; |
75 | 75 |
76 } // namespace blink | 76 } // namespace blink |
77 | 77 |
78 #endif // FilterDisplayItem_h | 78 #endif // FilterDisplayItem_h |
OLD | NEW |