Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp

Issue 2303703002: Revamp filter primitive region calculations for Filter Effects (Closed)
Patch Set: Baselines again; Manual for mac10.11-retina Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 ColorSpace SVGFilterBuilder::resolveColorSpace(EColorInterpolation colorInterpol ation) 161 ColorSpace SVGFilterBuilder::resolveColorSpace(EColorInterpolation colorInterpol ation)
162 { 162 {
163 return colorInterpolation == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpace DeviceRGB; 163 return colorInterpolation == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpace DeviceRGB;
164 } 164 }
165 165
166 void SVGFilterBuilder::buildGraph(Filter* filter, SVGFilterElement& filterElemen t, const FloatRect& referenceBox) 166 void SVGFilterBuilder::buildGraph(Filter* filter, SVGFilterElement& filterElemen t, const FloatRect& referenceBox)
167 { 167 {
168 EColorInterpolation filterColorInterpolation = colorInterpolationForElement( filterElement, CI_AUTO); 168 EColorInterpolation filterColorInterpolation = colorInterpolationForElement( filterElement, CI_AUTO);
169 SVGUnitTypes::SVGUnitType primitiveUnits = filterElement.primitiveUnits()->c urrentValue()->enumValue();
169 170
170 for (SVGElement* element = Traversal<SVGElement>::firstChild(filterElement); element; element = Traversal<SVGElement>::nextSibling(*element)) { 171 for (SVGElement* element = Traversal<SVGElement>::firstChild(filterElement); element; element = Traversal<SVGElement>::nextSibling(*element)) {
171 if (!element->isFilterEffect()) 172 if (!element->isFilterEffect())
172 continue; 173 continue;
173 174
174 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil terPrimitiveStandardAttributes*>(element); 175 SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFil terPrimitiveStandardAttributes*>(element);
175 FilterEffect* effect = effectElement->build(this, filter); 176 FilterEffect* effect = effectElement->build(this, filter);
176 if (!effect) 177 if (!effect)
177 continue; 178 continue;
178 179
179 if (m_nodeMap) 180 if (m_nodeMap)
180 m_nodeMap->addPrimitive(effectElement->layoutObject(), effect); 181 m_nodeMap->addPrimitive(effectElement->layoutObject(), effect);
181 182
182 effectElement->setStandardAttributes(effect); 183 effectElement->setStandardAttributes(effect, primitiveUnits, referenceBo x);
183 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter PrimitiveStandardAttributes>(effectElement, filterElement.primitiveUnits()->curr entValue()->enumValue(), referenceBox));
184 EColorInterpolation colorInterpolation = colorInterpolationForElement(*e ffectElement, filterColorInterpolation); 184 EColorInterpolation colorInterpolation = colorInterpolationForElement(*e ffectElement, filterColorInterpolation);
185 effect->setOperatingColorSpace(resolveColorSpace(colorInterpolation)); 185 effect->setOperatingColorSpace(resolveColorSpace(colorInterpolation));
186 if (effectElement->taintsOrigin(effect->inputsTaintOrigin())) 186 if (effectElement->taintsOrigin(effect->inputsTaintOrigin()))
187 effect->setOriginTainted(); 187 effect->setOriginTainted();
188 188
189 add(AtomicString(effectElement->result()->currentValue()->value()), effe ct); 189 add(AtomicString(effectElement->result()->currentValue()->value()), effe ct);
190 } 190 }
191 } 191 }
192 192
193 void SVGFilterBuilder::add(const AtomicString& id, FilterEffect* effect) 193 void SVGFilterBuilder::add(const AtomicString& id, FilterEffect* effect)
(...skipping 20 matching lines...) Expand all
214 return namedEffect; 214 return namedEffect;
215 } 215 }
216 216
217 if (m_lastEffect) 217 if (m_lastEffect)
218 return m_lastEffect.get(); 218 return m_lastEffect.get();
219 219
220 return m_builtinEffects.get(FilterInputKeywords::getSourceGraphic()); 220 return m_builtinEffects.get(FilterInputKeywords::getSourceGraphic());
221 } 221 }
222 222
223 } // namespace blink 223 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698