haikuwebkit/ManualTests/svg-filter-animation.svg

121 lines
4.6 KiB
XML
Raw Permalink Normal View History

Better result passing in filter primitives https://bugs.webkit.org/show_bug.cgi?id=49907 Reviewed by Dirk Schulze. SVG filter primitives can use the output of other filters. The input and output format of a filter can be a premultiplied or unmultiplied RGBA array, or an image buffer. All filter primitive results were converted to image buffers before, which could be an unecessary (and really costly) operation, if a filter expects its input in the same format as the output of the input filter primitive. This overhead is removed by this patch. All apply() methods are updated according to this new filter primitive interface. Filters do not generate their results twice (or more) anymore, when their apply() called multiple times. The existing tests cover this feature. * manual-tests/svg-filter-animation.svg: Added. * platform/graphics/filters/FEBlend.cpp: (WebCore::FEBlend::apply): * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::FEColorMatrix::apply): * platform/graphics/filters/FEComponentTransfer.cpp: (WebCore::FEComponentTransfer::apply): * platform/graphics/filters/FEComposite.cpp: (WebCore::FEComposite::apply): * platform/graphics/filters/FEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::apply): * platform/graphics/filters/FEDisplacementMap.cpp: (WebCore::FEDisplacementMap::apply): * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::apply): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::apply): * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::apply): * platform/graphics/filters/FEMerge.cpp: (WebCore::FEMerge::apply): * platform/graphics/filters/FEMerge.h: * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::apply): * platform/graphics/filters/FEOffset.cpp: (WebCore::FEOffset::apply): * platform/graphics/filters/FETile.cpp: (WebCore::FETile::apply): * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::apply): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::requestedRegionOfInputImageData): (WebCore::FilterEffect::asImageBuffer): (WebCore::FilterEffect::asUnmultipliedImage): (WebCore::FilterEffect::asPremultipliedImage): (WebCore::FilterEffect::copyImageBytes): (WebCore::FilterEffect::copyUnmultipliedImage): (WebCore::FilterEffect::copyPremultipliedImage): (WebCore::FilterEffect::createImageBufferResult): (WebCore::FilterEffect::createUnmultipliedImageResult): (WebCore::FilterEffect::createPremultipliedImageResult): * platform/graphics/filters/FilterEffect.h: (WebCore::FilterEffect::hasResult): * platform/graphics/filters/SourceAlpha.cpp: (WebCore::SourceAlpha::apply): * platform/graphics/filters/SourceGraphic.cpp: (WebCore::SourceGraphic::apply): * platform/graphics/filters/SourceGraphic.h: * rendering/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::postApplyResource): * svg/graphics/filters/SVGFEImage.cpp: (WebCore::FEImage::apply): Canonical link: https://commits.webkit.org/64255@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@73894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-12-13 10:15:53 +00:00
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!--
Copyright (C) 2010 University of Szeged
Copyright (C) 2010 Zoltan Herczeg
Copyright (C) 2010 Gabor Loki
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="0%" y="0%" width="100%" height="100%" fill="black" />
<defs>
<filter id="filt" filterUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
LightElement changes does not require relayout. https://bugs.webkit.org/show_bug.cgi?id=53232 Reviewed by Dirk Schulze. When an attribute of a LightElement changes, it send an update message to the lighting filters to update its corresponding LightSource objects, and repaint the filters. Duplicated 'id' attributes removed from svg-filter-animation.svg. Existing dynamic-update tests covers this feature. 5x speedup on manual-tests/svg-filter-animation.svg * manual-tests/svg-filter-animation.svg: * platform/graphics/filters/DistantLightSource.h: * platform/graphics/filters/FEDiffuseLighting.cpp: (WebCore::FEDiffuseLighting::setLightingColor): (WebCore::FEDiffuseLighting::setSurfaceScale): (WebCore::FEDiffuseLighting::setDiffuseConstant): (WebCore::FEDiffuseLighting::setKernelUnitLengthX): (WebCore::FEDiffuseLighting::setKernelUnitLengthY): * platform/graphics/filters/FEDiffuseLighting.h: * platform/graphics/filters/LightSource.cpp: (WebCore::PointLightSource::setX): (WebCore::PointLightSource::setY): (WebCore::PointLightSource::setZ): (WebCore::SpotLightSource::setX): (WebCore::SpotLightSource::setY): (WebCore::SpotLightSource::setZ): (WebCore::SpotLightSource::setPointsAtX): (WebCore::SpotLightSource::setPointsAtY): (WebCore::SpotLightSource::setPointsAtZ): (WebCore::SpotLightSource::setSpecularExponent): (WebCore::SpotLightSource::setLimitingConeAngle): (WebCore::DistantLightSource::setAzimuth): (WebCore::DistantLightSource::setElevation): (WebCore::LightSource::setAzimuth): (WebCore::LightSource::setElevation): (WebCore::LightSource::setX): (WebCore::LightSource::setY): (WebCore::LightSource::setZ): (WebCore::LightSource::setPointsAtX): (WebCore::LightSource::setPointsAtY): (WebCore::LightSource::setPointsAtZ): (WebCore::LightSource::setSpecularExponent): (WebCore::LightSource::setLimitingConeAngle): * platform/graphics/filters/LightSource.h: * platform/graphics/filters/PointLightSource.h: * platform/graphics/filters/SpotLightSource.h: * rendering/svg/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::primitiveAttributeChanged): * svg/SVGFEDiffuseLightingElement.cpp: (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute): (WebCore::SVGFEDiffuseLightingElement::lightElementAttributeChanged): (WebCore::SVGFEDiffuseLightingElement::build): (WebCore::SVGFEDiffuseLightingElement::findLightElement): (WebCore::SVGFEDiffuseLightingElement::findLight): * svg/SVGFEDiffuseLightingElement.h: * svg/SVGFELightElement.cpp: (WebCore::SVGFELightElement::svgAttributeChanged): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute): * svg/SVGFilterPrimitiveStandardAttributes.h: Canonical link: https://commits.webkit.org/67354@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-02-01 10:48:02 +00:00
<feTurbulence baseFrequency="0.03" numOctaves="4" seed="67" result="turb"/>
<feGaussianBlur in="SourceGraphic" primitiveUnits="objectBoundingBox" stdDeviation="1" result="blur"/>
Better result passing in filter primitives https://bugs.webkit.org/show_bug.cgi?id=49907 Reviewed by Dirk Schulze. SVG filter primitives can use the output of other filters. The input and output format of a filter can be a premultiplied or unmultiplied RGBA array, or an image buffer. All filter primitive results were converted to image buffers before, which could be an unecessary (and really costly) operation, if a filter expects its input in the same format as the output of the input filter primitive. This overhead is removed by this patch. All apply() methods are updated according to this new filter primitive interface. Filters do not generate their results twice (or more) anymore, when their apply() called multiple times. The existing tests cover this feature. * manual-tests/svg-filter-animation.svg: Added. * platform/graphics/filters/FEBlend.cpp: (WebCore::FEBlend::apply): * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::FEColorMatrix::apply): * platform/graphics/filters/FEComponentTransfer.cpp: (WebCore::FEComponentTransfer::apply): * platform/graphics/filters/FEComposite.cpp: (WebCore::FEComposite::apply): * platform/graphics/filters/FEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::apply): * platform/graphics/filters/FEDisplacementMap.cpp: (WebCore::FEDisplacementMap::apply): * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::apply): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::apply): * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::apply): * platform/graphics/filters/FEMerge.cpp: (WebCore::FEMerge::apply): * platform/graphics/filters/FEMerge.h: * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::apply): * platform/graphics/filters/FEOffset.cpp: (WebCore::FEOffset::apply): * platform/graphics/filters/FETile.cpp: (WebCore::FETile::apply): * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::apply): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::requestedRegionOfInputImageData): (WebCore::FilterEffect::asImageBuffer): (WebCore::FilterEffect::asUnmultipliedImage): (WebCore::FilterEffect::asPremultipliedImage): (WebCore::FilterEffect::copyImageBytes): (WebCore::FilterEffect::copyUnmultipliedImage): (WebCore::FilterEffect::copyPremultipliedImage): (WebCore::FilterEffect::createImageBufferResult): (WebCore::FilterEffect::createUnmultipliedImageResult): (WebCore::FilterEffect::createPremultipliedImageResult): * platform/graphics/filters/FilterEffect.h: (WebCore::FilterEffect::hasResult): * platform/graphics/filters/SourceAlpha.cpp: (WebCore::SourceAlpha::apply): * platform/graphics/filters/SourceGraphic.cpp: (WebCore::SourceGraphic::apply): * platform/graphics/filters/SourceGraphic.h: * rendering/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::postApplyResource): * svg/graphics/filters/SVGFEImage.cpp: (WebCore::FEImage::apply): Canonical link: https://commits.webkit.org/64255@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@73894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-12-13 10:15:53 +00:00
<feComposite in="turb" in2="blur" operator="arithmetic" k2="0.3" k3="1" result="comp"/>
LightElement changes does not require relayout. https://bugs.webkit.org/show_bug.cgi?id=53232 Reviewed by Dirk Schulze. When an attribute of a LightElement changes, it send an update message to the lighting filters to update its corresponding LightSource objects, and repaint the filters. Duplicated 'id' attributes removed from svg-filter-animation.svg. Existing dynamic-update tests covers this feature. 5x speedup on manual-tests/svg-filter-animation.svg * manual-tests/svg-filter-animation.svg: * platform/graphics/filters/DistantLightSource.h: * platform/graphics/filters/FEDiffuseLighting.cpp: (WebCore::FEDiffuseLighting::setLightingColor): (WebCore::FEDiffuseLighting::setSurfaceScale): (WebCore::FEDiffuseLighting::setDiffuseConstant): (WebCore::FEDiffuseLighting::setKernelUnitLengthX): (WebCore::FEDiffuseLighting::setKernelUnitLengthY): * platform/graphics/filters/FEDiffuseLighting.h: * platform/graphics/filters/LightSource.cpp: (WebCore::PointLightSource::setX): (WebCore::PointLightSource::setY): (WebCore::PointLightSource::setZ): (WebCore::SpotLightSource::setX): (WebCore::SpotLightSource::setY): (WebCore::SpotLightSource::setZ): (WebCore::SpotLightSource::setPointsAtX): (WebCore::SpotLightSource::setPointsAtY): (WebCore::SpotLightSource::setPointsAtZ): (WebCore::SpotLightSource::setSpecularExponent): (WebCore::SpotLightSource::setLimitingConeAngle): (WebCore::DistantLightSource::setAzimuth): (WebCore::DistantLightSource::setElevation): (WebCore::LightSource::setAzimuth): (WebCore::LightSource::setElevation): (WebCore::LightSource::setX): (WebCore::LightSource::setY): (WebCore::LightSource::setZ): (WebCore::LightSource::setPointsAtX): (WebCore::LightSource::setPointsAtY): (WebCore::LightSource::setPointsAtZ): (WebCore::LightSource::setSpecularExponent): (WebCore::LightSource::setLimitingConeAngle): * platform/graphics/filters/LightSource.h: * platform/graphics/filters/PointLightSource.h: * platform/graphics/filters/SpotLightSource.h: * rendering/svg/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::primitiveAttributeChanged): * svg/SVGFEDiffuseLightingElement.cpp: (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute): (WebCore::SVGFEDiffuseLightingElement::lightElementAttributeChanged): (WebCore::SVGFEDiffuseLightingElement::build): (WebCore::SVGFEDiffuseLightingElement::findLightElement): (WebCore::SVGFEDiffuseLightingElement::findLight): * svg/SVGFEDiffuseLightingElement.h: * svg/SVGFELightElement.cpp: (WebCore::SVGFELightElement::svgAttributeChanged): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute): * svg/SVGFilterPrimitiveStandardAttributes.h: Canonical link: https://commits.webkit.org/67354@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-02-01 10:48:02 +00:00
<feDiffuseLighting in="comp" primitiveUnits="objectBoundingBox" diffuseConstant="1" lighting-color="white" surfaceScale="10" result="light" >
Better result passing in filter primitives https://bugs.webkit.org/show_bug.cgi?id=49907 Reviewed by Dirk Schulze. SVG filter primitives can use the output of other filters. The input and output format of a filter can be a premultiplied or unmultiplied RGBA array, or an image buffer. All filter primitive results were converted to image buffers before, which could be an unecessary (and really costly) operation, if a filter expects its input in the same format as the output of the input filter primitive. This overhead is removed by this patch. All apply() methods are updated according to this new filter primitive interface. Filters do not generate their results twice (or more) anymore, when their apply() called multiple times. The existing tests cover this feature. * manual-tests/svg-filter-animation.svg: Added. * platform/graphics/filters/FEBlend.cpp: (WebCore::FEBlend::apply): * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::FEColorMatrix::apply): * platform/graphics/filters/FEComponentTransfer.cpp: (WebCore::FEComponentTransfer::apply): * platform/graphics/filters/FEComposite.cpp: (WebCore::FEComposite::apply): * platform/graphics/filters/FEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::apply): * platform/graphics/filters/FEDisplacementMap.cpp: (WebCore::FEDisplacementMap::apply): * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::apply): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::apply): * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::apply): * platform/graphics/filters/FEMerge.cpp: (WebCore::FEMerge::apply): * platform/graphics/filters/FEMerge.h: * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::apply): * platform/graphics/filters/FEOffset.cpp: (WebCore::FEOffset::apply): * platform/graphics/filters/FETile.cpp: (WebCore::FETile::apply): * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::apply): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::requestedRegionOfInputImageData): (WebCore::FilterEffect::asImageBuffer): (WebCore::FilterEffect::asUnmultipliedImage): (WebCore::FilterEffect::asPremultipliedImage): (WebCore::FilterEffect::copyImageBytes): (WebCore::FilterEffect::copyUnmultipliedImage): (WebCore::FilterEffect::copyPremultipliedImage): (WebCore::FilterEffect::createImageBufferResult): (WebCore::FilterEffect::createUnmultipliedImageResult): (WebCore::FilterEffect::createPremultipliedImageResult): * platform/graphics/filters/FilterEffect.h: (WebCore::FilterEffect::hasResult): * platform/graphics/filters/SourceAlpha.cpp: (WebCore::SourceAlpha::apply): * platform/graphics/filters/SourceGraphic.cpp: (WebCore::SourceGraphic::apply): * platform/graphics/filters/SourceGraphic.h: * rendering/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::postApplyResource): * svg/graphics/filters/SVGFEImage.cpp: (WebCore::FEImage::apply): Canonical link: https://commits.webkit.org/64255@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@73894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-12-13 10:15:53 +00:00
<feSpotLight id="light" x="0" y="300" z="200" pointsAtX="-200" pointsAtY="100" pointsAtZ="0" limitingConeAngle="90" specularExponent="20" />
</feDiffuseLighting>
LightElement changes does not require relayout. https://bugs.webkit.org/show_bug.cgi?id=53232 Reviewed by Dirk Schulze. When an attribute of a LightElement changes, it send an update message to the lighting filters to update its corresponding LightSource objects, and repaint the filters. Duplicated 'id' attributes removed from svg-filter-animation.svg. Existing dynamic-update tests covers this feature. 5x speedup on manual-tests/svg-filter-animation.svg * manual-tests/svg-filter-animation.svg: * platform/graphics/filters/DistantLightSource.h: * platform/graphics/filters/FEDiffuseLighting.cpp: (WebCore::FEDiffuseLighting::setLightingColor): (WebCore::FEDiffuseLighting::setSurfaceScale): (WebCore::FEDiffuseLighting::setDiffuseConstant): (WebCore::FEDiffuseLighting::setKernelUnitLengthX): (WebCore::FEDiffuseLighting::setKernelUnitLengthY): * platform/graphics/filters/FEDiffuseLighting.h: * platform/graphics/filters/LightSource.cpp: (WebCore::PointLightSource::setX): (WebCore::PointLightSource::setY): (WebCore::PointLightSource::setZ): (WebCore::SpotLightSource::setX): (WebCore::SpotLightSource::setY): (WebCore::SpotLightSource::setZ): (WebCore::SpotLightSource::setPointsAtX): (WebCore::SpotLightSource::setPointsAtY): (WebCore::SpotLightSource::setPointsAtZ): (WebCore::SpotLightSource::setSpecularExponent): (WebCore::SpotLightSource::setLimitingConeAngle): (WebCore::DistantLightSource::setAzimuth): (WebCore::DistantLightSource::setElevation): (WebCore::LightSource::setAzimuth): (WebCore::LightSource::setElevation): (WebCore::LightSource::setX): (WebCore::LightSource::setY): (WebCore::LightSource::setZ): (WebCore::LightSource::setPointsAtX): (WebCore::LightSource::setPointsAtY): (WebCore::LightSource::setPointsAtZ): (WebCore::LightSource::setSpecularExponent): (WebCore::LightSource::setLimitingConeAngle): * platform/graphics/filters/LightSource.h: * platform/graphics/filters/PointLightSource.h: * platform/graphics/filters/SpotLightSource.h: * rendering/svg/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::primitiveAttributeChanged): * svg/SVGFEDiffuseLightingElement.cpp: (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute): (WebCore::SVGFEDiffuseLightingElement::lightElementAttributeChanged): (WebCore::SVGFEDiffuseLightingElement::build): (WebCore::SVGFEDiffuseLightingElement::findLightElement): (WebCore::SVGFEDiffuseLightingElement::findLight): * svg/SVGFEDiffuseLightingElement.h: * svg/SVGFELightElement.cpp: (WebCore::SVGFELightElement::svgAttributeChanged): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute): * svg/SVGFilterPrimitiveStandardAttributes.h: Canonical link: https://commits.webkit.org/67354@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-02-01 10:48:02 +00:00
<feSpecularLighting in="comp" primitiveUnits="objectBoundingBox" diffuseConstant="1" lighting-color="#A66102" surfaceScale="10" result="ambient" >
<feDistantLight azimuth="0" elevation="90" />
Better result passing in filter primitives https://bugs.webkit.org/show_bug.cgi?id=49907 Reviewed by Dirk Schulze. SVG filter primitives can use the output of other filters. The input and output format of a filter can be a premultiplied or unmultiplied RGBA array, or an image buffer. All filter primitive results were converted to image buffers before, which could be an unecessary (and really costly) operation, if a filter expects its input in the same format as the output of the input filter primitive. This overhead is removed by this patch. All apply() methods are updated according to this new filter primitive interface. Filters do not generate their results twice (or more) anymore, when their apply() called multiple times. The existing tests cover this feature. * manual-tests/svg-filter-animation.svg: Added. * platform/graphics/filters/FEBlend.cpp: (WebCore::FEBlend::apply): * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::FEColorMatrix::apply): * platform/graphics/filters/FEComponentTransfer.cpp: (WebCore::FEComponentTransfer::apply): * platform/graphics/filters/FEComposite.cpp: (WebCore::FEComposite::apply): * platform/graphics/filters/FEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::apply): * platform/graphics/filters/FEDisplacementMap.cpp: (WebCore::FEDisplacementMap::apply): * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::apply): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::apply): * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::apply): * platform/graphics/filters/FEMerge.cpp: (WebCore::FEMerge::apply): * platform/graphics/filters/FEMerge.h: * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::apply): * platform/graphics/filters/FEOffset.cpp: (WebCore::FEOffset::apply): * platform/graphics/filters/FETile.cpp: (WebCore::FETile::apply): * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::apply): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::requestedRegionOfInputImageData): (WebCore::FilterEffect::asImageBuffer): (WebCore::FilterEffect::asUnmultipliedImage): (WebCore::FilterEffect::asPremultipliedImage): (WebCore::FilterEffect::copyImageBytes): (WebCore::FilterEffect::copyUnmultipliedImage): (WebCore::FilterEffect::copyPremultipliedImage): (WebCore::FilterEffect::createImageBufferResult): (WebCore::FilterEffect::createUnmultipliedImageResult): (WebCore::FilterEffect::createPremultipliedImageResult): * platform/graphics/filters/FilterEffect.h: (WebCore::FilterEffect::hasResult): * platform/graphics/filters/SourceAlpha.cpp: (WebCore::SourceAlpha::apply): * platform/graphics/filters/SourceGraphic.cpp: (WebCore::SourceGraphic::apply): * platform/graphics/filters/SourceGraphic.h: * rendering/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::postApplyResource): * svg/graphics/filters/SVGFEImage.cpp: (WebCore::FEImage::apply): Canonical link: https://commits.webkit.org/64255@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@73894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-12-13 10:15:53 +00:00
</feSpecularLighting>
LightElement changes does not require relayout. https://bugs.webkit.org/show_bug.cgi?id=53232 Reviewed by Dirk Schulze. When an attribute of a LightElement changes, it send an update message to the lighting filters to update its corresponding LightSource objects, and repaint the filters. Duplicated 'id' attributes removed from svg-filter-animation.svg. Existing dynamic-update tests covers this feature. 5x speedup on manual-tests/svg-filter-animation.svg * manual-tests/svg-filter-animation.svg: * platform/graphics/filters/DistantLightSource.h: * platform/graphics/filters/FEDiffuseLighting.cpp: (WebCore::FEDiffuseLighting::setLightingColor): (WebCore::FEDiffuseLighting::setSurfaceScale): (WebCore::FEDiffuseLighting::setDiffuseConstant): (WebCore::FEDiffuseLighting::setKernelUnitLengthX): (WebCore::FEDiffuseLighting::setKernelUnitLengthY): * platform/graphics/filters/FEDiffuseLighting.h: * platform/graphics/filters/LightSource.cpp: (WebCore::PointLightSource::setX): (WebCore::PointLightSource::setY): (WebCore::PointLightSource::setZ): (WebCore::SpotLightSource::setX): (WebCore::SpotLightSource::setY): (WebCore::SpotLightSource::setZ): (WebCore::SpotLightSource::setPointsAtX): (WebCore::SpotLightSource::setPointsAtY): (WebCore::SpotLightSource::setPointsAtZ): (WebCore::SpotLightSource::setSpecularExponent): (WebCore::SpotLightSource::setLimitingConeAngle): (WebCore::DistantLightSource::setAzimuth): (WebCore::DistantLightSource::setElevation): (WebCore::LightSource::setAzimuth): (WebCore::LightSource::setElevation): (WebCore::LightSource::setX): (WebCore::LightSource::setY): (WebCore::LightSource::setZ): (WebCore::LightSource::setPointsAtX): (WebCore::LightSource::setPointsAtY): (WebCore::LightSource::setPointsAtZ): (WebCore::LightSource::setSpecularExponent): (WebCore::LightSource::setLimitingConeAngle): * platform/graphics/filters/LightSource.h: * platform/graphics/filters/PointLightSource.h: * platform/graphics/filters/SpotLightSource.h: * rendering/svg/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::primitiveAttributeChanged): * svg/SVGFEDiffuseLightingElement.cpp: (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute): (WebCore::SVGFEDiffuseLightingElement::lightElementAttributeChanged): (WebCore::SVGFEDiffuseLightingElement::build): (WebCore::SVGFEDiffuseLightingElement::findLightElement): (WebCore::SVGFEDiffuseLightingElement::findLight): * svg/SVGFEDiffuseLightingElement.h: * svg/SVGFELightElement.cpp: (WebCore::SVGFELightElement::svgAttributeChanged): * svg/SVGFilterPrimitiveStandardAttributes.cpp: (WebCore::SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute): * svg/SVGFilterPrimitiveStandardAttributes.h: Canonical link: https://commits.webkit.org/67354@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-02-01 10:48:02 +00:00
<feComposite in="light" in2="ambient" operator="arithmetic" k2="1.2" k3=".8"/>
Better result passing in filter primitives https://bugs.webkit.org/show_bug.cgi?id=49907 Reviewed by Dirk Schulze. SVG filter primitives can use the output of other filters. The input and output format of a filter can be a premultiplied or unmultiplied RGBA array, or an image buffer. All filter primitive results were converted to image buffers before, which could be an unecessary (and really costly) operation, if a filter expects its input in the same format as the output of the input filter primitive. This overhead is removed by this patch. All apply() methods are updated according to this new filter primitive interface. Filters do not generate their results twice (or more) anymore, when their apply() called multiple times. The existing tests cover this feature. * manual-tests/svg-filter-animation.svg: Added. * platform/graphics/filters/FEBlend.cpp: (WebCore::FEBlend::apply): * platform/graphics/filters/FEColorMatrix.cpp: (WebCore::FEColorMatrix::apply): * platform/graphics/filters/FEComponentTransfer.cpp: (WebCore::FEComponentTransfer::apply): * platform/graphics/filters/FEComposite.cpp: (WebCore::FEComposite::apply): * platform/graphics/filters/FEConvolveMatrix.cpp: (WebCore::FEConvolveMatrix::apply): * platform/graphics/filters/FEDisplacementMap.cpp: (WebCore::FEDisplacementMap::apply): * platform/graphics/filters/FEFlood.cpp: (WebCore::FEFlood::apply): * platform/graphics/filters/FEGaussianBlur.cpp: (WebCore::FEGaussianBlur::apply): * platform/graphics/filters/FELighting.cpp: (WebCore::FELighting::apply): * platform/graphics/filters/FEMerge.cpp: (WebCore::FEMerge::apply): * platform/graphics/filters/FEMerge.h: * platform/graphics/filters/FEMorphology.cpp: (WebCore::FEMorphology::apply): * platform/graphics/filters/FEOffset.cpp: (WebCore::FEOffset::apply): * platform/graphics/filters/FETile.cpp: (WebCore::FETile::apply): * platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::apply): * platform/graphics/filters/FilterEffect.cpp: (WebCore::FilterEffect::requestedRegionOfInputImageData): (WebCore::FilterEffect::asImageBuffer): (WebCore::FilterEffect::asUnmultipliedImage): (WebCore::FilterEffect::asPremultipliedImage): (WebCore::FilterEffect::copyImageBytes): (WebCore::FilterEffect::copyUnmultipliedImage): (WebCore::FilterEffect::copyPremultipliedImage): (WebCore::FilterEffect::createImageBufferResult): (WebCore::FilterEffect::createUnmultipliedImageResult): (WebCore::FilterEffect::createPremultipliedImageResult): * platform/graphics/filters/FilterEffect.h: (WebCore::FilterEffect::hasResult): * platform/graphics/filters/SourceAlpha.cpp: (WebCore::SourceAlpha::apply): * platform/graphics/filters/SourceGraphic.cpp: (WebCore::SourceGraphic::apply): * platform/graphics/filters/SourceGraphic.h: * rendering/RenderSVGResourceFilter.cpp: (WebCore::RenderSVGResourceFilter::postApplyResource): * svg/graphics/filters/SVGFEImage.cpp: (WebCore::FEImage::apply): Canonical link: https://commits.webkit.org/64255@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@73894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-12-13 10:15:53 +00:00
</filter>
</defs>
<g filter="url(#filt)" fill="white" stroke="black" onclick="start()">
<rect x="0" y="0" width="400" height="5" />
<rect x="0" y="0" width="5" height="200" />
<rect x="0" y="195" width="400" height="5" />
<rect x="395" y="0" width="5" height="200" />
<text font-size="150" font-weight="bold" x="40" y="150">SVG</text>
</g>
<text id="fps" x="150" y="240" font-size="20" fill="white" stroke="white">afps:</text>
<text x="30" y="265" font-size="20" font-weight="bold" fill="white" stroke="white">click on the image to start the animation</text>
<script>
<![CDATA[
var light_x = document.getElementById('light').x;
var light_y = document.getElementById('light').y;
var light_pointsAtX = document.getElementById('light').pointsAtX;
var light_pointsAtY = document.getElementById('light').pointsAtY;
var fps = document.getElementById('fps');
var round = Math.round
var startDate = 0;
var frameCounter = 0;
var phase = 0;
function anim() {
switch(phase) {
case 0:
light_pointsAtX.baseVal += 10;
if (light_pointsAtX.baseVal >= 380)
++phase;
break;
case 1:
light_x.baseVal += 10;
light_pointsAtX.baseVal -= 10;
if (light_x.baseVal >= 450) {
++phase;
waitCounter = 0;
}
break;
case 2:
light_y.baseVal -= 5;
if (light_y.baseVal <= -100)
++phase;
break;
case 3:
light_pointsAtX.baseVal += 10;
if (light_pointsAtX.baseVal >= 450) {
light_x.baseVal = 0;
light_pointsAtX.baseVal = -200;
light_y.baseVal = 300;
light_pointsAtY.baseVal = 100;
phase = 0;
}
break;
}
frameCounter++;
fps.textContent = "afps: " +(round(frameCounter * 100000 / (new Date() - startDate)) / 100);
}
function start() {
if (!startDate) {
startDate = new Date();
setInterval(anim,1);
}
}
//]]>
</script>
</svg>