Skip to content
Permalink
Browse files
[GPU Process] Make SVGFilter and CSSFilter work in the same coordinat…
…es system

https://bugs.webkit.org/show_bug.cgi?id=232457
rdar://85035379

Reviewed by Simon Fraser.

Source/WebCore:

Currently SVGFilter sets the following members of Filter

1. AffineTransform m_absoluteTransform: this is the scaling part from the
   transformation from the target element to the outermost coordinate system
2. FloatSize m_filterResolution: this is the clamping scale if the size
   of the result ImageBuffers exceeds MaxClampedArea

And the CSSFilter sets the following member of Filter:

1. float m_filterScale: this is the document().deviceScaleFactor()

The discrepancy happens also when creating the result ImageBuffers. For
SVGFilter, we create them with scaleFactor = 1. This means the logicalSize
of the ImageBuffer is equal to its backendSize. But for CSSFilter we
create them with scaleFactor = m_filterScale. This means the logicalSize
!= backendSize in this case.

We need to unify the coordinates system for both filters. We need also to
replace the three members by a single FloatSize called "m_filterScale".

* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::image):
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm:
(WebCore::FilterEffectRendererCoreImage::renderToImageBuffer):
(WebCore::FilterEffectRendererCoreImage::destRect const):
* platform/graphics/filters/FEConvolveMatrix.cpp:
(WebCore::FEConvolveMatrix::platformApplySoftware):
* platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::platformApplySoftware):
* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::determineAbsolutePaintRect):
(WebCore::FEDropShadow::platformApplySoftware):
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::calculateKernelSize):
(WebCore::FEGaussianBlur::platformApplySoftware):
* platform/graphics/filters/FEMorphology.cpp:
(WebCore::FEMorphology::determineAbsolutePaintRect):
(WebCore::FEMorphology::platformApplySoftware):
* platform/graphics/filters/FEOffset.cpp:
(WebCore::FEOffset::determineAbsolutePaintRect):
(WebCore::FEOffset::platformApplySoftware):
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* platform/graphics/filters/FETurbulence.cpp:
(WebCore::FETurbulence::fillRegion const):
(WebCore::FETurbulence::platformApplySoftware):
* platform/graphics/filters/Filter.h:
(WebCore::Filter::filterScale const):
(WebCore::Filter::setFilterScale):
(WebCore::Filter::sourceImageRect const):
(WebCore::Filter::setSourceImageRect):
(WebCore::Filter::filterRegion const):
(WebCore::Filter::setFilterRegion):
(WebCore::Filter::scaledByFilterScale const):
(WebCore::Filter::sourceImage):
(WebCore::Filter::setSourceImage):
(WebCore::Filter::Filter):
(WebCore::Filter::filterResolution const): Deleted.
(WebCore::Filter::setFilterResolution): Deleted.
(WebCore::Filter::absoluteTransform const): Deleted.
(WebCore::Filter::isSVGFilter const): Deleted.
(WebCore::Filter::isCSSFilter const): Deleted.
(WebCore::Filter::scaledByFilterResolution const): Deleted.
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::determineFilterPrimitiveSubregion):
(WebCore::FilterEffect::apply):
(WebCore::FilterEffect::imageBufferResult):
(WebCore::FilterEffect::unmultipliedResult):
(WebCore::FilterEffect::premultipliedResult):
(WebCore::FilterEffect::copyImageBytes const):
(WebCore::FilterEffect::convertPixelBufferToColorSpace):
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
(WebCore::FilterEffect::createImageBufferResult):
(WebCore::FilterEffect::createUnmultipliedImageResult):
(WebCore::FilterEffect::createPremultipliedImageResult):
* platform/graphics/filters/SourceGraphic.cpp:
(WebCore::SourceGraphic::determineAbsolutePaintRect):
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::create):
(WebCore::CSSFilter::CSSFilter):
(WebCore::CSSFilter::buildReferenceFilter):
(WebCore::CSSFilter::build):
(WebCore::CSSFilter::allocateBackingStoreIfNeeded):
(WebCore::CSSFilter::determineFilterPrimitiveSubregion):
(WebCore::CSSFilter::clearIntermediateResults):
(WebCore::CSSFilter::setSourceImageRect):
(WebCore::CSSFilter::outputRect const):
* rendering/CSSFilter.h:
* rendering/RenderLayerFilters.cpp:
(WebCore::RenderLayerFilters::buildFilter):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::applyResource):
(WebCore::RenderSVGResourceFilter::postApplyResource):
* rendering/svg/RenderSVGResourceFilter.h:
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::determineAbsolutePaintRect):
(WebCore::FEImage::platformApplySoftware):
* svg/graphics/filters/SVGFilter.cpp:
(WebCore::SVGFilter::SVGFilter):
(WebCore::SVGFilter::scaledByFilterScale const):
(WebCore::SVGFilter::create):
(WebCore::SVGFilter::scaledByFilterResolution const): Deleted.
* svg/graphics/filters/SVGFilter.h:

LayoutTests:

* TestExpectations:
Skip the hidpi reference filter tests till we connect the FilterEffects
to the correct parent Filter.

* platform/ios/TestExpectations:
* platform/mac/TestExpectations:
Remove unnecessary un-skipping for conic-gradients tests since they were
not skipped globally.



Canonical link: https://commits.webkit.org/244103@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
shallawa committed Nov 10, 2021
1 parent fa519eb commit cdd5a8c43b4be87de6fb6fdd33f98da1b5ed8e77
Showing 27 changed files with 279 additions and 194 deletions.
@@ -1,3 +1,20 @@
2021-11-10 Said Abou-Hallawa <said@apple.com>

[GPU Process] Make SVGFilter and CSSFilter work in the same coordinates system
https://bugs.webkit.org/show_bug.cgi?id=232457
rdar://85035379

Reviewed by Simon Fraser.

* TestExpectations:
Skip the hidpi reference filter tests till we connect the FilterEffects
to the correct parent Filter.

* platform/ios/TestExpectations:
* platform/mac/TestExpectations:
Remove unnecessary un-skipping for conic-gradients tests since they were
not skipped globally.

2021-11-10 Geza Lore <glore@igalia.com>

[JSC][ARMv7] Unskip LayoutTests/js/script-tests/stack-overflow-regexp.js
@@ -5172,3 +5172,55 @@ imported/blink/http/tests/plugins [ Skip ]
imported/blink/plugins [ Skip ]
js/dom/reflect-set-onto-dom.html [ Skip ]
userscripts/user-script-plugin-document.html [ Skip ]

# These filter related failures should be fixed once webkit.org/b/232705 is resolved
webkit.org/b/232705 compositing/filters/drop-shadow.html [ Skip ]
webkit.org/b/232705 compositing/filters/simple-image-with-svg-filter.html [ Skip ]
webkit.org/b/232705 css3/filters/backdrop/backdrop-filter-with-border-radius-and-reflection-remove.html [ Skip ]
webkit.org/b/232705 css3/filters/color-interpolation-filters.html [ Skip ]
webkit.org/b/232705 css3/filters/css-opacity-with-drop-shadow.html [ Skip ]
webkit.org/b/232705 css3/filters/drop-shadow.html [ Skip ]
webkit.org/b/232705 css3/filters/effect-brightness-square.html [ Skip ]
webkit.org/b/232705 css3/filters/effect-contrast-square.html [ Skip ]
webkit.org/b/232705 css3/filters/effect-grayscale-square.html [ Skip ]
webkit.org/b/232705 css3/filters/effect-hue-rotate-square.html [ Skip ]
webkit.org/b/232705 css3/filters/effect-invert-square.html [ Skip ]
webkit.org/b/232705 css3/filters/effect-reference-local-url-with-base.html [ Skip ]
webkit.org/b/232705 css3/filters/effect-saturate-square.html [ Skip ]
webkit.org/b/232705 css3/filters/effect-sepia-square.html [ Skip ]
webkit.org/b/232705 css3/filters/filter-is-on-subpixel-position.html [ Skip ]
webkit.org/b/232705 css3/filters/filter-on-overflow-hidden.html [ Skip ]
webkit.org/b/232705 css3/filters/filters-on-svg-root.html [ Skip ]
webkit.org/b/232705 css3/filters/hidpi-feConvolveMatrix.html [ Skip ]
webkit.org/b/232705 css3/filters/hidpi-filter-is-on-subpixel-position.html [ Skip ]
webkit.org/b/232705 css3/filters/invalidate-sourceAlpha.html [ Skip ]
webkit.org/b/232705 css3/filters/null-effect-check.html [ Skip ]
webkit.org/b/232705 css3/filters/reference-filter-set-filter-regions.html [ Skip ]
webkit.org/b/232705 css3/masking/clip-path-filter.html [ Skip ]
webkit.org/b/232705 fast/filter-image/filter-image.html [ Skip ]
webkit.org/b/232705 fast/gradients/conic-gradient-alpha.html [ Skip ]
webkit.org/b/232705 fast/gradients/conic-gradient-extended-stops.html [ Skip ]
webkit.org/b/232705 fast/gradients/conic-gradient.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-and-image-buffer-resolution.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-blur.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-component-transfer.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-hue-rotate.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-invert.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-morphology.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-multiple.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-reference.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-shadow.html [ Skip ]
webkit.org/b/232705 fast/hidpi/filters-turbulence.html [ Skip ]
webkit.org/b/232705 fast/multicol/filter-in-columns.html [ Skip ]
webkit.org/b/232705 http/tests/css/filters-on-iframes.html [ Skip ]
webkit.org/b/232705 imported/blink/css3/filters/effect-reference-add-hw.html [ Skip ]
webkit.org/b/232705 imported/blink/css3/filters/effect-reference-on-transparent-element.html [ Skip ]
webkit.org/b/232705 imported/blink/css3/filters/effect-reference-source-alpha-hw.html [ Skip ]
webkit.org/b/232705 imported/blink/svg/filters/filter-huge-clamping.svg [ Skip ]
webkit.org/b/232705 imported/mozilla/svg/svg-effects-area-unzoomed.xhtml [ Skip ]
webkit.org/b/232705 imported/mozilla/svg/svg-effects-area-zoomed-in.xhtml [ Skip ]
webkit.org/b/232705 imported/mozilla/svg/svg-effects-area-zoomed-out.xhtml [ Skip ]
webkit.org/b/232705 imported/w3c/web-platform-tests/css/css-overflow/overflow-scroll-resize-visibility-hidden.html [ Skip ]
webkit.org/b/232705 svg/custom/feColorMatrix-values-leading-spaces.html [ Skip ]
webkit.org/b/232705 svg/custom/resources-css-scaled.html [ Skip ]
webkit.org/b/232705 svg/filters/big-sized-off-viewport-filter.svg [ Skip ]
@@ -2972,20 +2972,6 @@ http/tests/cookies/only-accept-first-party-cookies.html [ Skip ]

editing/selection/character-granularity-rect.html [ Pass ]

# < iOS12 doesn't support the CG needed for Conic Gradients
http/wpt/css/css-images-4/conic-gradient-parsing.html [ Pass ]
fast/gradients/conic-repeating.html [ Pass ]
fast/gradients/conic.html [ Pass ]
fast/gradients/conic-off-center.html [ Pass ]
fast/gradients/conic-center-outside-box.html [ Pass ]
fast/gradients/conic-extended-stops.html [ Pass ]
fast/gradients/conic-from-angle.html [ Pass ]
fast/gradients/conic-repeating-last-stop.html [ Pass ]
fast/gradients/conic-gradient-alpha.html [ Pass ]
fast/gradients/conic-gradient-extended-stops.html [ Pass ]
fast/gradients/conic-gradient.html [ Pass ]
fast/gradients/conic-two-hints.html [ Pass ]

# <rdar://problem/36455339> LayoutTest compositing/ios/overflow-scroll-touch-tiles.html is a flaky failure
compositing/ios/overflow-scroll-touch-tiles.html [ Pass Failure ]

@@ -1413,18 +1413,6 @@ fast/dom/HTMLMeterElement/meter-styles.html [ Failure ]
imported/blink/fast/text/international/vertical-positioning-with-combining-marks.html [ ImageOnlyFailure ]

# < Mojave doesn't support the CG needed for Conic Gradients
http/wpt/css/css-images-4/conic-gradient-parsing.html [ Pass ]
fast/gradients/conic-repeating.html [ Pass ]
fast/gradients/conic.html [ Pass ]
fast/gradients/conic-off-center.html [ Pass ]
fast/gradients/conic-center-outside-box.html [ Pass ]
fast/gradients/conic-extended-stops.html [ Pass ]
fast/gradients/conic-from-angle.html [ Pass ]
fast/gradients/conic-repeating-last-stop.html [ Pass ]
fast/gradients/conic-gradient-alpha.html [ Pass ]
fast/gradients/conic-gradient-extended-stops.html [ Pass ]
fast/gradients/conic-gradient.html [ Pass ]
fast/gradients/conic-two-hints.html [ Pass ]
[ Mojave ] imported/w3c/web-platform-tests/css/css-images/multiple-position-color-stop-conic.html [ Pass ]

# Dark Mode is Mojave and later.
@@ -1,3 +1,119 @@
2021-11-10 Said Abou-Hallawa <said@apple.com>

[GPU Process] Make SVGFilter and CSSFilter work in the same coordinates system
https://bugs.webkit.org/show_bug.cgi?id=232457
rdar://85035379

Reviewed by Simon Fraser.

Currently SVGFilter sets the following members of Filter

1. AffineTransform m_absoluteTransform: this is the scaling part from the
transformation from the target element to the outermost coordinate system
2. FloatSize m_filterResolution: this is the clamping scale if the size
of the result ImageBuffers exceeds MaxClampedArea

And the CSSFilter sets the following member of Filter:

1. float m_filterScale: this is the document().deviceScaleFactor()

The discrepancy happens also when creating the result ImageBuffers. For
SVGFilter, we create them with scaleFactor = 1. This means the logicalSize
of the ImageBuffer is equal to its backendSize. But for CSSFilter we
create them with scaleFactor = m_filterScale. This means the logicalSize
!= backendSize in this case.

We need to unify the coordinates system for both filters. We need also to
replace the three members by a single FloatSize called "m_filterScale".

* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::image):
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm:
(WebCore::FilterEffectRendererCoreImage::renderToImageBuffer):
(WebCore::FilterEffectRendererCoreImage::destRect const):
* platform/graphics/filters/FEConvolveMatrix.cpp:
(WebCore::FEConvolveMatrix::platformApplySoftware):
* platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::platformApplySoftware):
* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::determineAbsolutePaintRect):
(WebCore::FEDropShadow::platformApplySoftware):
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::calculateKernelSize):
(WebCore::FEGaussianBlur::platformApplySoftware):
* platform/graphics/filters/FEMorphology.cpp:
(WebCore::FEMorphology::determineAbsolutePaintRect):
(WebCore::FEMorphology::platformApplySoftware):
* platform/graphics/filters/FEOffset.cpp:
(WebCore::FEOffset::determineAbsolutePaintRect):
(WebCore::FEOffset::platformApplySoftware):
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* platform/graphics/filters/FETurbulence.cpp:
(WebCore::FETurbulence::fillRegion const):
(WebCore::FETurbulence::platformApplySoftware):
* platform/graphics/filters/Filter.h:
(WebCore::Filter::filterScale const):
(WebCore::Filter::setFilterScale):
(WebCore::Filter::sourceImageRect const):
(WebCore::Filter::setSourceImageRect):
(WebCore::Filter::filterRegion const):
(WebCore::Filter::setFilterRegion):
(WebCore::Filter::scaledByFilterScale const):
(WebCore::Filter::sourceImage):
(WebCore::Filter::setSourceImage):
(WebCore::Filter::Filter):
(WebCore::Filter::filterResolution const): Deleted.
(WebCore::Filter::setFilterResolution): Deleted.
(WebCore::Filter::absoluteTransform const): Deleted.
(WebCore::Filter::isSVGFilter const): Deleted.
(WebCore::Filter::isCSSFilter const): Deleted.
(WebCore::Filter::scaledByFilterResolution const): Deleted.
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::determineFilterPrimitiveSubregion):
(WebCore::FilterEffect::apply):
(WebCore::FilterEffect::imageBufferResult):
(WebCore::FilterEffect::unmultipliedResult):
(WebCore::FilterEffect::premultipliedResult):
(WebCore::FilterEffect::copyImageBytes const):
(WebCore::FilterEffect::convertPixelBufferToColorSpace):
(WebCore::FilterEffect::convertImageBufferToColorSpace):
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
(WebCore::FilterEffect::createImageBufferResult):
(WebCore::FilterEffect::createUnmultipliedImageResult):
(WebCore::FilterEffect::createPremultipliedImageResult):
* platform/graphics/filters/SourceGraphic.cpp:
(WebCore::SourceGraphic::determineAbsolutePaintRect):
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::create):
(WebCore::CSSFilter::CSSFilter):
(WebCore::CSSFilter::buildReferenceFilter):
(WebCore::CSSFilter::build):
(WebCore::CSSFilter::allocateBackingStoreIfNeeded):
(WebCore::CSSFilter::determineFilterPrimitiveSubregion):
(WebCore::CSSFilter::clearIntermediateResults):
(WebCore::CSSFilter::setSourceImageRect):
(WebCore::CSSFilter::outputRect const):
* rendering/CSSFilter.h:
* rendering/RenderLayerFilters.cpp:
(WebCore::RenderLayerFilters::buildFilter):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::applyResource):
(WebCore::RenderSVGResourceFilter::postApplyResource):
* rendering/svg/RenderSVGResourceFilter.h:
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::determineAbsolutePaintRect):
(WebCore::FEImage::platformApplySoftware):
* svg/graphics/filters/SVGFilter.cpp:
(WebCore::SVGFilter::SVGFilter):
(WebCore::SVGFilter::scaledByFilterScale const):
(WebCore::SVGFilter::create):
(WebCore::SVGFilter::scaledByFilterResolution const): Deleted.
* svg/graphics/filters/SVGFilter.h:

2021-11-10 Tyler Wilcock <tyler_w@apple.com>

AX: Make ancestor computation cheaper by setting flags upon child insertion
@@ -126,7 +126,6 @@ RefPtr<Image> CSSFilterImageValue::image(RenderElement& renderer, const FloatSiz
auto cssFilter = CSSFilter::create();
cssFilter->setSourceImage(WTFMove(texture));
cssFilter->setSourceImageRect(imageRect);
cssFilter->setFilterRegion(imageRect);
if (!cssFilter->build(renderer, m_filterOperations, FilterConsumer::FilterFunction))
return &Image::nullImage();
cssFilter->apply();
@@ -242,7 +242,7 @@ static bool isNullOrLinearComponentTransferFunction(const FEComponentTransfer& e
void FilterEffectRendererCoreImage::renderToImageBuffer(FilterEffect& lastEffect)
{
FloatSize clampedSize = ImageBuffer::clampedSize(lastEffect.absolutePaintRect().size());
m_outputImageBuffer = IOSurfaceImageBuffer::create(clampedSize, lastEffect.filter().filterScale(), lastEffect.resultColorSpace(), PixelFormat::BGRA8);
m_outputImageBuffer = IOSurfaceImageBuffer::create(clampedSize, 1, lastEffect.resultColorSpace(), PixelFormat::BGRA8);
if (!m_outputImageBuffer) {
clearResult();
return;
@@ -254,7 +254,6 @@ static bool isNullOrLinearComponentTransferFunction(const FEComponentTransfer& e
FloatRect FilterEffectRendererCoreImage::destRect(const FilterEffect& lastEffect) const
{
IntSize destSize = lastEffect.absolutePaintRect().size();
destSize.scale(lastEffect.filter().filterScale());
FloatRect destRect = FloatRect(FloatPoint(), destSize);
return destRect;
}
@@ -386,8 +386,7 @@ void FEConvolveMatrix::platformApplySoftware()
return;

IntSize paintSize = absolutePaintRect().size();
paintSize.scale(filter().filterScale());


PaintingData paintingData = {
*sourcePixelArray,
destinationPixelArray,
@@ -119,9 +119,8 @@ void FEDisplacementMap::platformApplySoftware()

Filter& filter = this->filter();
IntSize paintSize = absolutePaintRect().size();
paintSize.scale(filter.filterScale());

FloatSize scale = filter.scaledByFilterResolution({ m_scale, m_scale });
FloatSize scale = filter.scaledByFilterScale({ m_scale, m_scale });
float scaleForColorX = scale.width() / 255.0;
float scaleForColorY = scale.height() / 255.0;
float scaledOffsetX = 0.5 - scale.width() * 0.5;
@@ -53,7 +53,7 @@ void FEDropShadow::determineAbsolutePaintRect()

FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect();
FloatRect absoluteOffsetPaintRect(absolutePaintRect);
absoluteOffsetPaintRect.move(filter.scaledByFilterResolution({ m_dx, m_dy }));
absoluteOffsetPaintRect.move(filter.scaledByFilterScale({ m_dx, m_dy }));
absolutePaintRect.unite(absoluteOffsetPaintRect);

IntSize kernelSize = FEGaussianBlur::calculateKernelSize(filter, { m_stdX, m_stdY });
@@ -80,9 +80,8 @@ void FEDropShadow::platformApplySoftware()

Filter& filter = this->filter();

FloatSize blurRadius = 2 * filter.scaledByFilterResolution({ m_stdX, m_stdY });
blurRadius.scale(filter.filterScale());
FloatSize offset = filter.scaledByFilterResolution({ m_dx, m_dy });
FloatSize blurRadius = 2 * filter.scaledByFilterScale({ m_stdX, m_stdY });
FloatSize offset = filter.scaledByFilterScale({ m_dx, m_dy });

FloatRect drawingRegion = drawingRegionOfInputImage(in->absolutePaintRect());
FloatRect drawingRegionWithOffset(drawingRegion);
@@ -485,7 +485,7 @@ IntSize FEGaussianBlur::calculateUnscaledKernelSize(FloatSize stdDeviation)

IntSize FEGaussianBlur::calculateKernelSize(const Filter& filter, FloatSize stdDeviation)
{
return calculateUnscaledKernelSize(filter.scaledByFilterResolution(stdDeviation));
return calculateUnscaledKernelSize(filter.scaledByFilterScale(stdDeviation));
}

IntSize FEGaussianBlur::calculateOutsetSize(FloatSize stdDeviation)
@@ -537,10 +537,8 @@ void FEGaussianBlur::platformApplySoftware()
return;

IntSize kernelSize = calculateKernelSize(filter(), { m_stdX, m_stdY });
kernelSize.scale(filter().filterScale());

IntSize paintSize = absolutePaintRect().size();
paintSize.scale(filter().filterScale());
auto tmpImageData = Uint8ClampedArray::tryCreateUninitialized(paintSize.area() * 4);
if (!tmpImageData)
return;
@@ -76,7 +76,7 @@ void FEMorphology::determineAbsolutePaintRect()
{
FloatRect paintRect = inputEffect(0)->absolutePaintRect();
Filter& filter = this->filter();
paintRect.inflate(filter.scaledByFilterResolution({ m_radiusX, m_radiusY }));
paintRect.inflate(filter.scaledByFilterScale({ m_radiusX, m_radiusY }));
if (clipsToBounds())
paintRect.intersect(maxEffectRect());
else
@@ -263,7 +263,7 @@ void FEMorphology::platformApplySoftware()
if (!sourcePixelArray)
return;

radius = flooredIntSize(filter.scaledByFilterResolution({ m_radiusX, m_radiusY }));
radius = flooredIntSize(filter.scaledByFilterScale({ m_radiusX, m_radiusY }));
int radiusX = std::min(effectDrawingRect.width() - 1, radius.width());
int radiusY = std::min(effectDrawingRect.height() - 1, radius.height());

@@ -273,10 +273,10 @@ void FEMorphology::platformApplySoftware()
PaintingData paintingData;
paintingData.srcPixelArray = sourcePixelArray.get();
paintingData.dstPixelArray = &destinationPixelArray;
paintingData.width = ceilf(effectDrawingRect.width() * filter.filterScale());
paintingData.height = ceilf(effectDrawingRect.height() * filter.filterScale());
paintingData.radiusX = ceilf(radiusX * filter.filterScale());
paintingData.radiusY = ceilf(radiusY * filter.filterScale());
paintingData.width = ceilf(effectDrawingRect.width());
paintingData.height = ceilf(effectDrawingRect.height());
paintingData.radiusX = ceilf(radiusX);
paintingData.radiusY = ceilf(radiusY);

platformApply(paintingData);
}
@@ -56,7 +56,7 @@ void FEOffset::determineAbsolutePaintRect()
{
FloatRect paintRect = inputEffect(0)->absolutePaintRect();
Filter& filter = this->filter();
paintRect.move(filter.scaledByFilterResolution({ m_dx, m_dy }));
paintRect.move(filter.scaledByFilterScale({ m_dx, m_dy }));
if (clipsToBounds())
paintRect.intersect(maxEffectRect());
else
@@ -77,7 +77,7 @@ void FEOffset::platformApplySoftware()

FloatRect drawingRegion = drawingRegionOfInputImage(in->absolutePaintRect());
Filter& filter = this->filter();
drawingRegion.move(filter.scaledByFilterResolution({ m_dx, m_dy }));
drawingRegion.move(filter.scaledByFilterScale({ m_dx, m_dy }));
resultImage->context().drawImageBuffer(*inBuffer, drawingRegion);
}

@@ -61,7 +61,7 @@ void FETile::platformApplySoftware()
if (in->filterType() == FilterEffect::Type::SourceGraphic || in->filterType() == FilterEffect::Type::SourceAlpha) {
Filter& filter = this->filter();
tileRect = filter.filterRegion();
tileRect.scale(filter.filterResolution().width(), filter.filterResolution().height());
tileRect.scale(filter.filterScale());
}

auto tileImage = SVGRenderingContext::createImageBuffer(tileRect, tileRect, DestinationColorSpace::SRGB(), filter().renderingMode());

0 comments on commit cdd5a8c

Please sign in to comment.