Use more Uint8ClampedArray& and constness in filter and image buffer code
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Nov 2017 20:03:02 +0000 (20:03 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Nov 2017 20:03:02 +0000 (20:03 +0000)
commit6b8bf06dfc0cc77514fd95e1695e20d03e320599
treed9fe41c747ac44b60d485b840a8dc387a5893062
parentc9dc13d27a8c6b8b70740c3ba6c38dba8785a71b
Use more Uint8ClampedArray& and constness in filter and image buffer code
https://bugs.webkit.org/show_bug.cgi?id=180008

Reviewed by Darin Adler.

Source/WebCore:

Use references to Uint8ClampedArrays rather than pointers where necessary.

Use const for source data buffers when possible, and uint8_t for the underlying
data type.

Fix a bug in FEGaussianBlur where the output of the last blur pass wasn't
copied to the result buffer, which required a test adjustment.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::putImageData):
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::genericConvertToLuminanceMask):
* platform/graphics/ImageBuffer.h:
* platform/graphics/ShadowBlur.cpp:
(WebCore::ShadowBlur::blurShadowBuffer):
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::putByteArray):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::putByteArray):
* platform/graphics/cg/ImageBufferDataCG.cpp:
(WebCore::ImageBufferData::getData const):
(WebCore::ImageBufferData::putData):
* platform/graphics/cg/ImageBufferDataCG.h:
* platform/graphics/cpu/arm/filters/FEBlendNEON.h:
(WebCore::FEBlend::platformApplySoftware):
* platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h:
(WebCore::FEComposite::computeArithmeticPixelsNeon):
(WebCore::FEComposite::platformArithmeticNeon):
* platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h:
(WebCore::boxBlurNEON):
* platform/graphics/cpu/arm/filters/NEONHelpers.h:
(WebCore::loadRGBA8AsFloat):
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::effectApplyAccelerated):
(WebCore::effectType):
(WebCore::FEColorMatrix::platformApplySoftware):
* platform/graphics/filters/FEComponentTransfer.cpp:
(WebCore::FEComponentTransfer::platformApplySoftware):
* platform/graphics/filters/FEComposite.cpp:
(WebCore::computeArithmeticPixels):
(WebCore::FEComposite::platformArithmeticSoftware):
(WebCore::FEComposite::platformApplySoftware):
* platform/graphics/filters/FEComposite.h:
* platform/graphics/filters/FEConvolveMatrix.cpp:
(WebCore::setDestinationPixels):
(WebCore::FEConvolveMatrix::fastSetInteriorPixels):
(WebCore::FEConvolveMatrix::fastSetOuterPixels):
(WebCore::FEConvolveMatrix::platformApplySoftware):
* platform/graphics/filters/FEConvolveMatrix.h:
* platform/graphics/filters/FEDisplacementMap.cpp:
(WebCore::FEDisplacementMap::platformApplySoftware):
* platform/graphics/filters/FEDropShadow.cpp:
(WebCore::FEDropShadow::platformApplySoftware):
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::boxBlurAlphaOnly):
(WebCore::boxBlur):
(WebCore::accelerateBoxBlur):
(WebCore::standardBoxBlur):
(WebCore::FEGaussianBlur::platformApplyGeneric):
(WebCore::FEGaussianBlur::platformApplyWorker):
(WebCore::FEGaussianBlur::platformApply):
(WebCore::FEGaussianBlur::platformApplySoftware):
* platform/graphics/filters/FEGaussianBlur.h:
* platform/graphics/filters/FELighting.cpp:
(WebCore::FELighting::drawLighting):
(WebCore::FELighting::platformApplySoftware):
* platform/graphics/filters/FELighting.h:
* platform/graphics/filters/FEMorphology.cpp:
(WebCore::columnExtremum):
(WebCore::FEMorphology::platformApplyGeneric):
(WebCore::FEMorphology::platformApplyDegenerate):
(WebCore::FEMorphology::platformApplySoftware):
* platform/graphics/filters/FEMorphology.h:
* platform/graphics/filters/FETurbulence.cpp:
(WebCore::FETurbulence::fillRegion const):
(WebCore::FETurbulence::fillRegionWorker):
(WebCore::FETurbulence::platformApplySoftware):
* platform/graphics/filters/FETurbulence.h:
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::forceValidPreMultipliedPixels):
(WebCore::FilterEffect::imageBufferResult):
(WebCore::FilterEffect::unmultipliedResult):
(WebCore::FilterEffect::premultipliedResult):
(WebCore::FilterEffect::copyImageBytes const):
(WebCore::copyPremultiplyingAlpha):
(WebCore::copyUnpremultiplyingAlpha):
(WebCore::FilterEffect::copyUnmultipliedResult):
(WebCore::FilterEffect::copyPremultipliedResult):
* platform/graphics/filters/FilterEffect.h:
* platform/graphics/win/ImageBufferDataDirect2D.cpp:
(WebCore::ImageBufferData::putData):
* platform/graphics/win/ImageBufferDataDirect2D.h:

LayoutTests:

Fix a bug in FEGaussianBlur where the output of the last blur pass wasn't
copied to the result buffer, which required a test adjustment.

* css3/filters/filter-on-overflow-hidden-expected.html:
* css3/filters/filter-on-overflow-hidden.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225147 268f45cc-cd09-0410-ab3c-d52691b4dbfc
36 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/filters/filter-on-overflow-hidden-expected.html
LayoutTests/css3/filters/filter-on-overflow-hidden.html
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/platform/graphics/ImageBuffer.cpp
Source/WebCore/platform/graphics/ImageBuffer.h
Source/WebCore/platform/graphics/ShadowBlur.cpp
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp
Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h
Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h
Source/WebCore/platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h
Source/WebCore/platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h
Source/WebCore/platform/graphics/cpu/arm/filters/NEONHelpers.h
Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp
Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp
Source/WebCore/platform/graphics/filters/FEComposite.cpp
Source/WebCore/platform/graphics/filters/FEComposite.h
Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp
Source/WebCore/platform/graphics/filters/FEConvolveMatrix.h
Source/WebCore/platform/graphics/filters/FEDisplacementMap.cpp
Source/WebCore/platform/graphics/filters/FEDropShadow.cpp
Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp
Source/WebCore/platform/graphics/filters/FEGaussianBlur.h
Source/WebCore/platform/graphics/filters/FELighting.cpp
Source/WebCore/platform/graphics/filters/FELighting.h
Source/WebCore/platform/graphics/filters/FEMorphology.cpp
Source/WebCore/platform/graphics/filters/FEMorphology.h
Source/WebCore/platform/graphics/filters/FETurbulence.cpp
Source/WebCore/platform/graphics/filters/FETurbulence.h
Source/WebCore/platform/graphics/filters/FilterEffect.cpp
Source/WebCore/platform/graphics/filters/FilterEffect.h
Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp
Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h