| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 EffectPaintPropertyNode_h | 5 #ifndef EffectPaintPropertyNode_h |
| 6 #define EffectPaintPropertyNode_h | 6 #define EffectPaintPropertyNode_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "wtf/PassRefPtr.h" | 9 #include "wtf/PassRefPtr.h" |
| 10 #include "wtf/RefCounted.h" | 10 #include "wtf/RefCounted.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 return adoptRef(new EffectPaintPropertyNode(std::move(parent), opacity)); | 30 return adoptRef(new EffectPaintPropertyNode(std::move(parent), opacity)); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void update(PassRefPtr<const EffectPaintPropertyNode> parent, float opacity) { | 33 void update(PassRefPtr<const EffectPaintPropertyNode> parent, float opacity) { |
| 34 DCHECK(!isRoot()); | 34 DCHECK(!isRoot()); |
| 35 DCHECK(parent != this); | 35 DCHECK(parent != this); |
| 36 m_parent = parent; | 36 m_parent = parent; |
| 37 m_opacity = opacity; | 37 m_opacity = opacity; |
| 38 } | 38 } |
| 39 | 39 |
| 40 PassRefPtr<EffectPaintPropertyNode> clone() const { |
| 41 return adoptRef(new EffectPaintPropertyNode(m_parent, m_opacity)); |
| 42 } |
| 43 |
| 44 bool operator==(const EffectPaintPropertyNode& o) const { |
| 45 return m_parent == o.m_parent && m_opacity == o.m_opacity; |
| 46 } |
| 47 |
| 40 float opacity() const { return m_opacity; } | 48 float opacity() const { return m_opacity; } |
| 41 | 49 |
| 42 // Parent effect or nullptr if this is the root effect. | 50 // Parent effect or nullptr if this is the root effect. |
| 43 const EffectPaintPropertyNode* parent() const { return m_parent.get(); } | 51 const EffectPaintPropertyNode* parent() const { return m_parent.get(); } |
| 44 bool isRoot() const { return !m_parent; } | 52 bool isRoot() const { return !m_parent; } |
| 45 | 53 |
| 46 private: | 54 private: |
| 47 EffectPaintPropertyNode(PassRefPtr<const EffectPaintPropertyNode> parent, | 55 EffectPaintPropertyNode(PassRefPtr<const EffectPaintPropertyNode> parent, |
| 48 float opacity) | 56 float opacity) |
| 49 : m_parent(parent), m_opacity(opacity) {} | 57 : m_parent(parent), m_opacity(opacity) {} |
| 50 | 58 |
| 51 RefPtr<const EffectPaintPropertyNode> m_parent; | 59 RefPtr<const EffectPaintPropertyNode> m_parent; |
| 52 float m_opacity; | 60 float m_opacity; |
| 53 }; | 61 }; |
| 54 | 62 |
| 55 // Redeclared here to avoid ODR issues. | 63 // Redeclared here to avoid ODR issues. |
| 56 // See platform/testing/PaintPrinters.h. | 64 // See platform/testing/PaintPrinters.h. |
| 57 void PrintTo(const EffectPaintPropertyNode&, std::ostream*); | 65 void PrintTo(const EffectPaintPropertyNode&, std::ostream*); |
| 58 | 66 |
| 59 } // namespace blink | 67 } // namespace blink |
| 60 | 68 |
| 61 #endif // EffectPaintPropertyNode_h | 69 #endif // EffectPaintPropertyNode_h |
| OLD | NEW |