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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 if (cssValue && cssValue->isPrimitiveValue()) { | 151 if (cssValue && cssValue->isPrimitiveValue()) { |
152 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*cssVa
lue); | 152 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*cssVa
lue); |
153 return primitiveValue.convertTo<EColorInterpolation>(); | 153 return primitiveValue.convertTo<EColorInterpolation>(); |
154 } | 154 } |
155 } | 155 } |
156 // 'auto' is the default (per Filter Effects), but since the property is | 156 // 'auto' is the default (per Filter Effects), but since the property is |
157 // inherited, propagate the parent's value. | 157 // inherited, propagate the parent's value. |
158 return parentColorInterpolation; | 158 return parentColorInterpolation; |
159 } | 159 } |
160 | 160 |
| 161 ColorSpace SVGFilterBuilder::resolveColorSpace(EColorInterpolation colorInterpol
ation) |
| 162 { |
| 163 return colorInterpolation == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpace
DeviceRGB; |
| 164 } |
| 165 |
161 void SVGFilterBuilder::buildGraph(Filter* filter, SVGFilterElement& filterElemen
t, const FloatRect& referenceBox) | 166 void SVGFilterBuilder::buildGraph(Filter* filter, SVGFilterElement& filterElemen
t, const FloatRect& referenceBox) |
162 { | 167 { |
163 EColorInterpolation filterColorInterpolation = colorInterpolationForElement(
filterElement, CI_AUTO); | 168 EColorInterpolation filterColorInterpolation = colorInterpolationForElement(
filterElement, CI_AUTO); |
164 | 169 |
165 for (SVGElement* element = Traversal<SVGElement>::firstChild(filterElement);
element; element = Traversal<SVGElement>::nextSibling(*element)) { | 170 for (SVGElement* element = Traversal<SVGElement>::firstChild(filterElement);
element; element = Traversal<SVGElement>::nextSibling(*element)) { |
166 if (!element->isFilterEffect()) | 171 if (!element->isFilterEffect()) |
167 continue; | 172 continue; |
168 | 173 |
169 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); | 174 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil
terPrimitiveStandardAttributes*>(element); |
170 FilterEffect* effect = effectElement->build(this, filter); | 175 FilterEffect* effect = effectElement->build(this, filter); |
171 if (!effect) | 176 if (!effect) |
172 continue; | 177 continue; |
173 | 178 |
174 if (m_nodeMap) | 179 if (m_nodeMap) |
175 m_nodeMap->addPrimitive(effectElement->layoutObject(), effect); | 180 m_nodeMap->addPrimitive(effectElement->layoutObject(), effect); |
176 | 181 |
177 effectElement->setStandardAttributes(effect); | 182 effectElement->setStandardAttributes(effect); |
178 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement.primitiveUnits()->curr
entValue()->enumValue(), referenceBox)); | 183 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter
PrimitiveStandardAttributes>(effectElement, filterElement.primitiveUnits()->curr
entValue()->enumValue(), referenceBox)); |
179 EColorInterpolation colorInterpolation = colorInterpolationForElement(*e
ffectElement, filterColorInterpolation); | 184 EColorInterpolation colorInterpolation = colorInterpolationForElement(*e
ffectElement, filterColorInterpolation); |
180 effect->setOperatingColorSpace(colorInterpolation == CI_LINEARRGB ? Colo
rSpaceLinearRGB : ColorSpaceDeviceRGB); | 185 effect->setOperatingColorSpace(resolveColorSpace(colorInterpolation)); |
181 if (effectElement->taintsOrigin(effect->inputsTaintOrigin())) | 186 if (effectElement->taintsOrigin(effect->inputsTaintOrigin())) |
182 effect->setOriginTainted(); | 187 effect->setOriginTainted(); |
183 | 188 |
184 add(AtomicString(effectElement->result()->currentValue()->value()), effe
ct); | 189 add(AtomicString(effectElement->result()->currentValue()->value()), effe
ct); |
185 } | 190 } |
186 } | 191 } |
187 | 192 |
188 void SVGFilterBuilder::add(const AtomicString& id, FilterEffect* effect) | 193 void SVGFilterBuilder::add(const AtomicString& id, FilterEffect* effect) |
189 { | 194 { |
190 if (id.isEmpty()) { | 195 if (id.isEmpty()) { |
(...skipping 18 matching lines...) Expand all Loading... |
209 return namedEffect; | 214 return namedEffect; |
210 } | 215 } |
211 | 216 |
212 if (m_lastEffect) | 217 if (m_lastEffect) |
213 return m_lastEffect.get(); | 218 return m_lastEffect.get(); |
214 | 219 |
215 return m_builtinEffects.get(FilterInputKeywords::getSourceGraphic()); | 220 return m_builtinEffects.get(FilterInputKeywords::getSourceGraphic()); |
216 } | 221 } |
217 | 222 |
218 } // namespace blink | 223 } // namespace blink |
OLD | NEW |