| 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; |
| 40 | 34 |
| 41 private: | 35 private: |
| 42 #ifndef NDEBUG | 36 #ifndef NDEBUG |
| 43 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 37 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
| 44 #endif | 38 #endif |
| 45 const SkXfermode::Mode m_xferMode; | 39 const SkXfermode::Mode m_xferMode; |
| 46 const float m_opacity; | 40 const float m_opacity; |
| 47 bool m_hasBounds; | 41 bool m_hasBounds; |
| 48 FloatRect m_bounds; | 42 FloatRect m_bounds; |
| 49 ColorFilter m_colorFilter; | 43 ColorFilter m_colorFilter; |
| 50 }; | 44 }; |
| 51 | 45 |
| 52 class PLATFORM_EXPORT EndCompositingDisplayItem : public PairedEndDisplayItem { | 46 class PLATFORM_EXPORT EndCompositingDisplayItem : public PairedEndDisplayItem { |
| 53 WTF_MAKE_FAST_ALLOCATED(EndCompositingDisplayItem); | |
| 54 public: | 47 public: |
| 55 static PassOwnPtr<EndCompositingDisplayItem> create(const DisplayItemClientW
rapper& client) | |
| 56 { | |
| 57 return adoptPtr(new EndCompositingDisplayItem(client)); | |
| 58 } | |
| 59 | |
| 60 EndCompositingDisplayItem(const DisplayItemClientWrapper& client) | 48 EndCompositingDisplayItem(const DisplayItemClientWrapper& client) |
| 61 : PairedEndDisplayItem(client, EndCompositing) { } | 49 : PairedEndDisplayItem(client, EndCompositing) { } |
| 62 | 50 |
| 63 virtual void replay(GraphicsContext&) override; | 51 virtual void replay(GraphicsContext&) override; |
| 64 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 52 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 65 | 53 |
| 66 private: | 54 private: |
| 67 #if ENABLE(ASSERT) | 55 #if ENABLE(ASSERT) |
| 68 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return otherType == BeginCompositing; } | 56 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return otherType == BeginCompositing; } |
| 69 #endif | 57 #endif |
| 70 }; | 58 }; |
| 71 | 59 |
| 72 } // namespace blink | 60 } // namespace blink |
| 73 | 61 |
| 74 #endif // CompositingDisplayItem_h | 62 #endif // CompositingDisplayItem_h |
| OLD | NEW |