| 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 "core/paint/ViewDisplayList.h" | 8 #include "core/paint/ViewDisplayList.h" |
| 9 #include "platform/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
| 10 #include "public/platform/WebBlendMode.h" | 10 #include "public/platform/WebBlendMode.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 // FIXME: Move this file to TransparencyRecorder | |
| 15 | |
| 16 class BeginTransparencyDisplayItem : public DisplayItem { | 14 class BeginTransparencyDisplayItem : public DisplayItem { |
| 17 public: | 15 public: |
| 18 BeginTransparencyDisplayItem(const RenderObject* renderer, Type type, const
WebBlendMode& blendMode, const float opacity) | 16 BeginTransparencyDisplayItem(const RenderObject* renderer, Type type, const
LayoutRect& clipRect, const WebBlendMode& blendMode, const float opacity) |
| 19 : DisplayItem(renderer, type) | 17 : DisplayItem(renderer, type) |
| 18 , m_clipRect(clipRect) |
| 20 , m_blendMode(blendMode) | 19 , m_blendMode(blendMode) |
| 21 , m_opacity(opacity) { } | 20 , m_opacity(opacity) { } |
| 22 virtual void replay(GraphicsContext*) override; | 21 virtual void replay(GraphicsContext*) override; |
| 23 | 22 |
| 24 private: | 23 private: |
| 25 #ifndef NDEBUG | 24 #ifndef NDEBUG |
| 26 virtual WTF::String asDebugString() const override; | 25 virtual WTF::String asDebugString() const override; |
| 27 #endif | 26 #endif |
| 28 | 27 |
| 29 bool hasBlendMode() const { return m_blendMode != WebBlendModeNormal; } | 28 bool hasBlendMode() const { return m_blendMode != WebBlendModeNormal; } |
| 30 | 29 |
| 30 const LayoutRect m_clipRect; |
| 31 const WebBlendMode m_blendMode; | 31 const WebBlendMode m_blendMode; |
| 32 const float m_opacity; | 32 const float m_opacity; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class EndTransparencyDisplayItem : public DisplayItem { | 35 class EndTransparencyDisplayItem : public DisplayItem { |
| 36 public: | 36 public: |
| 37 EndTransparencyDisplayItem(const RenderObject* renderer, Type type) | 37 EndTransparencyDisplayItem(const RenderObject* renderer, Type type) |
| 38 : DisplayItem(renderer, type) { } | 38 : DisplayItem(renderer, type) { } |
| 39 virtual void replay(GraphicsContext*) override; | 39 virtual void replay(GraphicsContext*) override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 #ifndef NDEBUG | 42 #ifndef NDEBUG |
| 43 virtual WTF::String asDebugString() const override; | 43 virtual WTF::String asDebugString() const override; |
| 44 #endif | 44 #endif |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class TransparencyRecorder { | |
| 48 public: | |
| 49 explicit TransparencyRecorder(GraphicsContext*, const RenderObject*, Display
Item::Type, const WebBlendMode&, const float opacity); | |
| 50 | |
| 51 ~TransparencyRecorder(); | |
| 52 | |
| 53 private: | |
| 54 const RenderObject* m_renderer; | |
| 55 const DisplayItem::Type m_type; | |
| 56 GraphicsContext* m_graphicsContext; | |
| 57 }; | |
| 58 | |
| 59 } // namespace blink | 47 } // namespace blink |
| 60 | 48 |
| 61 #endif // TransparencyDisplayItem_h | 49 #endif // TransparencyDisplayItem_h |
| OLD | NEW |