| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 if (entries.isEmpty()) { | 35 if (entries.isEmpty()) { |
| 36 entries.append(std::make_pair(EDGEMODE_DUPLICATE, "duplicate")); | 36 entries.append(std::make_pair(EDGEMODE_DUPLICATE, "duplicate")); |
| 37 entries.append(std::make_pair(EDGEMODE_WRAP, "wrap")); | 37 entries.append(std::make_pair(EDGEMODE_WRAP, "wrap")); |
| 38 entries.append(std::make_pair(EDGEMODE_NONE, "none")); | 38 entries.append(std::make_pair(EDGEMODE_NONE, "none")); |
| 39 } | 39 } |
| 40 return entries; | 40 return entries; |
| 41 } | 41 } |
| 42 | 42 |
| 43 class SVGAnimatedOrder : public SVGAnimatedIntegerOptionalInteger { | 43 class SVGAnimatedOrder : public SVGAnimatedIntegerOptionalInteger { |
| 44 public: | 44 public: |
| 45 static PassRefPtrWillBeRawPtr<SVGAnimatedOrder> create(SVGElement* contextEl
ement) | 45 static RawPtr<SVGAnimatedOrder> create(SVGElement* contextElement) |
| 46 { | 46 { |
| 47 return adoptRefWillBeNoop(new SVGAnimatedOrder(contextElement)); | 47 return (new SVGAnimatedOrder(contextElement)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 SVGParsingError setBaseValueAsString(const String&) override; | 50 SVGParsingError setBaseValueAsString(const String&) override; |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 SVGAnimatedOrder(SVGElement* contextElement) | 53 SVGAnimatedOrder(SVGElement* contextElement) |
| 54 : SVGAnimatedIntegerOptionalInteger(contextElement, SVGNames::orderAttr,
0, 0) | 54 : SVGAnimatedIntegerOptionalInteger(contextElement, SVGNames::orderAttr,
0, 0) |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 || attrName == SVGNames::orderAttr | 155 || attrName == SVGNames::orderAttr |
| 156 || attrName == SVGNames::kernelMatrixAttr) { | 156 || attrName == SVGNames::kernelMatrixAttr) { |
| 157 SVGElement::InvalidationGuard invalidationGuard(this); | 157 SVGElement::InvalidationGuard invalidationGuard(this); |
| 158 invalidate(); | 158 invalidate(); |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 | 161 |
| 162 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | 162 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
| 163 } | 163 } |
| 164 | 164 |
| 165 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilter
Builder* filterBuilder, Filter* filter) | 165 RawPtr<FilterEffect> SVGFEConvolveMatrixElement::build(SVGFilterBuilder* filterB
uilder, Filter* filter) |
| 166 { | 166 { |
| 167 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 167 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
| 168 ASSERT(input1); | 168 ASSERT(input1); |
| 169 | 169 |
| 170 int orderXValue = orderX()->currentValue()->value(); | 170 int orderXValue = orderX()->currentValue()->value(); |
| 171 int orderYValue = orderY()->currentValue()->value(); | 171 int orderYValue = orderY()->currentValue()->value(); |
| 172 if (!m_order->isSpecified()) { | 172 if (!m_order->isSpecified()) { |
| 173 orderXValue = 3; | 173 orderXValue = 3; |
| 174 orderYValue = 3; | 174 orderYValue = 3; |
| 175 } | 175 } |
| 176 | 176 |
| 177 int targetXValue = m_targetX->currentValue()->value(); | 177 int targetXValue = m_targetX->currentValue()->value(); |
| 178 // The spec says the default value is: targetX = floor ( orderX / 2 )) | 178 // The spec says the default value is: targetX = floor ( orderX / 2 )) |
| 179 if (!m_targetX->isSpecified()) | 179 if (!m_targetX->isSpecified()) |
| 180 targetXValue = static_cast<int>(floorf(orderXValue / 2)); | 180 targetXValue = static_cast<int>(floorf(orderXValue / 2)); |
| 181 | 181 |
| 182 int targetYValue = m_targetY->currentValue()->value(); | 182 int targetYValue = m_targetY->currentValue()->value(); |
| 183 // The spec says the default value is: targetY = floor ( orderY / 2 )) | 183 // The spec says the default value is: targetY = floor ( orderY / 2 )) |
| 184 if (!m_targetY->isSpecified()) | 184 if (!m_targetY->isSpecified()) |
| 185 targetYValue = static_cast<int>(floorf(orderYValue / 2)); | 185 targetYValue = static_cast<int>(floorf(orderYValue / 2)); |
| 186 | 186 |
| 187 float divisorValue = m_divisor->currentValue()->value(); | 187 float divisorValue = m_divisor->currentValue()->value(); |
| 188 if (!m_divisor->isSpecified()) { | 188 if (!m_divisor->isSpecified()) { |
| 189 RefPtrWillBeRawPtr<SVGNumberList> kernelMatrix = m_kernelMatrix->current
Value(); | 189 RawPtr<SVGNumberList> kernelMatrix = m_kernelMatrix->currentValue(); |
| 190 size_t kernelMatrixSize = kernelMatrix->length(); | 190 size_t kernelMatrixSize = kernelMatrix->length(); |
| 191 for (size_t i = 0; i < kernelMatrixSize; ++i) | 191 for (size_t i = 0; i < kernelMatrixSize; ++i) |
| 192 divisorValue += kernelMatrix->at(i)->value(); | 192 divisorValue += kernelMatrix->at(i)->value(); |
| 193 if (!divisorValue) | 193 if (!divisorValue) |
| 194 divisorValue = 1; | 194 divisorValue = 1; |
| 195 } | 195 } |
| 196 | 196 |
| 197 RefPtrWillBeRawPtr<FilterEffect> effect = FEConvolveMatrix::create(filter, | 197 RawPtr<FilterEffect> effect = FEConvolveMatrix::create(filter, |
| 198 IntSize(orderXValue, orderYValue), divisorValue, | 198 IntSize(orderXValue, orderYValue), divisorValue, |
| 199 m_bias->currentValue()->value(), IntPoint(targetXValue, targetYValue), m
_edgeMode->currentValue()->enumValue(), | 199 m_bias->currentValue()->value(), IntPoint(targetXValue, targetYValue), m
_edgeMode->currentValue()->enumValue(), |
| 200 m_preserveAlpha->currentValue()->value(), m_kernelMatrix->currentValue()
->toFloatVector()); | 200 m_preserveAlpha->currentValue()->value(), m_kernelMatrix->currentValue()
->toFloatVector()); |
| 201 effect->inputEffects().append(input1); | 201 effect->inputEffects().append(input1); |
| 202 return effect.release(); | 202 return effect.release(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |