| 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) | 21 void setNew(SkXfermode::Mode xferMode, float opacity, FloatRect* bounds = nu
llptr, ColorFilter colorFilter = ColorFilterNone) |
| 23 { | 22 { |
| 24 return adoptPtr(new BeginCompositingDisplayItem(client, xferMode, opacit
y, bounds, colorFilter)); | 23 m_xferMode = xferMode; |
| 24 m_opacity = opacity; |
| 25 m_hasBounds = !!bounds; |
| 26 if (bounds) |
| 27 m_bounds = FloatRect(*bounds); |
| 28 m_colorFilter = colorFilter; |
| 29 |
| 25 } | 30 } |
| 26 | 31 |
| 27 BeginCompositingDisplayItem(const DisplayItemClientWrapper& client, const Sk
Xfermode::Mode xferMode, const float opacity, const FloatRect* bounds, ColorFilt
er colorFilter = ColorFilterNone) | |
| 28 : PairedBeginDisplayItem(client, BeginCompositing) | |
| 29 , m_xferMode(xferMode) | |
| 30 , m_opacity(opacity) | |
| 31 , m_hasBounds(bounds) | |
| 32 , m_colorFilter(colorFilter) | |
| 33 { | |
| 34 if (bounds) | |
| 35 m_bounds = FloatRect(*bounds); | |
| 36 } | |
| 37 | |
| 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 SkXfermode::Mode m_xferMode; |
| 46 const float m_opacity; | 40 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) | |
| 61 : PairedEndDisplayItem(client, EndCompositing) { } | |
| 62 | |
| 63 virtual void replay(GraphicsContext&) override; | 48 virtual void replay(GraphicsContext&) override; |
| 64 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 49 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 65 | 50 |
| 66 private: | 51 private: |
| 67 #if ENABLE(ASSERT) | 52 #if ENABLE(ASSERT) |
| 68 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return otherType == BeginCompositing; } | 53 virtual bool isEndAndPairedWith(DisplayItem::Type otherType) const override
final { return otherType == BeginCompositing; } |
| 69 #endif | 54 #endif |
| 70 }; | 55 }; |
| 71 | 56 |
| 72 } // namespace blink | 57 } // namespace blink |
| 73 | 58 |
| 74 #endif // CompositingDisplayItem_h | 59 #endif // CompositingDisplayItem_h |
| OLD | NEW |