| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 inline SVGFEComponentTransferElement::SVGFEComponentTransferElement(Document& do
cument) | 36 inline SVGFEComponentTransferElement::SVGFEComponentTransferElement(Document& do
cument) |
| 37 : SVGFilterPrimitiveStandardAttributes(SVGNames::feComponentTransferTag, doc
ument) | 37 : SVGFilterPrimitiveStandardAttributes(SVGNames::feComponentTransferTag, doc
ument) |
| 38 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create(
))) | 38 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create(
))) |
| 39 { | 39 { |
| 40 addToPropertyMap(m_in1); | 40 addToPropertyMap(m_in1); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void SVGFEComponentTransferElement::trace(Visitor* visitor) |
| 44 { |
| 45 visitor->trace(m_in1); |
| 46 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
| 47 } |
| 48 |
| 43 DEFINE_NODE_FACTORY(SVGFEComponentTransferElement) | 49 DEFINE_NODE_FACTORY(SVGFEComponentTransferElement) |
| 44 | 50 |
| 45 bool SVGFEComponentTransferElement::isSupportedAttribute(const QualifiedName& at
trName) | 51 bool SVGFEComponentTransferElement::isSupportedAttribute(const QualifiedName& at
trName) |
| 46 { | 52 { |
| 47 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 53 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 48 if (supportedAttributes.isEmpty()) | 54 if (supportedAttributes.isEmpty()) |
| 49 supportedAttributes.add(SVGNames::inAttr); | 55 supportedAttributes.add(SVGNames::inAttr); |
| 50 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 56 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 51 } | 57 } |
| 52 | 58 |
| 53 void SVGFEComponentTransferElement::parseAttribute(const QualifiedName& name, co
nst AtomicString& value) | 59 void SVGFEComponentTransferElement::parseAttribute(const QualifiedName& name, co
nst AtomicString& value) |
| 54 { | 60 { |
| 55 parseAttributeNew(name, value); | 61 parseAttributeNew(name, value); |
| 56 } | 62 } |
| 57 | 63 |
| 58 PassRefPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFilterBuilder*
filterBuilder, Filter* filter) | 64 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFil
terBuilder* filterBuilder, Filter* filter) |
| 59 { | 65 { |
| 60 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 66 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
| 61 | 67 |
| 62 if (!input1) | 68 if (!input1) |
| 63 return nullptr; | 69 return nullptr; |
| 64 | 70 |
| 65 ComponentTransferFunction red; | 71 ComponentTransferFunction red; |
| 66 ComponentTransferFunction green; | 72 ComponentTransferFunction green; |
| 67 ComponentTransferFunction blue; | 73 ComponentTransferFunction blue; |
| 68 ComponentTransferFunction alpha; | 74 ComponentTransferFunction alpha; |
| 69 | 75 |
| 70 for (SVGElement* element = Traversal<SVGElement>::firstChild(*this); element
; element = Traversal<SVGElement>::nextSibling(*element)) { | 76 for (SVGElement* element = Traversal<SVGElement>::firstChild(*this); element
; element = Traversal<SVGElement>::nextSibling(*element)) { |
| 71 if (isSVGFEFuncRElement(*element)) | 77 if (isSVGFEFuncRElement(*element)) |
| 72 red = toSVGFEFuncRElement(*element).transferFunction(); | 78 red = toSVGFEFuncRElement(*element).transferFunction(); |
| 73 else if (isSVGFEFuncGElement(*element)) | 79 else if (isSVGFEFuncGElement(*element)) |
| 74 green = toSVGFEFuncGElement(*element).transferFunction(); | 80 green = toSVGFEFuncGElement(*element).transferFunction(); |
| 75 else if (isSVGFEFuncBElement(*element)) | 81 else if (isSVGFEFuncBElement(*element)) |
| 76 blue = toSVGFEFuncBElement(*element).transferFunction(); | 82 blue = toSVGFEFuncBElement(*element).transferFunction(); |
| 77 else if (isSVGFEFuncAElement(*element)) | 83 else if (isSVGFEFuncAElement(*element)) |
| 78 alpha = toSVGFEFuncAElement(*element).transferFunction(); | 84 alpha = toSVGFEFuncAElement(*element).transferFunction(); |
| 79 } | 85 } |
| 80 | 86 |
| 81 RefPtr<FilterEffect> effect = FEComponentTransfer::create(filter, red, green
, blue, alpha); | 87 RefPtrWillBeRawPtr<FilterEffect> effect = FEComponentTransfer::create(filter
, red, green, blue, alpha); |
| 82 effect->inputEffects().append(input1); | 88 effect->inputEffects().append(input1); |
| 83 return effect.release(); | 89 return effect.release(); |
| 84 } | 90 } |
| 85 | 91 |
| 86 } | 92 } |
| OLD | NEW |