Diff
Added: trunk/LayoutTests/svg/filters/feDiffuseLighting-feSpotLight-dynamic-update-expected.svg (0 => 295481)
--- trunk/LayoutTests/svg/filters/feDiffuseLighting-feSpotLight-dynamic-update-expected.svg (rev 0)
+++ trunk/LayoutTests/svg/filters/feDiffuseLighting-feSpotLight-dynamic-update-expected.svg 2022-06-13 04:26:54 UTC (rev 295481)
@@ -0,0 +1,11 @@
+<svg width="500px" height="610px" xmlns="http://www.w3.org/2000/svg">
+ <defs>
+ <filter id="filter" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox">
+ <feFlood x="-0.1" y="-0.16"/>
+ </filter>
+ </defs>
+ <rect x="110" y="150" width="400" height="320" fill="none" filter="url(#filter)"/>
+ <ellipse cx="298" cy="328" rx="152" ry="117" fill="rgb(0, 255, 0)" style="transform: rotate(48deg); transform-origin: 50% 50%; transform-box: fill-box;"/>
+ <!-- Mask off slight differences in point light radius -->
+ <ellipse cx="298" cy="328" rx="152" ry="117" fill="none" stroke="gray" stroke-width="20" style="transform: rotate(48deg); transform-origin: 50% 50%; transform-box: fill-box;"/>
+</svg>
Added: trunk/LayoutTests/svg/filters/feDiffuseLighting-feSpotLight-dynamic-update.svg (0 => 295481)
--- trunk/LayoutTests/svg/filters/feDiffuseLighting-feSpotLight-dynamic-update.svg (rev 0)
+++ trunk/LayoutTests/svg/filters/feDiffuseLighting-feSpotLight-dynamic-update.svg 2022-06-13 04:26:54 UTC (rev 295481)
@@ -0,0 +1,34 @@
+<svg width="500px" height="610px" xmlns="http://www.w3.org/2000/svg">
+<defs>
+ <filter id="filter" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox">
+ <feFlood/>
+ <feDiffuseLighting lighting-color="rgb(0, 255, 0)" x="-0.1" y="-0.16">
+ <feSpotLight id="light-source" limitingConeAngle="12" />
+ </feDiffuseLighting>
+ <feComponentTransfer>
+ <feFuncG type="discrete" tableValues="0 1"/>
+ </feComponentTransfer>
+ </filter>
+</defs>
+<rect x="110" y="150" width="400" height="320" fill="none" filter="url(#filter)"/>
+<!-- Mask off slight differences in point light radius -->
+<ellipse cx="298" cy="328" rx="152" ry="117" fill="none" stroke="gray" stroke-width="20" style="transform: rotate(48deg); transform-origin: 50% 50%; transform-box: fill-box;"/>
+<script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ // Make sure the filter is drawn at least once before changing the light source.
+ requestAnimationFrame(() => {
+ requestAnimationFrame(() => {
+ const lightSource = document.getElementById('light-source');
+ lightSource.x.baseVal = -0.4;
+ lightSource.y.baseVal = -0.6;
+ lightSource.z.baseVal = 1.7;
+ lightSource.pointsAtX.baseVal = 0.2;
+ lightSource.pointsAtY.baseVal = 0.2;
+ lightSource.pointsAtZ.baseVal = 0.5;
+ testRunner.notifyDone();
+ });
+ });
+</script>
+</svg>
Added: trunk/LayoutTests/svg/filters/feSpecularLighting-fePointLight-dynamic-update-expected.svg (0 => 295481)
--- trunk/LayoutTests/svg/filters/feSpecularLighting-fePointLight-dynamic-update-expected.svg (rev 0)
+++ trunk/LayoutTests/svg/filters/feSpecularLighting-fePointLight-dynamic-update-expected.svg 2022-06-13 04:26:54 UTC (rev 295481)
@@ -0,0 +1,4 @@
+<svg width="500px" height="580px" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="250" cy="310" r="112" fill="rgb(0, 255, 0)"/>
+ <circle cx="250" cy="310" r="112" fill="none" stroke="gray" stroke-width="20"/>
+</svg>
Added: trunk/LayoutTests/svg/filters/feSpecularLighting-fePointLight-dynamic-update.svg (0 => 295481)
--- trunk/LayoutTests/svg/filters/feSpecularLighting-fePointLight-dynamic-update.svg (rev 0)
+++ trunk/LayoutTests/svg/filters/feSpecularLighting-fePointLight-dynamic-update.svg 2022-06-13 04:26:54 UTC (rev 295481)
@@ -0,0 +1,32 @@
+<svg width="500px" height="580px" xmlns="http://www.w3.org/2000/svg">
+<defs>
+ <filter id="filter" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox">
+ <feFlood/>
+ <feSpecularLighting surfaceScale="10" specularExponent="10" specularConstant="2" lighting-color="rgb(0, 255, 0)">
+ <fePointLight id="light-source"/>
+ </feSpecularLighting>
+ <feComponentTransfer>
+ <feFuncG type="discrete" tableValues="0 1"/>
+ <feFuncA type="discrete" tableValues="0 1"/>
+ </feComponentTransfer>
+ </filter>
+</defs>
+<rect x="110" y="150" width="400" height="320" fill="none" filter="url(#filter)"/>
+<!-- Mask off slight differences in point light radius -->
+<circle cx="250" cy="310" r="112" fill="none" stroke="gray" stroke-width="20"/>
+<script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ // Make sure the filter is drawn at least once before changing the light source.
+ requestAnimationFrame(() => {
+ requestAnimationFrame(() => {
+ const lightSource = document.getElementById('light-source');
+ lightSource.x.baseVal = 0.35;
+ lightSource.y.baseVal = 0.5;
+ lightSource.z.baseVal = 0.2;
+ testRunner.notifyDone();
+ });
+ });
+</script>
+</svg>
Modified: trunk/Source/WebCore/platform/graphics/filters/Filter.h (295480 => 295481)
--- trunk/Source/WebCore/platform/graphics/filters/Filter.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/platform/graphics/filters/Filter.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -23,6 +23,7 @@
#include "FilterEffectVector.h"
#include "FilterFunction.h"
+#include "FloatPoint3D.h"
#include "FloatRect.h"
#include "GraphicsTypes.h"
#include "ImageBuffer.h"
@@ -53,6 +54,7 @@
void setClipOperation(ClipOperation clipOperation) { m_clipOperation = clipOperation; }
virtual FloatSize resolvedSize(const FloatSize& size) const { return size; }
+ virtual FloatPoint3D resolvedPoint3D(const FloatPoint3D& point) const { return point; }
FloatPoint scaledByFilterScale(const FloatPoint&) const;
FloatSize scaledByFilterScale(const FloatSize&) const;
Modified: trunk/Source/WebCore/platform/graphics/filters/PointLightSource.cpp (295480 => 295481)
--- trunk/Source/WebCore/platform/graphics/filters/PointLightSource.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/platform/graphics/filters/PointLightSource.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -5,7 +5,7 @@
* Copyright (C) 2010 Zoltan Herczeg <[email protected]>
* Copyright (C) 2011 University of Szeged
* Copyright (C) 2011 Renata Hodovan <[email protected]>
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -45,17 +45,18 @@
PointLightSource::PointLightSource(const FloatPoint3D& position)
: LightSource(LS_POINT)
- , m_userSpacePosition(position)
+ , m_position(position)
{
}
void PointLightSource::initPaintingData(const Filter& filter, const FilterImage& result, PaintingData&) const
{
- auto absolutePosition = filter.scaledByFilterScale(m_userSpacePosition.xy());
+ auto position = filter.resolvedPoint3D(m_position);
+ auto absolutePosition = filter.scaledByFilterScale(position.xy());
m_bufferPosition.setXY(result.mappedAbsolutePoint(absolutePosition));
- // To scale Z, map a point offset from m_userSpacePosition in the x direction by z.
- auto absoluteMappedZ = filter.scaledByFilterScale(FloatPoint { m_userSpacePosition.x() + m_userSpacePosition.z(), m_userSpacePosition.y() });
+ // To scale Z, map a point offset from position in the x direction by z.
+ auto absoluteMappedZ = filter.scaledByFilterScale(FloatPoint { position.x() + position.z(), position.y() });
m_bufferPosition.setZ(result.mappedAbsolutePoint(absoluteMappedZ).x() - m_bufferPosition.x());
}
@@ -72,25 +73,25 @@
bool PointLightSource::setX(float x)
{
- if (m_userSpacePosition.x() == x)
+ if (m_position.x() == x)
return false;
- m_userSpacePosition.setX(x);
+ m_position.setX(x);
return true;
}
bool PointLightSource::setY(float y)
{
- if (m_userSpacePosition.y() == y)
+ if (m_position.y() == y)
return false;
- m_userSpacePosition.setY(y);
+ m_position.setY(y);
return true;
}
bool PointLightSource::setZ(float z)
{
- if (m_userSpacePosition.z() == z)
+ if (m_position.z() == z)
return false;
- m_userSpacePosition.setZ(z);
+ m_position.setZ(z);
return true;
}
Modified: trunk/Source/WebCore/platform/graphics/filters/PointLightSource.h (295480 => 295481)
--- trunk/Source/WebCore/platform/graphics/filters/PointLightSource.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/platform/graphics/filters/PointLightSource.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -3,7 +3,7 @@
* Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <[email protected]>
* Copyright (C) 2004, 2005 Rob Buis <[email protected]>
* Copyright (C) 2005 Eric Seidel <[email protected]>
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -32,7 +32,7 @@
public:
WEBCORE_EXPORT static Ref<PointLightSource> create(const FloatPoint3D& position);
- const FloatPoint3D& position() const { return m_userSpacePosition; }
+ const FloatPoint3D& position() const { return m_position; }
bool setX(float) override;
bool setY(float) override;
bool setZ(float) override;
@@ -48,7 +48,7 @@
private:
PointLightSource(const FloatPoint3D& position);
- FloatPoint3D m_userSpacePosition;
+ FloatPoint3D m_position;
mutable FloatPoint3D m_bufferPosition;
};
@@ -55,7 +55,7 @@
template<class Encoder>
void PointLightSource::encode(Encoder& encoder) const
{
- encoder << m_userSpacePosition;
+ encoder << m_position;
}
template<class Decoder>
Modified: trunk/Source/WebCore/platform/graphics/filters/SpotLightSource.cpp (295480 => 295481)
--- trunk/Source/WebCore/platform/graphics/filters/SpotLightSource.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/platform/graphics/filters/SpotLightSource.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -6,7 +6,7 @@
* Copyright (C) 2010 Zoltan Herczeg <[email protected]>
* Copyright (C) 2011 University of Szeged
* Copyright (C) 2011 Renata Hodovan <[email protected]>
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -48,10 +48,10 @@
return adoptRef(*new SpotLightSource(position, direction, specularExponent, limitingConeAngle));
}
-SpotLightSource::SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& direction, float specularExponent, float limitingConeAngle)
+SpotLightSource::SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& pointsAt, float specularExponent, float limitingConeAngle)
: LightSource(LS_SPOT)
- , m_userSpacePosition(position)
- , m_userSpacePointsAt(direction)
+ , m_position(position)
+ , m_pointsAt(pointsAt)
, m_specularExponent(specularExponent)
, m_limitingConeAngle(limitingConeAngle)
{
@@ -59,14 +59,17 @@
void SpotLightSource::initPaintingData(const Filter& filter, const FilterImage& result, PaintingData& paintingData) const
{
- auto absolutePosition = filter.scaledByFilterScale(m_userSpacePosition.xy());
+ auto position = filter.resolvedPoint3D(m_position);
+ auto pointsAt = filter.resolvedPoint3D(m_pointsAt);
+
+ auto absolutePosition = filter.scaledByFilterScale(position.xy());
m_bufferPosition.setXY(result.mappedAbsolutePoint(absolutePosition));
- // To scale Z, map a point offset from m_userSpacePosition in the x direction by z.
- auto absoluteMappedZ = filter.scaledByFilterScale(FloatPoint { m_userSpacePosition.x() + m_userSpacePosition.z(), m_userSpacePosition.y() });
+ // To scale Z, map a point offset from position in the x direction by z.
+ auto absoluteMappedZ = filter.scaledByFilterScale(FloatPoint { position.x() + position.z(), position.y() });
m_bufferPosition.setZ(result.mappedAbsolutePoint(absoluteMappedZ).x() - m_bufferPosition.x());
- paintingData.directionVector = m_userSpacePointsAt - m_userSpacePosition;
+ paintingData.directionVector = pointsAt - position;
paintingData.directionVector.normalize();
if (!m_limitingConeAngle) {
@@ -135,49 +138,49 @@
bool SpotLightSource::setX(float x)
{
- if (m_userSpacePosition.x() == x)
+ if (m_position.x() == x)
return false;
- m_userSpacePosition.setX(x);
+ m_position.setX(x);
return true;
}
bool SpotLightSource::setY(float y)
{
- if (m_userSpacePosition.y() == y)
+ if (m_position.y() == y)
return false;
- m_userSpacePosition.setY(y);
+ m_position.setY(y);
return true;
}
bool SpotLightSource::setZ(float z)
{
- if (m_userSpacePosition.z() == z)
+ if (m_position.z() == z)
return false;
- m_userSpacePosition.setZ(z);
+ m_position.setZ(z);
return true;
}
bool SpotLightSource::setPointsAtX(float pointsAtX)
{
- if (m_userSpacePointsAt.x() == pointsAtX)
+ if (m_pointsAt.x() == pointsAtX)
return false;
- m_userSpacePointsAt.setX(pointsAtX);
+ m_pointsAt.setX(pointsAtX);
return true;
}
bool SpotLightSource::setPointsAtY(float pointsAtY)
{
- if (m_userSpacePointsAt.y() == pointsAtY)
+ if (m_pointsAt.y() == pointsAtY)
return false;
- m_userSpacePointsAt.setY(pointsAtY);
+ m_pointsAt.setY(pointsAtY);
return true;
}
bool SpotLightSource::setPointsAtZ(float pointsAtZ)
{
- if (m_userSpacePointsAt.z() == pointsAtZ)
+ if (m_pointsAt.z() == pointsAtZ)
return false;
- m_userSpacePointsAt.setZ(pointsAtZ);
+ m_pointsAt.setZ(pointsAtZ);
return true;
}
Modified: trunk/Source/WebCore/platform/graphics/filters/SpotLightSource.h (295480 => 295481)
--- trunk/Source/WebCore/platform/graphics/filters/SpotLightSource.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/platform/graphics/filters/SpotLightSource.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -3,7 +3,7 @@
* Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <[email protected]>
* Copyright (C) 2004, 2005 Rob Buis <[email protected]>
* Copyright (C) 2005 Eric Seidel <[email protected]>
- * Copyright (C) 2021 Apple Inc. All rights reserved.
+ * Copyright (C) 2021-2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -30,10 +30,10 @@
class SpotLightSource : public LightSource {
public:
- WEBCORE_EXPORT static Ref<SpotLightSource> create(const FloatPoint3D& position, const FloatPoint3D& direction, float specularExponent, float limitingConeAngle);
+ WEBCORE_EXPORT static Ref<SpotLightSource> create(const FloatPoint3D& position, const FloatPoint3D& pointsAt, float specularExponent, float limitingConeAngle);
- const FloatPoint3D& position() const { return m_userSpacePosition; }
- const FloatPoint3D& direction() const { return m_userSpacePointsAt; }
+ const FloatPoint3D& position() const { return m_position; }
+ const FloatPoint3D& direction() const { return m_pointsAt; }
float specularExponent() const { return m_specularExponent; }
float limitingConeAngle() const { return m_limitingConeAngle; }
@@ -58,8 +58,8 @@
private:
SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& direction, float specularExponent, float limitingConeAngle);
- FloatPoint3D m_userSpacePosition;
- FloatPoint3D m_userSpacePointsAt;
+ FloatPoint3D m_position;
+ FloatPoint3D m_pointsAt;
mutable FloatPoint3D m_bufferPosition;
@@ -70,8 +70,8 @@
template<class Encoder>
void SpotLightSource::encode(Encoder& encoder) const
{
- encoder << m_userSpacePosition;
- encoder << m_userSpacePointsAt;
+ encoder << m_position;
+ encoder << m_pointsAt;
encoder << m_specularExponent;
encoder << m_limitingConeAngle;
}
Modified: trunk/Source/WebCore/svg/SVGFEBlendElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEBlendElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEBlendElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -97,7 +97,7 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEBlendElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEBlendElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
return FEBlend::create(mode());
}
Modified: trunk/Source/WebCore/svg/SVGFEBlendElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEBlendElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEBlendElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -71,7 +71,7 @@
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() }, AtomString { in2() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEColorMatrixElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -98,7 +98,7 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEColorMatrixElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEColorMatrixElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
Vector<float> filterValues;
ColorMatrixType filterType = type();
Modified: trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEColorMatrixElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -87,7 +87,7 @@
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEComponentTransferElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -62,7 +62,7 @@
SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value);
}
-RefPtr<FilterEffect> SVGFEComponentTransferElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEComponentTransferElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
ComponentTransferFunction red;
ComponentTransferFunction green;
Modified: trunk/Source/WebCore/svg/SVGFEComponentTransferElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEComponentTransferElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEComponentTransferElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -44,7 +44,7 @@
void parseAttribute(const QualifiedName&, const AtomString&) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFECompositeElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFECompositeElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFECompositeElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -129,7 +129,7 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFECompositeElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFECompositeElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
return FEComposite::create(svgOperator(), k1(), k2(), k3(), k4());
}
Modified: trunk/Source/WebCore/svg/SVGFECompositeElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFECompositeElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFECompositeElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -107,7 +107,7 @@
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() }, AtomString { in2() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -188,7 +188,7 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEConvolveMatrixElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEConvolveMatrixElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
int orderXValue = orderX();
int orderYValue = orderY();
Modified: trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEConvolveMatrixElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -105,7 +105,7 @@
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -148,18 +148,18 @@
primitiveAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEDiffuseLightingElement::filterEffect(const SVGFilter& filter, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEDiffuseLightingElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
RefPtr lightElement = SVGFELightElement::findLightElement(this);
if (!lightElement)
return nullptr;
-
- auto lightSource = lightElement->lightSource(filter);
- RenderObject* renderer = this->renderer();
+ auto* renderer = this->renderer();
if (!renderer)
return nullptr;
+ auto lightSource = lightElement->lightSource();
+
Color color = renderer->style().colorByApplyingColorFilter(renderer->style().svgStyle().lightingColor());
return FEDiffuseLighting::create(color, surfaceScale(), diffuseConstant(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource));
Modified: trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEDiffuseLightingElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -59,7 +59,7 @@
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -113,7 +113,7 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEDisplacementMapElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEDisplacementMapElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
return FEDisplacementMap::create(xChannelSelector(), yChannelSelector(), scale());
}
Modified: trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEDisplacementMapElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -92,7 +92,7 @@
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() }, AtomString { in2() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEDistantLightElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEDistantLightElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEDistantLightElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005 Oliver Hunt <[email protected]>
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -36,7 +37,7 @@
return adoptRef(*new SVGFEDistantLightElement(tagName, document));
}
-Ref<LightSource> SVGFEDistantLightElement::lightSource(const SVGFilter&) const
+Ref<LightSource> SVGFEDistantLightElement::lightSource() const
{
return DistantLightSource::create(azimuth(), elevation());
}
Modified: trunk/Source/WebCore/svg/SVGFEDistantLightElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEDistantLightElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEDistantLightElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005 Oliver Hunt <[email protected]>
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -30,8 +31,9 @@
private:
SVGFEDistantLightElement(const QualifiedName&, Document&);
- Ref<LightSource> lightSource(const SVGFilter&) const override;
+ Ref<LightSource> lightSource() const override;
};
+
static_assert(sizeof(SVGFEDistantLightElement) == sizeof(SVGFELightElement));
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEDropShadowElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -103,7 +103,7 @@
return FEDropShadow::calculateOutsets(offset, stdDeviation);
}
-RefPtr<FilterEffect> SVGFEDropShadowElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEDropShadowElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
RenderObject* renderer = this->renderer();
if (!renderer)
Modified: trunk/Source/WebCore/svg/SVGFEDropShadowElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEDropShadowElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEDropShadowElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -55,7 +55,7 @@
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
IntOutsets outsets(const FloatRect& targetBoundingBox, SVGUnitTypes::SVGUnitType primitiveUnits) const override;
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEFloodElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEFloodElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEFloodElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -59,7 +59,7 @@
return false;
}
-RefPtr<FilterEffect> SVGFEFloodElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEFloodElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
RenderObject* renderer = this->renderer();
if (!renderer)
Modified: trunk/Source/WebCore/svg/SVGFEFloodElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEFloodElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEFloodElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -37,7 +37,7 @@
const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
};
Modified: trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -100,7 +100,7 @@
return FEGaussianBlur::calculateOutsets(stdDeviation);
}
-RefPtr<FilterEffect> SVGFEGaussianBlurElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEGaussianBlurElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
if (stdDeviationX() < 0 || stdDeviationY() < 0)
return nullptr;
Modified: trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEGaussianBlurElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -55,7 +55,7 @@
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
IntOutsets outsets(const FloatRect& targetBoundingBox, SVGUnitTypes::SVGUnitType primitiveUnits) const override;
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEImageElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEImageElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -210,7 +210,7 @@
return { imageBuffer, imageRect };
}
-RefPtr<FilterEffect> SVGFEImageElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const
+RefPtr<FilterEffect> SVGFEImageElement::filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const
{
if (m_cachedImage) {
auto image = m_cachedImage->imageForRenderer(renderer());
Modified: trunk/Source/WebCore/svg/SVGFEImageElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEImageElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEImageElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -56,7 +56,7 @@
std::tuple<RefPtr<ImageBuffer>, FloatRect> imageBufferForEffect(const GraphicsContext& destinationContext) const;
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
void clearResourceReferences();
void requestImageResource();
Modified: trunk/Source/WebCore/svg/SVGFELightElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFELightElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFELightElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -2,7 +2,7 @@
* Copyright (C) 2004, 2005 Nikolas Zimmermann <[email protected]>
* Copyright (C) 2004, 2005, 2006 Rob Buis <[email protected]>
* Copyright (C) 2005 Oliver Hunt <[email protected]>
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -32,7 +32,7 @@
class SVGFELightElement : public SVGElement {
WTF_MAKE_ISO_ALLOCATED(SVGFELightElement);
public:
- virtual Ref<LightSource> lightSource(const SVGFilter&) const = 0;
+ virtual Ref<LightSource> lightSource() const = 0;
static SVGFELightElement* findLightElement(const SVGElement*);
float azimuth() const { return m_azimuth->currentValue(); }
Modified: trunk/Source/WebCore/svg/SVGFEMergeElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEMergeElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEMergeElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -52,7 +52,7 @@
return inputsNames;
}
-RefPtr<FilterEffect> SVGFEMergeElement::filterEffect(const SVGFilter&, const FilterEffectVector& inputs, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEMergeElement::filterEffect(const FilterEffectVector& inputs, const GraphicsContext&) const
{
return FEMerge::create(inputs.size());
}
Modified: trunk/Source/WebCore/svg/SVGFEMergeElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEMergeElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEMergeElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -37,7 +37,7 @@
const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
Vector<AtomString> filterEffectInputsNames() const override;
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
};
Modified: trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEMorphologyElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -112,7 +112,7 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFEMorphologyElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEMorphologyElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
if (radiusX() < 0 || radiusY() < 0)
return nullptr;
Modified: trunk/Source/WebCore/svg/SVGFEMorphologyElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEMorphologyElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEMorphologyElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -82,7 +82,7 @@
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEOffsetElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -85,7 +85,7 @@
return FEOffset::calculateOutsets(offset);
}
-RefPtr<FilterEffect> SVGFEOffsetElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFEOffsetElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
return FEOffset::create(dx(), dy());
}
Modified: trunk/Source/WebCore/svg/SVGFEOffsetElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEOffsetElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEOffsetElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -49,7 +49,7 @@
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
IntOutsets outsets(const FloatRect& targetBoundingBox, SVGUnitTypes::SVGUnitType primitiveUnits) const override;
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFEPointLightElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEPointLightElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEPointLightElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005 Oliver Hunt <[email protected]>
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,13 +21,8 @@
#include "config.h"
#include "SVGFEPointLightElement.h"
-#include "FilterEffectVector.h"
-#include "GeometryUtilities.h"
-#include "ImageBuffer.h"
#include "PointLightSource.h"
-#include "SVGFilter.h"
#include "SVGNames.h"
-#include <wtf/MathExtras.h>
namespace WebCore {
@@ -41,21 +37,9 @@
return adoptRef(*new SVGFEPointLightElement(tagName, document));
}
-Ref<LightSource> SVGFEPointLightElement::lightSource(const SVGFilter& filter) const
+Ref<LightSource> SVGFEPointLightElement::lightSource() const
{
- FloatPoint3D position;
- if (filter.primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
- FloatRect referenceBox = filter.targetBoundingBox();
-
- position.setX(referenceBox.x() + x() * referenceBox.width());
- position.setY(referenceBox.y() + y() * referenceBox.height());
-
- // https://www.w3.org/TR/SVG/filters.html#fePointLightZAttribute and https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage
- position.setZ(z() * euclidianDistance(referenceBox.minXMinYCorner(), referenceBox.maxXMaxYCorner()) / sqrtOfTwoFloat);
- } else
- position = FloatPoint3D(x(), y(), z());
-
- return PointLightSource::create(position);
+ return PointLightSource::create({ x(), y(), z() });
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFEPointLightElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFEPointLightElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFEPointLightElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005 Oliver Hunt <[email protected]>
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -30,8 +31,9 @@
private:
SVGFEPointLightElement(const QualifiedName&, Document&);
- Ref<LightSource> lightSource(const SVGFilter&) const override;
+ Ref<LightSource> lightSource() const override;
};
+
static_assert(sizeof(SVGFEPointLightElement) == sizeof(SVGFELightElement));
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFESpecularLightingElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -158,18 +158,18 @@
primitiveAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFESpecularLightingElement::filterEffect(const SVGFilter& filter, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFESpecularLightingElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
RefPtr lightElement = SVGFELightElement::findLightElement(this);
if (!lightElement)
return nullptr;
- auto lightSource = lightElement->lightSource(filter);
-
- RenderObject* renderer = this->renderer();
+ auto* renderer = this->renderer();
if (!renderer)
return nullptr;
+ auto lightSource = lightElement->lightSource();
+
Color color = renderer->style().colorByApplyingColorFilter(renderer->style().svgStyle().lightingColor());
return FESpecularLighting::create(color, surfaceScale(), specularConstant(), specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource));
Modified: trunk/Source/WebCore/svg/SVGFESpecularLightingElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFESpecularLightingElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFESpecularLightingElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -59,7 +59,7 @@
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFESpotLightElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFESpotLightElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFESpotLightElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005 Oliver Hunt <[email protected]>
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -20,13 +21,8 @@
#include "config.h"
#include "SVGFESpotLightElement.h"
-#include "FilterEffectVector.h"
-#include "GeometryUtilities.h"
-#include "ImageBuffer.h"
-#include "SVGFilter.h"
#include "SVGNames.h"
#include "SpotLightSource.h"
-#include <wtf/MathExtras.h>
namespace WebCore {
@@ -41,29 +37,9 @@
return adoptRef(*new SVGFESpotLightElement(tagName, document));
}
-Ref<LightSource> SVGFESpotLightElement::lightSource(const SVGFilter& filter) const
+Ref<LightSource> SVGFESpotLightElement::lightSource() const
{
- FloatPoint3D position;
- FloatPoint3D pointsAt;
-
- if (filter.primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
- FloatRect referenceBox = filter.targetBoundingBox();
-
- position.setX(referenceBox.x() + x() * referenceBox.width());
- position.setY(referenceBox.y() + y() * referenceBox.height());
- // https://www.w3.org/TR/SVG/filters.html#fePointLightZAttribute and https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage
- position.setZ(z() * euclidianDistance(referenceBox.minXMinYCorner(), referenceBox.maxXMaxYCorner()) / sqrtOfTwoFloat);
-
- pointsAt.setX(referenceBox.x() + pointsAtX() * referenceBox.width());
- pointsAt.setY(referenceBox.y() + pointsAtY() * referenceBox.height());
- // https://www.w3.org/TR/SVG/filters.html#fePointLightZAttribute and https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage
- pointsAt.setZ(pointsAtZ() * euclidianDistance(referenceBox.minXMinYCorner(), referenceBox.maxXMaxYCorner()) / sqrtOfTwoFloat);
- } else {
- position = FloatPoint3D(x(), y(), z());
- pointsAt = FloatPoint3D(pointsAtX(), pointsAtY(), pointsAtZ());
- }
-
- return SpotLightSource::create(position, pointsAt, specularExponent(), limitingConeAngle());
+ return SpotLightSource::create({ x(), y(), z() }, { pointsAtX(), pointsAtY(), pointsAtZ() }, specularExponent(), limitingConeAngle());
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFESpotLightElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFESpotLightElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFESpotLightElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005 Oliver Hunt <[email protected]>
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -30,8 +31,9 @@
private:
SVGFESpotLightElement(const QualifiedName&, Document&);
- Ref<LightSource> lightSource(const SVGFilter&) const override;
+ Ref<LightSource> lightSource() const override;
};
+
static_assert(sizeof(SVGFESpotLightElement) == sizeof(SVGFELightElement));
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGFETileElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFETileElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFETileElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -68,7 +68,7 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFETileElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFETileElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
return FETile::create();
}
Modified: trunk/Source/WebCore/svg/SVGFETileElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFETileElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFETileElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -43,7 +43,7 @@
void svgAttributeChanged(const QualifiedName&) override;
Vector<AtomString> filterEffectInputsNames() const override { return { AtomString { in1() } }; }
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -117,7 +117,7 @@
SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
}
-RefPtr<FilterEffect> SVGFETurbulenceElement::filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext&) const
+RefPtr<FilterEffect> SVGFETurbulenceElement::filterEffect(const FilterEffectVector&, const GraphicsContext&) const
{
if (baseFrequencyX() < 0 || baseFrequencyY() < 0)
return nullptr;
Modified: trunk/Source/WebCore/svg/SVGFETurbulenceElement.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFETurbulenceElement.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFETurbulenceElement.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -119,7 +119,7 @@
void svgAttributeChanged(const QualifiedName&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
- RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
+ RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedNumber> m_baseFrequencyX { SVGAnimatedNumber::create(this) };
Modified: trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h (295480 => 295481)
--- trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -54,7 +54,7 @@
virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
virtual Vector<AtomString> filterEffectInputsNames() const { return { }; }
virtual IntOutsets outsets(const FloatRect&, SVGUnitTypes::SVGUnitType) const { return { }; }
- virtual RefPtr<FilterEffect> filterEffect(const SVGFilter&, const FilterEffectVector&, const GraphicsContext& destinationContext) const = 0;
+ virtual RefPtr<FilterEffect> filterEffect(const FilterEffectVector&, const GraphicsContext& destinationContext) const = 0;
static void invalidateFilterPrimitiveParent(SVGElement*);
Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -24,6 +24,7 @@
#include "SVGFilter.h"
#include "FilterResults.h"
+#include "GeometryUtilities.h"
#include "SVGFilterBuilder.h"
#include "SVGFilterElement.h"
#include "SourceGraphic.h"
@@ -77,6 +78,21 @@
return calculateResolvedSize(size, m_targetBoundingBox, m_primitiveUnits);
}
+FloatPoint3D SVGFilter::resolvedPoint3D(const FloatPoint3D& point) const
+{
+ if (m_primitiveUnits != SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
+ return point;
+
+ FloatPoint3D resolvedPoint;
+ resolvedPoint.setX(m_targetBoundingBox.x() + point.x() * m_targetBoundingBox.width());
+ resolvedPoint.setY(m_targetBoundingBox.y() + point.y() * m_targetBoundingBox.height());
+
+ // https://www.w3.org/TR/SVG/filters.html#fePointLightZAttribute and https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage
+ resolvedPoint.setZ(point.z() * euclidianDistance(m_targetBoundingBox.minXMinYCorner(), m_targetBoundingBox.maxXMaxYCorner()) / sqrtOfTwoFloat);
+
+ return resolvedPoint;
+}
+
bool SVGFilter::supportsAcceleratedRendering() const
{
if (renderingMode() == RenderingMode::Unaccelerated)
Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h (295480 => 295481)
--- trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h 2022-06-13 04:26:54 UTC (rev 295481)
@@ -60,6 +60,7 @@
void setExpression(SVGFilterExpression&& _expression_) { m_expression = WTFMove(_expression_); }
FloatSize resolvedSize(const FloatSize&) const final;
+ FloatPoint3D resolvedPoint3D(const FloatPoint3D&) const final;
bool supportsAcceleratedRendering() const final;
Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp (295480 => 295481)
--- trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp 2022-06-13 03:22:25 UTC (rev 295480)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp 2022-06-13 04:26:54 UTC (rev 295481)
@@ -84,7 +84,7 @@
if (!inputs)
return std::nullopt;
- auto effect = effectElement.filterEffect(filter, *inputs, destinationContext);
+ auto effect = effectElement.filterEffect(*inputs, destinationContext);
if (!effect)
return std::nullopt;