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 CompositingDisplayItem_h | 5 #ifndef CompositingDisplayItem_h |
6 #define CompositingDisplayItem_h | 6 #define CompositingDisplayItem_h |
7 | 7 |
8 #include "platform/geometry/FloatRect.h" | 8 #include "platform/geometry/FloatRect.h" |
9 #include "platform/graphics/GraphicsTypes.h" | 9 #include "platform/graphics/GraphicsTypes.h" |
10 #include "platform/graphics/paint/DisplayItem.h" | 10 #include "platform/graphics/paint/DisplayItem.h" |
11 #include "public/platform/WebBlendMode.h" | 11 #include "public/platform/WebBlendMode.h" |
12 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.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 BeginCompositingDisplayItem : public PairedBeginDisplayIte
m { | 19 class PLATFORM_EXPORT BeginCompositingDisplayItem : public PairedBeginDisplayIte
m { |
20 WTF_MAKE_FAST_ALLOCATED(BeginCompositingDisplayItem); | |
21 public: | 20 public: |
22 static PassOwnPtr<BeginCompositingDisplayItem> create(const DisplayItemClien
tWrapper& client, const SkXfermode::Mode xferMode, const float opacity, const Fl
oatRect* bounds = nullptr, ColorFilter colorFilter = ColorFilterNone) | |
23 { | |
24 return adoptPtr(new BeginCompositingDisplayItem(client, xferMode, opacit
y, bounds, colorFilter)); | |
25 } | |
26 | |
27 BeginCompositingDisplayItem(const DisplayItemClientWrapper& client, const Sk
Xfermode::Mode xferMode, const float opacity, const FloatRect* bounds, ColorFilt
er colorFilter = ColorFilterNone) | 21 BeginCompositingDisplayItem(const DisplayItemClientWrapper& client, const Sk
Xfermode::Mode xferMode, const float opacity, const FloatRect* bounds, ColorFilt
er colorFilter = ColorFilterNone) |
28 : PairedBeginDisplayItem(client, BeginCompositing) | 22 : PairedBeginDisplayItem(client, BeginCompositing) |
29 , m_xferMode(xferMode) | 23 , m_xferMode(xferMode) |
30 , m_opacity(opacity) | 24 , m_opacity(opacity) |
31 , m_hasBounds(bounds) | 25 , m_hasBounds(bounds) |
32 , m_colorFilter(colorFilter) | 26 , m_colorFilter(colorFilter) |
33 { | 27 { |
34 if (bounds) | 28 if (bounds) |
35 m_bounds = FloatRect(*bounds); | 29 m_bounds = FloatRect(*bounds); |
36 } | 30 } |
37 | 31 |
38 virtual void replay(GraphicsContext&) override; | 32 virtual void replay(GraphicsContext&) override; |
39 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 33 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 34 void appendByMoving(DisplayItems&) override; |
40 | 35 |
41 private: | 36 private: |
42 #ifndef NDEBUG | 37 #ifndef NDEBUG |
43 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 38 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
44 #endif | 39 #endif |
45 const SkXfermode::Mode m_xferMode; | 40 const SkXfermode::Mode m_xferMode; |
46 const float m_opacity; | 41 const float m_opacity; |
47 bool m_hasBounds; | 42 bool m_hasBounds; |
48 FloatRect m_bounds; | 43 FloatRect m_bounds; |
49 ColorFilter m_colorFilter; | 44 ColorFilter m_colorFilter; |
50 }; | 45 }; |
51 | 46 |
52 class PLATFORM_EXPORT EndCompositingDisplayItem : public PairedEndDisplayItem { | 47 class PLATFORM_EXPORT EndCompositingDisplayItem : public PairedEndDisplayItem { |
53 WTF_MAKE_FAST_ALLOCATED(EndCompositingDisplayItem); | |
54 public: | 48 public: |
55 static PassOwnPtr<EndCompositingDisplayItem> create(const DisplayItemClientW
rapper& client) | |
56 { | |
57 return adoptPtr(new EndCompositingDisplayItem(client)); | |
58 } | |
59 | |
60 EndCompositingDisplayItem(const DisplayItemClientWrapper& client) | 49 EndCompositingDisplayItem(const DisplayItemClientWrapper& client) |
61 : PairedEndDisplayItem(client, EndCompositing) { } | 50 : PairedEndDisplayItem(client, EndCompositing) { } |
62 | 51 |
63 virtual void replay(GraphicsContext&) override; | 52 virtual void replay(GraphicsContext&) override; |
64 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 53 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 54 void appendByMoving(DisplayItems&) override; |
65 | 55 |
66 private: | 56 private: |
67 #if ENABLE(ASSERT) | 57 #if ENABLE(ASSERT) |
68 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return otherType == BeginCompositing; } | 58 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return otherType == BeginCompositing; } |
69 #endif | 59 #endif |
70 }; | 60 }; |
71 | 61 |
72 } // namespace blink | 62 } // namespace blink |
73 | 63 |
74 #endif // CompositingDisplayItem_h | 64 #endif // CompositingDisplayItem_h |
OLD | NEW |