| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 DEFINE_NODE_FACTORY(SVGFEComponentTransferElement) | 49 DEFINE_NODE_FACTORY(SVGFEComponentTransferElement) |
| 50 | 50 |
| 51 bool SVGFEComponentTransferElement::isSupportedAttribute(const QualifiedName& at
trName) | 51 bool SVGFEComponentTransferElement::isSupportedAttribute(const QualifiedName& at
trName) |
| 52 { | 52 { |
| 53 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 53 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 54 if (supportedAttributes.isEmpty()) | 54 if (supportedAttributes.isEmpty()) |
| 55 supportedAttributes.add(SVGNames::inAttr); | 55 supportedAttributes.add(SVGNames::inAttr); |
| 56 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 56 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void SVGFEComponentTransferElement::svgAttributeChanged(const QualifiedName& att
rName) |
| 60 { |
| 61 if (!isSupportedAttribute(attrName)) { |
| 62 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
| 63 return; |
| 64 } |
| 65 |
| 66 SVGElement::InvalidationGuard invalidationGuard(this); |
| 67 |
| 68 if (attrName == SVGNames::inAttr) { |
| 69 invalidate(); |
| 70 return; |
| 71 } |
| 72 |
| 73 ASSERT_NOT_REACHED(); |
| 74 } |
| 75 |
| 59 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFil
terBuilder* filterBuilder, Filter* filter) | 76 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEComponentTransferElement::build(SVGFil
terBuilder* filterBuilder, Filter* filter) |
| 60 { | 77 { |
| 61 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 78 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
| 62 | 79 |
| 63 if (!input1) | 80 if (!input1) |
| 64 return nullptr; | 81 return nullptr; |
| 65 | 82 |
| 66 ComponentTransferFunction red; | 83 ComponentTransferFunction red; |
| 67 ComponentTransferFunction green; | 84 ComponentTransferFunction green; |
| 68 ComponentTransferFunction blue; | 85 ComponentTransferFunction blue; |
| 69 ComponentTransferFunction alpha; | 86 ComponentTransferFunction alpha; |
| 70 | 87 |
| 71 for (SVGElement* element = Traversal<SVGElement>::firstChild(*this); element
; element = Traversal<SVGElement>::nextSibling(*element)) { | 88 for (SVGElement* element = Traversal<SVGElement>::firstChild(*this); element
; element = Traversal<SVGElement>::nextSibling(*element)) { |
| 72 if (isSVGFEFuncRElement(*element)) | 89 if (isSVGFEFuncRElement(*element)) |
| 73 red = toSVGFEFuncRElement(*element).transferFunction(); | 90 red = toSVGFEFuncRElement(*element).transferFunction(); |
| 74 else if (isSVGFEFuncGElement(*element)) | 91 else if (isSVGFEFuncGElement(*element)) |
| 75 green = toSVGFEFuncGElement(*element).transferFunction(); | 92 green = toSVGFEFuncGElement(*element).transferFunction(); |
| 76 else if (isSVGFEFuncBElement(*element)) | 93 else if (isSVGFEFuncBElement(*element)) |
| 77 blue = toSVGFEFuncBElement(*element).transferFunction(); | 94 blue = toSVGFEFuncBElement(*element).transferFunction(); |
| 78 else if (isSVGFEFuncAElement(*element)) | 95 else if (isSVGFEFuncAElement(*element)) |
| 79 alpha = toSVGFEFuncAElement(*element).transferFunction(); | 96 alpha = toSVGFEFuncAElement(*element).transferFunction(); |
| 80 } | 97 } |
| 81 | 98 |
| 82 RefPtrWillBeRawPtr<FilterEffect> effect = FEComponentTransfer::create(filter
, red, green, blue, alpha); | 99 RefPtrWillBeRawPtr<FilterEffect> effect = FEComponentTransfer::create(filter
, red, green, blue, alpha); |
| 83 effect->inputEffects().append(input1); | 100 effect->inputEffects().append(input1); |
| 84 return effect.release(); | 101 return effect.release(); |
| 85 } | 102 } |
| 86 | 103 |
| 87 } | 104 } |
| OLD | NEW |