| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | 5 #include "platform/graphics/paint/EffectPaintPropertyNode.h" |
| 6 | 6 |
| 7 #include "platform/graphics/paint/PropertyTreeState.h" | 7 #include "platform/graphics/paint/PropertyTreeState.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 EffectPaintPropertyNode* EffectPaintPropertyNode::root() { | 11 EffectPaintPropertyNode* EffectPaintPropertyNode::root() { |
| 12 DEFINE_STATIC_REF( | 12 DEFINE_STATIC_REF( |
| 13 EffectPaintPropertyNode, root, | 13 EffectPaintPropertyNode, root, |
| 14 (EffectPaintPropertyNode::create( | 14 (EffectPaintPropertyNode::create( |
| 15 nullptr, TransformPaintPropertyNode::root(), | 15 nullptr, TransformPaintPropertyNode::root(), |
| 16 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 1.0, | 16 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 1.0, |
| 17 SkBlendMode::kSrcOver))); | 17 SkBlendMode::kSrcOver))); |
| 18 return root; | 18 return root; |
| 19 } | 19 } |
| 20 | 20 |
| 21 FloatRect EffectPaintPropertyNode::mapRect(const FloatRect& rect) const { |
| 22 FloatRect inputRect = rect; |
| 23 inputRect.moveBy(-m_offset); |
| 24 FloatRect result = m_filter.mapRect(inputRect); |
| 25 result.moveBy(m_offset); |
| 26 return result; |
| 27 } |
| 28 |
| 21 cc::Layer* EffectPaintPropertyNode::ensureDummyLayer() const { | 29 cc::Layer* EffectPaintPropertyNode::ensureDummyLayer() const { |
| 22 if (m_dummyLayer) | 30 if (m_dummyLayer) |
| 23 return m_dummyLayer.get(); | 31 return m_dummyLayer.get(); |
| 24 m_dummyLayer = cc::Layer::Create(); | 32 m_dummyLayer = cc::Layer::Create(); |
| 25 return m_dummyLayer.get(); | 33 return m_dummyLayer.get(); |
| 26 } | 34 } |
| 27 | 35 |
| 28 String EffectPaintPropertyNode::toString() const { | 36 String EffectPaintPropertyNode::toString() const { |
| 29 return String::format( | 37 return String::format( |
| 30 "parent=%p localTransformSpace=%p outputClip=%p opacity=%f filter=%s " | 38 "parent=%p localTransformSpace=%p outputClip=%p opacity=%f filter=%s " |
| 31 "blendMode=%s directCompositingReasons=%s compositorElementId=(%d, %d)", | 39 "blendMode=%s directCompositingReasons=%s compositorElementId=(%d, %d) " |
| 40 "offset=%s", |
| 32 m_parent.get(), m_localTransformSpace.get(), m_outputClip.get(), | 41 m_parent.get(), m_localTransformSpace.get(), m_outputClip.get(), |
| 33 m_opacity, m_filter.toString().ascii().data(), | 42 m_opacity, m_filter.toString().ascii().data(), |
| 34 SkBlendMode_Name(m_blendMode), | 43 SkBlendMode_Name(m_blendMode), |
| 35 compositingReasonsAsString(m_directCompositingReasons).ascii().data(), | 44 compositingReasonsAsString(m_directCompositingReasons).ascii().data(), |
| 36 m_compositorElementId.primaryId, m_compositorElementId.secondaryId); | 45 m_compositorElementId.primaryId, m_compositorElementId.secondaryId, |
| 46 m_offset.toString().ascii().data()); |
| 37 } | 47 } |
| 38 | 48 |
| 39 #if DCHECK_IS_ON() | 49 #if DCHECK_IS_ON() |
| 40 | 50 |
| 41 String EffectPaintPropertyNode::toTreeString() const { | 51 String EffectPaintPropertyNode::toTreeString() const { |
| 42 return blink::PropertyTreeStatePrinter<blink::EffectPaintPropertyNode>() | 52 return blink::PropertyTreeStatePrinter<blink::EffectPaintPropertyNode>() |
| 43 .pathAsString(this); | 53 .pathAsString(this); |
| 44 } | 54 } |
| 45 | 55 |
| 46 #endif | 56 #endif |
| 47 | 57 |
| 48 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |