| 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, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return; | 93 return; |
| 94 } | 94 } |
| 95 | 95 |
| 96 ASSERT_NOT_REACHED(); | 96 ASSERT_NOT_REACHED(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool SVGFEColorMatrixElement::setFilterEffectAttribute(FilterEffect* effect, con
st QualifiedName& attrName) | 99 bool SVGFEColorMatrixElement::setFilterEffectAttribute(FilterEffect* effect, con
st QualifiedName& attrName) |
| 100 { | 100 { |
| 101 FEColorMatrix* colorMatrix = static_cast<FEColorMatrix*>(effect); | 101 FEColorMatrix* colorMatrix = static_cast<FEColorMatrix*>(effect); |
| 102 if (attrName == SVGNames::typeAttr) | 102 if (attrName == SVGNames::typeAttr) |
| 103 return colorMatrix->setType(type()); | 103 return colorMatrix->setType(typeCurrentValue()); |
| 104 if (attrName == SVGNames::valuesAttr) | 104 if (attrName == SVGNames::valuesAttr) |
| 105 return colorMatrix->setValues(values()); | 105 return colorMatrix->setValues(valuesCurrentValue()); |
| 106 | 106 |
| 107 ASSERT_NOT_REACHED(); | 107 ASSERT_NOT_REACHED(); |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void SVGFEColorMatrixElement::svgAttributeChanged(const QualifiedName& attrName) | 111 void SVGFEColorMatrixElement::svgAttributeChanged(const QualifiedName& attrName) |
| 112 { | 112 { |
| 113 if (!isSupportedAttribute(attrName)) { | 113 if (!isSupportedAttribute(attrName)) { |
| 114 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | 114 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 | 117 |
| 118 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 118 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 119 | 119 |
| 120 if (attrName == SVGNames::typeAttr || attrName == SVGNames::valuesAttr) { | 120 if (attrName == SVGNames::typeAttr || attrName == SVGNames::valuesAttr) { |
| 121 primitiveAttributeChanged(attrName); | 121 primitiveAttributeChanged(attrName); |
| 122 return; | 122 return; |
| 123 } | 123 } |
| 124 | 124 |
| 125 if (attrName == SVGNames::inAttr) { | 125 if (attrName == SVGNames::inAttr) { |
| 126 invalidate(); | 126 invalidate(); |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 | 129 |
| 130 ASSERT_NOT_REACHED(); | 130 ASSERT_NOT_REACHED(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filter
Builder, Filter* filter) | 133 PassRefPtr<FilterEffect> SVGFEColorMatrixElement::build(SVGFilterBuilder* filter
Builder, Filter* filter) |
| 134 { | 134 { |
| 135 FilterEffect* input1 = filterBuilder->getEffectById(in1()); | 135 FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue()); |
| 136 | 136 |
| 137 if (!input1) | 137 if (!input1) |
| 138 return 0; | 138 return 0; |
| 139 | 139 |
| 140 Vector<float> filterValues; | 140 Vector<float> filterValues; |
| 141 ColorMatrixType filterType = type(); | 141 ColorMatrixType filterType = typeCurrentValue(); |
| 142 | 142 |
| 143 // Use defaults if values is empty (SVG 1.1 15.10). | 143 // Use defaults if values is empty (SVG 1.1 15.10). |
| 144 if (!hasAttribute(SVGNames::valuesAttr)) { | 144 if (!hasAttribute(SVGNames::valuesAttr)) { |
| 145 switch (filterType) { | 145 switch (filterType) { |
| 146 case FECOLORMATRIX_TYPE_MATRIX: | 146 case FECOLORMATRIX_TYPE_MATRIX: |
| 147 for (size_t i = 0; i < 20; i++) | 147 for (size_t i = 0; i < 20; i++) |
| 148 filterValues.append((i % 6) ? 0 : 1); | 148 filterValues.append((i % 6) ? 0 : 1); |
| 149 break; | 149 break; |
| 150 case FECOLORMATRIX_TYPE_HUEROTATE: | 150 case FECOLORMATRIX_TYPE_HUEROTATE: |
| 151 filterValues.append(0); | 151 filterValues.append(0); |
| 152 break; | 152 break; |
| 153 case FECOLORMATRIX_TYPE_SATURATE: | 153 case FECOLORMATRIX_TYPE_SATURATE: |
| 154 filterValues.append(1); | 154 filterValues.append(1); |
| 155 break; | 155 break; |
| 156 default: | 156 default: |
| 157 break; | 157 break; |
| 158 } | 158 } |
| 159 } else { | 159 } else { |
| 160 filterValues = values(); | 160 filterValues = valuesCurrentValue(); |
| 161 unsigned size = filterValues.size(); | 161 unsigned size = filterValues.size(); |
| 162 | 162 |
| 163 if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20) | 163 if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20) |
| 164 || (filterType == FECOLORMATRIX_TYPE_HUEROTATE && size != 1) | 164 || (filterType == FECOLORMATRIX_TYPE_HUEROTATE && size != 1) |
| 165 || (filterType == FECOLORMATRIX_TYPE_SATURATE && size != 1)) | 165 || (filterType == FECOLORMATRIX_TYPE_SATURATE && size != 1)) |
| 166 return 0; | 166 return 0; |
| 167 } | 167 } |
| 168 | 168 |
| 169 RefPtr<FilterEffect> effect = FEColorMatrix::create(filter, filterType, filt
erValues); | 169 RefPtr<FilterEffect> effect = FEColorMatrix::create(filter, filterType, filt
erValues); |
| 170 effect->inputEffects().append(input1); | 170 effect->inputEffects().append(input1); |
| 171 return effect.release(); | 171 return effect.release(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace WebCore | 174 } // namespace WebCore |
| OLD | NEW |