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 TransparencyDisplayItem_h | 5 #ifndef TransparencyDisplayItem_h |
6 #define TransparencyDisplayItem_h | 6 #define TransparencyDisplayItem_h |
7 | 7 |
8 #include "platform/geometry/LayoutRect.h" | 8 #include "platform/geometry/LayoutRect.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 BeginTransparencyDisplayItem : public DisplayItem { | 19 class PLATFORM_EXPORT BeginTransparencyDisplayItem : public DisplayItem { |
20 public: | 20 public: |
21 static PassOwnPtr<BeginTransparencyDisplayItem> create(DisplayItemClient cli
ent, Type type, const CompositeOperator compositeOperator, const WebBlendMode& b
lendMode, const float opacity) { return adoptPtr(new BeginTransparencyDisplayIte
m(client, type, compositeOperator, blendMode, opacity)); } | 21 static PassOwnPtr<BeginTransparencyDisplayItem> create(DisplayItemClient cli
ent, Type type, const CompositeOperator compositeOperator, const WebBlendMode& b
lendMode, const float opacity) { return adoptPtr(new BeginTransparencyDisplayIte
m(client, type, compositeOperator, blendMode, opacity)); } |
22 | 22 |
23 virtual void replay(GraphicsContext*) override; | 23 virtual void replay(GraphicsContext*) override; |
24 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 24 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
25 | 25 |
26 private: | 26 private: |
27 #ifndef NDEBUG | 27 #ifndef NDEBUG |
| 28 virtual const char* name() const override { return "BeginTransparency"; } |
28 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 29 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
29 #endif | 30 #endif |
30 | 31 |
31 bool hasBlendMode() const { return m_blendMode != WebBlendModeNormal; } | 32 bool hasBlendMode() const { return m_blendMode != WebBlendModeNormal; } |
32 | 33 |
33 protected: | 34 protected: |
34 BeginTransparencyDisplayItem(DisplayItemClient client, Type type, const Comp
ositeOperator compositeOperator, const WebBlendMode& blendMode, const float opac
ity) | 35 BeginTransparencyDisplayItem(DisplayItemClient client, Type type, const Comp
ositeOperator compositeOperator, const WebBlendMode& blendMode, const float opac
ity) |
35 : DisplayItem(client, type) | 36 : DisplayItem(client, type) |
36 , m_compositeOperator(compositeOperator) | 37 , m_compositeOperator(compositeOperator) |
37 , m_blendMode(blendMode) | 38 , m_blendMode(blendMode) |
38 , m_opacity(opacity) { } | 39 , m_opacity(opacity) { } |
39 | 40 |
40 private: | 41 private: |
41 const CompositeOperator m_compositeOperator; | 42 const CompositeOperator m_compositeOperator; |
42 const WebBlendMode m_blendMode; | 43 const WebBlendMode m_blendMode; |
43 const float m_opacity; | 44 const float m_opacity; |
44 }; | 45 }; |
45 | 46 |
46 class PLATFORM_EXPORT EndTransparencyDisplayItem : public DisplayItem { | 47 class PLATFORM_EXPORT EndTransparencyDisplayItem : public DisplayItem { |
47 public: | 48 public: |
48 static PassOwnPtr<EndTransparencyDisplayItem> create(DisplayItemClient clien
t, Type type) { return adoptPtr(new EndTransparencyDisplayItem(client, type)); } | 49 static PassOwnPtr<EndTransparencyDisplayItem> create(DisplayItemClient clien
t, Type type) { return adoptPtr(new EndTransparencyDisplayItem(client, type)); } |
49 | 50 |
50 virtual void replay(GraphicsContext*) override; | 51 virtual void replay(GraphicsContext*) override; |
51 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 52 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
52 | 53 |
53 protected: | 54 protected: |
54 EndTransparencyDisplayItem(DisplayItemClient client, Type type) | 55 EndTransparencyDisplayItem(DisplayItemClient client, Type type) |
55 : DisplayItem(client, type) { } | 56 : DisplayItem(client, type) { } |
| 57 |
| 58 private: |
| 59 #ifndef NDEBUG |
| 60 virtual const char* name() const override { return "EndTransparency"; } |
| 61 #endif |
56 }; | 62 }; |
57 | 63 |
58 } // namespace blink | 64 } // namespace blink |
59 | 65 |
60 #endif // TransparencyDisplayItem_h | 66 #endif // TransparencyDisplayItem_h |
OLD | NEW |