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/paint/DisplayItem.h" | 10 #include "platform/graphics/paint/DisplayItem.h" |
10 #include "public/platform/WebFilterOperations.h" | |
11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
12 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
13 #ifndef NDEBUG | 13 #ifndef NDEBUG |
14 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
15 #endif | 15 #endif |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 class PLATFORM_EXPORT BeginFilterDisplayItem final : public PairedBeginDisplayIt
em { | 19 class PLATFORM_EXPORT BeginFilterDisplayItem final : public PairedBeginDisplayIt
em { |
20 public: | 20 public: |
21 BeginFilterDisplayItem(const DisplayItemClient& client, PassRefPtr<SkImageFi
lter> imageFilter, const FloatRect& bounds, PassOwnPtr<WebFilterOperations> filt
erOperations = nullptr) | 21 BeginFilterDisplayItem(const DisplayItemClient& client, PassRefPtr<SkImageFi
lter> imageFilter, const FloatRect& bounds, PassOwnPtr<CompositorFilterOperation
s> filterOperations = nullptr) |
22 : PairedBeginDisplayItem(client, BeginFilter, sizeof(*this)) | 22 : PairedBeginDisplayItem(client, BeginFilter, sizeof(*this)) |
23 , m_imageFilter(imageFilter) | 23 , m_imageFilter(imageFilter) |
24 , m_webFilterOperations(std::move(filterOperations)) | 24 , m_webFilterOperations(std::move(filterOperations)) |
25 , m_bounds(bounds) { } | 25 , m_bounds(bounds) { } |
26 | 26 |
27 void replay(GraphicsContext&) const override; | 27 void replay(GraphicsContext&) const override; |
28 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 28 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
29 bool drawsContent() const override; | 29 bool drawsContent() const override; |
30 | 30 |
31 private: | 31 private: |
32 #ifndef NDEBUG | 32 #ifndef NDEBUG |
33 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; | 33 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; |
34 #endif | 34 #endif |
35 #if ENABLE(ASSERT) | 35 #if ENABLE(ASSERT) |
36 bool equals(const DisplayItem& other) const final | 36 bool equals(const DisplayItem& other) const final |
37 { | 37 { |
38 return DisplayItem::equals(other) | 38 return DisplayItem::equals(other) |
39 // TODO(wangxianzhu): compare m_imageFilter and m_webFilterOperation
s. | 39 // TODO(wangxianzhu): compare m_imageFilter and m_webFilterOperation
s. |
40 && m_bounds == static_cast<const BeginFilterDisplayItem&>(other).m_b
ounds; | 40 && m_bounds == static_cast<const BeginFilterDisplayItem&>(other).m_b
ounds; |
41 } | 41 } |
42 #endif | 42 #endif |
43 | 43 |
44 // FIXME: m_imageFilter should be replaced with m_webFilterOperations when c
opying data to the compositor. | 44 // FIXME: m_imageFilter should be replaced with m_webFilterOperations when c
opying data to the compositor. |
45 RefPtr<SkImageFilter> m_imageFilter; | 45 RefPtr<SkImageFilter> m_imageFilter; |
46 OwnPtr<WebFilterOperations> m_webFilterOperations; | 46 OwnPtr<CompositorFilterOperations> m_webFilterOperations; |
47 const FloatRect m_bounds; | 47 const FloatRect m_bounds; |
48 }; | 48 }; |
49 | 49 |
50 class PLATFORM_EXPORT EndFilterDisplayItem final : public PairedEndDisplayItem { | 50 class PLATFORM_EXPORT EndFilterDisplayItem final : public PairedEndDisplayItem { |
51 public: | 51 public: |
52 EndFilterDisplayItem(const DisplayItemClient& client) | 52 EndFilterDisplayItem(const DisplayItemClient& client) |
53 : PairedEndDisplayItem(client, EndFilter, sizeof(*this)) { } | 53 : PairedEndDisplayItem(client, EndFilter, sizeof(*this)) { } |
54 | 54 |
55 void replay(GraphicsContext&) const override; | 55 void replay(GraphicsContext&) const override; |
56 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 56 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
57 | 57 |
58 private: | 58 private: |
59 #if ENABLE(ASSERT) | 59 #if ENABLE(ASSERT) |
60 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return ot
herType == BeginFilter; } | 60 bool isEndAndPairedWith(DisplayItem::Type otherType) const final { return ot
herType == BeginFilter; } |
61 #endif | 61 #endif |
62 }; | 62 }; |
63 | 63 |
64 } // namespace blink | 64 } // namespace blink |
65 | 65 |
66 #endif // FilterDisplayItem_h | 66 #endif // FilterDisplayItem_h |
OLD | NEW |