Skip to content

Instantly share code, notes, and snippets.

@annevk
Created June 10, 2025 07:49
Show Gist options
  • Save annevk/565958f7ec46e0bb008a2c41f7956c0f to your computer and use it in GitHub Desktop.
Save annevk/565958f7ec46e0bb008a2c41f7956c0f to your computer and use it in GitHub Desktop.
diff --git a/Source/WebCore/platform/graphics/filters/FELighting.h b/Source/WebCore/platform/graphics/filters/FELighting.h
index eec7371134da..277b719b14db 100644
--- a/Source/WebCore/platform/graphics/filters/FELighting.h
+++ b/Source/WebCore/platform/graphics/filters/FELighting.h
@@ -59,7 +59,7 @@ public:
float kernelUnitLengthY() const { return m_kernelUnitLengthY; }
bool setKernelUnitLengthY(float);
- Ref<LightSource> lightSource() const { return m_lightSource; }
+ LightSource& lightSource() const { return m_lightSource; }
protected:
FELighting(Type, const Color& lightingColor, float surfaceScale, float diffuseConstant, float specularConstant, float specularExponent, float kernelUnitLengthX, float kernelUnitLengthY, Ref<LightSource>&&, DestinationColorSpace);
diff --git a/Source/WebCore/platform/graphics/filters/software/FELightingSoftwareApplier.cpp b/Source/WebCore/platform/graphics/filters/software/FELightingSoftwareApplier.cpp
index f347cf0e49a5..7d1b97128952 100644
--- a/Source/WebCore/platform/graphics/filters/software/FELightingSoftwareApplier.cpp
+++ b/Source/WebCore/platform/graphics/filters/software/FELightingSoftwareApplier.cpp
@@ -204,7 +204,7 @@ bool FELightingSoftwareApplier::apply(const Filter& filter, std::span<const Ref<
data.diffuseConstant = m_effect->diffuseConstant();
data.specularConstant = m_effect->specularConstant();
data.specularExponent = m_effect->specularExponent();
- data.lightSource = m_effect->lightSource().ptr();
+ data.lightSource = m_effect->lightSource();
data.operatingColorSpace = &m_effect->operatingColorSpace();
data.pixels = destinationPixelBuffer.releaseNonNull();
diff --git a/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
index 6ca4da9c157e..2084e199b5c9 100644
--- a/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
+++ b/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
@@ -98,25 +98,25 @@ bool SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect& filterE
case AttributeNames::diffuseConstantAttr:
return effect.setDiffuseConstant(diffuseConstant());
case AttributeNames::azimuthAttr:
- return effect.lightSource()->setAzimuth(lightElement()->azimuth());
+ return effect.lightSource().setAzimuth(lightElement()->azimuth());
case AttributeNames::elevationAttr:
- return effect.lightSource()->setElevation(lightElement()->elevation());
+ return effect.lightSource().setElevation(lightElement()->elevation());
case AttributeNames::xAttr:
- return effect.lightSource()->setX(lightElement()->x());
+ return effect.lightSource().setX(lightElement()->x());
case AttributeNames::yAttr:
- return effect.lightSource()->setY(lightElement()->y());
+ return effect.lightSource().setY(lightElement()->y());
case AttributeNames::zAttr:
- return effect.lightSource()->setZ(lightElement()->z());
+ return effect.lightSource().setZ(lightElement()->z());
case AttributeNames::pointsAtXAttr:
- return effect.lightSource()->setPointsAtX(lightElement()->pointsAtX());
+ return effect.lightSource().setPointsAtX(lightElement()->pointsAtX());
case AttributeNames::pointsAtYAttr:
- return effect.lightSource()->setPointsAtY(lightElement()->pointsAtY());
+ return effect.lightSource().setPointsAtY(lightElement()->pointsAtY());
case AttributeNames::pointsAtZAttr:
- return effect.lightSource()->setPointsAtZ(lightElement()->pointsAtZ());
+ return effect.lightSource().setPointsAtZ(lightElement()->pointsAtZ());
case AttributeNames::specularExponentAttr:
- return effect.lightSource()->setSpecularExponent(lightElement()->specularExponent());
+ return effect.lightSource().setSpecularExponent(lightElement()->specularExponent());
case AttributeNames::limitingConeAngleAttr:
- return effect.lightSource()->setLimitingConeAngle(lightElement()->limitingConeAngle());
+ return effect.lightSource().setLimitingConeAngle(lightElement()->limitingConeAngle());
default:
break;
}
diff --git a/Source/WebCore/svg/SVGFESpecularLightingElement.cpp b/Source/WebCore/svg/SVGFESpecularLightingElement.cpp
index eb7fe21a3093..6325390e4e24 100644
--- a/Source/WebCore/svg/SVGFESpecularLightingElement.cpp
+++ b/Source/WebCore/svg/SVGFESpecularLightingElement.cpp
@@ -106,23 +106,23 @@ bool SVGFESpecularLightingElement::setFilterEffectAttribute(FilterEffect& filter
case AttributeNames::specularExponentAttr:
return effect.setSpecularExponent(specularExponent());
case AttributeNames::azimuthAttr:
- return effect.lightSource()->setAzimuth(lightElement()->azimuth());
+ return effect.lightSource().setAzimuth(lightElement()->azimuth());
case AttributeNames::elevationAttr:
- return effect.lightSource()->setElevation(lightElement()->elevation());
+ return effect.lightSource().setElevation(lightElement()->elevation());
case AttributeNames::xAttr:
- return effect.lightSource()->setX(lightElement()->x());
+ return effect.lightSource().setX(lightElement()->x());
case AttributeNames::yAttr:
- return effect.lightSource()->setY(lightElement()->y());
+ return effect.lightSource().setY(lightElement()->y());
case AttributeNames::zAttr:
- return effect.lightSource()->setZ(lightElement()->z());
+ return effect.lightSource().setZ(lightElement()->z());
case AttributeNames::pointsAtXAttr:
- return effect.lightSource()->setPointsAtX(lightElement()->pointsAtX());
+ return effect.lightSource().setPointsAtX(lightElement()->pointsAtX());
case AttributeNames::pointsAtYAttr:
- return effect.lightSource()->setPointsAtY(lightElement()->pointsAtY());
+ return effect.lightSource().setPointsAtY(lightElement()->pointsAtY());
case AttributeNames::pointsAtZAttr:
- return effect.lightSource()->setPointsAtZ(lightElement()->pointsAtZ());
+ return effect.lightSource().setPointsAtZ(lightElement()->pointsAtZ());
case AttributeNames::limitingConeAngleAttr:
- return effect.lightSource()->setLimitingConeAngle(lightElement()->limitingConeAngle());
+ return effect.lightSource().setLimitingConeAngle(lightElement()->limitingConeAngle());
default:
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment