Changeset 285916 in webkit
- Timestamp:
- Nov 16, 2021, 10:24:11 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 49 edited
-
ChangeLog (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
platform/graphics/cpu/arm/filters/FEBlendNEON.h (modified) (4 diffs)
-
platform/graphics/filters/FEBlend.cpp (modified) (3 diffs)
-
platform/graphics/filters/FEBlend.h (modified) (1 diff)
-
platform/graphics/filters/FEColorMatrix.cpp (modified) (4 diffs)
-
platform/graphics/filters/FEColorMatrix.h (modified) (1 diff)
-
platform/graphics/filters/FEComponentTransfer.cpp (modified) (3 diffs)
-
platform/graphics/filters/FEComponentTransfer.h (modified) (1 diff)
-
platform/graphics/filters/FEComposite.cpp (modified) (6 diffs)
-
platform/graphics/filters/FEComposite.h (modified) (1 diff)
-
platform/graphics/filters/FEConvolveMatrix.cpp (modified) (5 diffs)
-
platform/graphics/filters/FEConvolveMatrix.h (modified) (1 diff)
-
platform/graphics/filters/FEDisplacementMap.cpp (modified) (4 diffs)
-
platform/graphics/filters/FEDisplacementMap.h (modified) (1 diff)
-
platform/graphics/filters/FEDropShadow.cpp (modified) (5 diffs)
-
platform/graphics/filters/FEDropShadow.h (modified) (1 diff)
-
platform/graphics/filters/FEFlood.cpp (modified) (1 diff)
-
platform/graphics/filters/FEFlood.h (modified) (1 diff)
-
platform/graphics/filters/FEGaussianBlur.cpp (modified) (4 diffs)
-
platform/graphics/filters/FEGaussianBlur.h (modified) (1 diff)
-
platform/graphics/filters/FELighting.cpp (modified) (3 diffs)
-
platform/graphics/filters/FELighting.h (modified) (1 diff)
-
platform/graphics/filters/FEMerge.cpp (modified) (3 diffs)
-
platform/graphics/filters/FEMerge.h (modified) (1 diff)
-
platform/graphics/filters/FEMorphology.cpp (modified) (5 diffs)
-
platform/graphics/filters/FEMorphology.h (modified) (1 diff)
-
platform/graphics/filters/FEOffset.cpp (modified) (3 diffs)
-
platform/graphics/filters/FEOffset.h (modified) (1 diff)
-
platform/graphics/filters/FETile.cpp (modified) (5 diffs)
-
platform/graphics/filters/FETile.h (modified) (1 diff)
-
platform/graphics/filters/FETurbulence.cpp (modified) (5 diffs)
-
platform/graphics/filters/FETurbulence.h (modified) (1 diff)
-
platform/graphics/filters/Filter.h (modified) (2 diffs)
-
platform/graphics/filters/FilterEffect.cpp (modified) (3 diffs)
-
platform/graphics/filters/FilterEffect.h (modified) (4 diffs)
-
platform/graphics/filters/FilterEffectVector.h (added)
-
platform/graphics/filters/FilterFunction.h (modified) (2 diffs)
-
platform/graphics/filters/SourceAlpha.cpp (modified) (1 diff)
-
platform/graphics/filters/SourceAlpha.h (modified) (1 diff)
-
platform/graphics/filters/SourceGraphic.cpp (modified) (1 diff)
-
platform/graphics/filters/SourceGraphic.h (modified) (1 diff)
-
rendering/CSSFilter.cpp (modified) (2 diffs)
-
rendering/CSSFilter.h (modified) (1 diff)
-
svg/graphics/filters/SVGFEImage.cpp (modified) (3 diffs)
-
svg/graphics/filters/SVGFEImage.h (modified) (1 diff)
-
svg/graphics/filters/SVGFilter.cpp (modified) (2 diffs)
-
svg/graphics/filters/SVGFilter.h (modified) (3 diffs)
-
svg/graphics/filters/SVGFilterBuilder.cpp (modified) (2 diffs)
-
svg/graphics/filters/SVGFilterBuilder.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r285915 r285916 1 2021-11-16 Said Abou-Hallawa <said@apple.com> 2 3 [GPU Process] Build a postfix expression for applying the FilterEffects of the SVGFilter 4 https://bugs.webkit.org/show_bug.cgi?id=233214 5 6 Reviewed by Cameron McCormack. 7 8 The goal of building this expression is to have all inputs of each 9 FilterEffect be applied before applying it. This will eliminate the need 10 to do recursive applying in FilterEffect::apply(). And it will also 11 eliminate the need to store the rectangle of the result of FilterEffect. 12 Once the absolutePaintRect is calculated, the result image can be created. 13 14 Filter::apply() and FilterEffect::apply() should return a boolean so the 15 caller knows that applying the filter function was not successful. 16 17 * WebCore.xcodeproj/project.pbxproj: 18 * platform/graphics/cpu/arm/filters/FEBlendNEON.h: 19 (WebCore::FEBlend::platformApplySoftware): 20 * platform/graphics/filters/FEBlend.cpp: 21 (WebCore::FEBlend::platformApplySoftware): 22 * platform/graphics/filters/FEBlend.h: 23 * platform/graphics/filters/FEColorMatrix.cpp: 24 (WebCore::FEColorMatrix::platformApplySoftware): 25 * platform/graphics/filters/FEColorMatrix.h: 26 * platform/graphics/filters/FEComponentTransfer.cpp: 27 (WebCore::FEComponentTransfer::platformApplySoftware): 28 * platform/graphics/filters/FEComponentTransfer.h: 29 * platform/graphics/filters/FEComposite.cpp: 30 (WebCore::FEComposite::platformApplySoftware): 31 * platform/graphics/filters/FEComposite.h: 32 * platform/graphics/filters/FEConvolveMatrix.cpp: 33 (WebCore::FEConvolveMatrix::platformApplySoftware): 34 * platform/graphics/filters/FEConvolveMatrix.h: 35 * platform/graphics/filters/FEDisplacementMap.cpp: 36 (WebCore::FEDisplacementMap::platformApplySoftware): 37 * platform/graphics/filters/FEDisplacementMap.h: 38 * platform/graphics/filters/FEDropShadow.cpp: 39 (WebCore::FEDropShadow::platformApplySoftware): 40 * platform/graphics/filters/FEDropShadow.h: 41 * platform/graphics/filters/FEFlood.cpp: 42 (WebCore::FEFlood::platformApplySoftware): 43 * platform/graphics/filters/FEFlood.h: 44 * platform/graphics/filters/FEGaussianBlur.cpp: 45 (WebCore::FEGaussianBlur::platformApplySoftware): 46 * platform/graphics/filters/FEGaussianBlur.h: 47 * platform/graphics/filters/FELighting.cpp: 48 (WebCore::FELighting::platformApplySoftware): 49 * platform/graphics/filters/FELighting.h: 50 * platform/graphics/filters/FEMerge.cpp: 51 (WebCore::FEMerge::platformApplySoftware): 52 * platform/graphics/filters/FEMerge.h: 53 * platform/graphics/filters/FEMorphology.cpp: 54 (WebCore::FEMorphology::platformApplySoftware): 55 * platform/graphics/filters/FEMorphology.h: 56 * platform/graphics/filters/FEOffset.cpp: 57 (WebCore::FEOffset::platformApplySoftware): 58 * platform/graphics/filters/FEOffset.h: 59 * platform/graphics/filters/FETile.cpp: 60 (WebCore::FETile::platformApplySoftware): 61 * platform/graphics/filters/FETile.h: 62 * platform/graphics/filters/FETurbulence.cpp: 63 (WebCore::FETurbulence::platformApplySoftware): 64 * platform/graphics/filters/FETurbulence.h: 65 * platform/graphics/filters/Filter.h: 66 * platform/graphics/filters/FilterEffect.cpp: 67 (WebCore::FilterEffect::apply): 68 * platform/graphics/filters/FilterEffect.h: 69 * platform/graphics/filters/FilterEffectVector.h: Added. 70 * platform/graphics/filters/FilterFunction.h: 71 (WebCore::FilterFunction::apply): 72 * platform/graphics/filters/SourceAlpha.cpp: 73 (WebCore::SourceAlpha::platformApplySoftware): 74 * platform/graphics/filters/SourceAlpha.h: 75 * platform/graphics/filters/SourceGraphic.cpp: 76 (WebCore::SourceGraphic::platformApplySoftware): 77 * platform/graphics/filters/SourceGraphic.h: 78 * rendering/CSSFilter.cpp: 79 (WebCore::CSSFilter::apply): 80 * rendering/CSSFilter.h: 81 * svg/graphics/filters/SVGFEImage.cpp: 82 (WebCore::FEImage::platformApplySoftware): 83 * svg/graphics/filters/SVGFEImage.h: 84 * svg/graphics/filters/SVGFilter.cpp: 85 (WebCore::SVGFilter::create): 86 (WebCore::SVGFilter::apply): 87 (WebCore::SVGFilter::outsets const): 88 (WebCore::SVGFilter::clearResult): 89 * svg/graphics/filters/SVGFilter.h: 90 * svg/graphics/filters/SVGFilterBuilder.cpp: 91 (WebCore::buildEffectExpression): 92 (WebCore::SVGFilterBuilder::buildExpression const): 93 * svg/graphics/filters/SVGFilterBuilder.h: 94 1 95 2021-11-16 Joonghun Park <jh718.park@samsung.com> 2 96 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r285867 r285916 10853 10853 721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedValueProperty.h; sourceTree = "<group>"; }; 10854 10854 721443462240CAD200F12FF7 /* SVGValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGValueProperty.h; sourceTree = "<group>"; }; 10855 7214B9B7274458FA003BE6DF /* FilterEffectVector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilterEffectVector.h; sourceTree = "<group>"; }; 10855 10856 721B496F2512AC0400FE9D3B /* ImageBitmapBacking.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBitmapBacking.cpp; sourceTree = "<group>"; }; 10856 10857 721B49702512AC0400FE9D3B /* ImageBitmapBacking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBitmapBacking.h; sourceTree = "<group>"; }; … … 25926 25927 2C85653824C10B0B00A37673 /* FilterEffectRenderer.cpp */, 25927 25928 2C85653324C0F73C00A37673 /* FilterEffectRenderer.h */, 25929 7214B9B7274458FA003BE6DF /* FilterEffectVector.h */, 25928 25930 7262D757272A174100C56A09 /* FilterFunction.cpp */, 25929 25931 7262D756272A174100C56A09 /* FilterFunction.h */, -
trunk/Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h
r285796 r285916 107 107 }; 108 108 109 voidFEBlend::platformApplySoftware(const Filter&)109 bool FEBlend::platformApplySoftware(const Filter&) 110 110 { 111 111 FilterEffect* in = inputEffect(0); … … 114 114 auto& destinationPixelBuffer = createPremultipliedImageResult(); 115 115 if (!destinationPixelBuffer) 116 return ;116 return false; 117 117 118 118 auto& destinationPixelArray = destinationPixelBuffer->data(); … … 129 129 if (sourcePixelArrayLength >= 8) { 130 130 platformApplyNEON(sourcePixelArrayA->data(), sourcePixelArrayB->data(), destinationPixelArray.data(), sourcePixelArrayLength); 131 return ;131 return true; 132 132 } 133 133 // If there is just one pixel we expand it to two. … … 140 140 platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8); 141 141 reinterpret_cast<uint32_t*>(destinationPixelArray.data())[0] = sourceBAndDest[0]; 142 return true; 142 143 } 143 144 -
trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp
r285796 r285916 55 55 56 56 #if !HAVE(ARM_NEON_INTRINSICS) 57 voidFEBlend::platformApplySoftware(const Filter&)57 bool FEBlend::platformApplySoftware(const Filter&) 58 58 { 59 59 FilterEffect* in = inputEffect(0); … … 62 62 ImageBuffer* resultImage = createImageBufferResult(); 63 63 if (!resultImage) 64 return ;64 return false; 65 65 GraphicsContext& filterContext = resultImage->context(); 66 66 … … 68 68 ImageBuffer* imageBuffer2 = in2->imageBufferResult(); 69 69 if (!imageBuffer || !imageBuffer2) 70 return ;70 return false; 71 71 72 72 filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect())); 73 73 filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, { CompositeOperator::SourceOver, m_mode }); 74 return true; 74 75 } 75 76 #endif -
trunk/Source/WebCore/platform/graphics/filters/FEBlend.h
r285796 r285916 38 38 FEBlend(BlendMode); 39 39 40 voidplatformApplySoftware(const Filter&) override;40 bool platformApplySoftware(const Filter&) override; 41 41 void platformApplyGeneric(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray, 42 42 unsigned colorArrayLength); -
trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp
r285796 r285916 274 274 } 275 275 276 voidFEColorMatrix::platformApplySoftware(const Filter&)276 bool FEColorMatrix::platformApplySoftware(const Filter&) 277 277 { 278 278 FilterEffect* in = inputEffect(0); … … 280 280 ImageBuffer* resultImage = createImageBufferResult(); 281 281 if (!resultImage) 282 return ;282 return false; 283 283 284 284 ImageBuffer* inBuffer = in->imageBufferResult(); … … 290 290 auto pixelBuffer = resultImage->getPixelBuffer(format, imageRect); 291 291 if (!pixelBuffer) 292 return ;292 return false; 293 293 294 294 auto& pixelArray = pixelBuffer->data(); … … 316 316 317 317 resultImage->putPixelBuffer(*pixelBuffer, imageRect); 318 return true; 318 319 } 319 320 -
trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.h
r285796 r285916 51 51 FEColorMatrix(ColorMatrixType, Vector<float>&&); 52 52 53 voidplatformApplySoftware(const Filter&) override;53 bool platformApplySoftware(const Filter&) override; 54 54 55 55 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp
r285796 r285916 102 102 } 103 103 104 voidFEComponentTransfer::platformApplySoftware(const Filter&)104 bool FEComponentTransfer::platformApplySoftware(const Filter&) 105 105 { 106 106 FilterEffect* in = inputEffect(0); … … 108 108 auto& destinationPixelBuffer = createUnmultipliedImageResult(); 109 109 if (!destinationPixelBuffer) 110 return ;110 return false; 111 111 112 112 auto& destinationPixelArray = destinationPixelBuffer->data(); … … 128 128 data[pixelOffset + 3] = alphaTable[data[pixelOffset + 3]]; 129 129 } 130 131 return true; 130 132 } 131 133 -
trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.h
r285796 r285916 72 72 void computeLookupTables(LookupTable& redTable, LookupTable& greenTable, LookupTable& blueTable, LookupTable& alphaTable); 73 73 74 voidplatformApplySoftware(const Filter&) override;74 bool platformApplySoftware(const Filter&) override; 75 75 76 76 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FEComposite.cpp
r285796 r285916 224 224 } 225 225 226 voidFEComposite::platformApplySoftware(const Filter&)226 bool FEComposite::platformApplySoftware(const Filter&) 227 227 { 228 228 FilterEffect* in = inputEffect(0); … … 232 232 auto& destinationPixelBuffer = createPremultipliedImageResult(); 233 233 if (!destinationPixelBuffer) 234 return ;234 return false; 235 235 236 236 auto& destinationPixelArray = destinationPixelBuffer->data(); … … 239 239 auto sourcePixelArray = in->premultipliedResult(effectADrawingRect, operatingColorSpace()); 240 240 if (!sourcePixelArray) 241 return ;241 return false; 242 242 243 243 IntRect effectBDrawingRect = requestedRegionOfInputPixelBuffer(in2->absolutePaintRect()); … … 245 245 246 246 platformArithmeticSoftware(*sourcePixelArray, destinationPixelArray, m_k1, m_k2, m_k3, m_k4); 247 return ;247 return true; 248 248 } 249 249 250 250 ImageBuffer* resultImage = createImageBufferResult(); 251 251 if (!resultImage) 252 return ;252 return false; 253 253 GraphicsContext& filterContext = resultImage->context(); 254 254 … … 256 256 ImageBuffer* imageBuffer2 = in2->imageBufferResult(); 257 257 if (!imageBuffer || !imageBuffer2) 258 return ;258 return false; 259 259 260 260 switch (m_type) { … … 296 296 break; 297 297 } 298 299 return true; 298 300 } 299 301 -
trunk/Source/WebCore/platform/graphics/filters/FEComposite.h
r285796 r285916 66 66 void determineAbsolutePaintRect(const Filter&) override; 67 67 68 voidplatformApplySoftware(const Filter&) override;68 bool platformApplySoftware(const Filter&) override; 69 69 70 70 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp
r285796 r285916 362 362 } 363 363 364 voidFEConvolveMatrix::platformApplySoftware(const Filter&)364 bool FEConvolveMatrix::platformApplySoftware(const Filter&) 365 365 { 366 366 FilterEffect* in = inputEffect(0); … … 368 368 auto& destinationPixelBuffer = m_preserveAlpha ? createUnmultipliedImageResult() : createPremultipliedImageResult(); 369 369 if (!destinationPixelBuffer) 370 return ;370 return false; 371 371 372 372 auto& destinationPixelArray = destinationPixelBuffer->data(); … … 380 380 sourcePixelArray = in->premultipliedResult(effectDrawingRect, operatingColorSpace()); 381 381 if (!sourcePixelArray) 382 return ;382 return false; 383 383 384 384 IntSize paintSize = absolutePaintRect().size(); … … 398 398 399 399 if (clipRight < 0 || clipBottom < 0) { 400 // Rare situation, not optimiz ied for speed400 // Rare situation, not optimized for speed 401 401 setOuterPixels(paintingData, 0, 0, paintSize.width(), paintSize.height()); 402 return ;402 return true; 403 403 } 404 404 … … 426 426 if (clipRight < paintSize.width()) 427 427 setOuterPixels(paintingData, clipRight, m_targetOffset.y(), paintSize.width(), clipBottom); 428 429 return true; 428 430 } 429 431 -
trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.h
r285796 r285916 79 79 void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); } 80 80 81 voidplatformApplySoftware(const Filter&) override;81 bool platformApplySoftware(const Filter&) override; 82 82 83 83 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FEDisplacementMap.cpp
r285796 r285916 91 91 } 92 92 93 voidFEDisplacementMap::platformApplySoftware(const Filter& filter)93 bool FEDisplacementMap::platformApplySoftware(const Filter& filter) 94 94 { 95 95 FilterEffect* in = inputEffect(0); … … 101 101 auto& destinationPixelBuffer = createPremultipliedImageResult(); 102 102 if (!destinationPixelBuffer) 103 return ;103 return false; 104 104 105 105 auto& destinationPixelArray = destinationPixelBuffer->data(); … … 113 113 114 114 if (!inputImage || !displacementImage) 115 return ;115 return false; 116 116 117 117 ASSERT(inputImage->length() == displacementImage->length()); … … 148 148 } 149 149 } 150 151 return true; 150 152 } 151 153 -
trunk/Source/WebCore/platform/graphics/filters/FEDisplacementMap.h
r285796 r285916 54 54 FEDisplacementMap(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float); 55 55 56 voidplatformApplySoftware(const Filter&) override;56 bool platformApplySoftware(const Filter&) override; 57 57 58 58 void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); } -
trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp
r285796 r285916 70 70 } 71 71 72 voidFEDropShadow::platformApplySoftware(const Filter& filter)72 bool FEDropShadow::platformApplySoftware(const Filter& filter) 73 73 { 74 74 FilterEffect* in = inputEffect(0); … … 76 76 ImageBuffer* resultImage = createImageBufferResult(); 77 77 if (!resultImage) 78 return ;78 return false; 79 79 80 80 FloatSize blurRadius = 2 * filter.scaledByFilterScale({ m_stdX, m_stdY }); … … 87 87 ImageBuffer* sourceImage = in->imageBufferResult(); 88 88 if (!sourceImage) 89 return ;89 return false; 90 90 91 91 GraphicsContext& resultContext = resultImage->context(); … … 100 100 auto pixelBuffer = resultImage->getPixelBuffer(format, shadowArea); 101 101 if (!pixelBuffer) 102 return ;102 return false; 103 103 104 104 auto& sourcePixelArray = pixelBuffer->data(); … … 112 112 113 113 resultImage->context().drawImageBuffer(*sourceImage, drawingRegion); 114 115 return true; 114 116 } 115 117 -
trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.h
r285796 r285916 54 54 IntOutsets outsets() const override; 55 55 56 voidplatformApplySoftware(const Filter&) override;56 bool platformApplySoftware(const Filter&) override; 57 57 58 58 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FEFlood.cpp
r285796 r285916 59 59 } 60 60 61 voidFEFlood::platformApplySoftware(const Filter&)61 bool FEFlood::platformApplySoftware(const Filter&) 62 62 { 63 63 ImageBuffer* resultImage = createImageBufferResult(); 64 64 if (!resultImage) 65 return ;65 return false; 66 66 67 67 auto color = floodColor().colorWithAlphaMultipliedBy(floodOpacity()); 68 68 resultImage->context().fillRect(FloatRect(FloatPoint(), absolutePaintRect().size()), color); 69 70 return true; 69 71 } 70 72 -
trunk/Source/WebCore/platform/graphics/filters/FEFlood.h
r285796 r285916 49 49 void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); } 50 50 51 voidplatformApplySoftware(const Filter&) override;51 bool platformApplySoftware(const Filter&) override; 52 52 53 53 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp
r285796 r285916 520 520 } 521 521 522 voidFEGaussianBlur::platformApplySoftware(const Filter& filter)522 bool FEGaussianBlur::platformApplySoftware(const Filter& filter) 523 523 { 524 524 FilterEffect* in = inputEffect(0); … … 526 526 auto& destinationPixelBuffer = createPremultipliedImageResult(); 527 527 if (!destinationPixelBuffer) 528 return ;528 return false; 529 529 530 530 auto& destinationPixelArray = destinationPixelBuffer->data(); … … 535 535 in->copyPremultipliedResult(destinationPixelArray, effectDrawingRect, operatingColorSpace()); 536 536 if (!m_stdX && !m_stdY) 537 return ;537 return true; 538 538 539 539 IntSize kernelSize = calculateKernelSize(filter, { m_stdX, m_stdY }); … … 542 542 auto tmpImageData = Uint8ClampedArray::tryCreateUninitialized(paintSize.area() * 4); 543 543 if (!tmpImageData) 544 return ;544 return false; 545 545 546 546 platformApply(destinationPixelArray, *tmpImageData, kernelSize.width(), kernelSize.height(), paintSize); 547 return true; 547 548 } 548 549 -
trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h
r285796 r285916 61 61 void determineAbsolutePaintRect(const Filter&) override; 62 62 63 voidplatformApplySoftware(const Filter&) override;63 bool platformApplySoftware(const Filter&) override; 64 64 65 65 IntOutsets outsets() const override; -
trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp
r285796 r285916 472 472 } 473 473 474 voidFELighting::platformApplySoftware(const Filter&)474 bool FELighting::platformApplySoftware(const Filter&) 475 475 { 476 476 FilterEffect* in = inputEffect(0); … … 478 478 auto& destinationPixelBuffer = createPremultipliedImageResult(); 479 479 if (!destinationPixelBuffer) 480 return ;480 return false; 481 481 482 482 auto& destinationPixelArray = destinationPixelBuffer->data(); … … 493 493 IntSize absolutePaintSize = absolutePaintRect().size(); 494 494 drawLighting(destinationPixelArray, absolutePaintSize.width(), absolutePaintSize.height()); 495 return true; 495 496 } 496 497 -
trunk/Source/WebCore/platform/graphics/filters/FELighting.h
r285796 r285916 135 135 void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); } 136 136 137 voidplatformApplySoftware(const Filter&) override;137 bool platformApplySoftware(const Filter&) override; 138 138 139 139 void platformApply(const LightingData&, const LightSource::PaintingData&); -
trunk/Source/WebCore/platform/graphics/filters/FEMerge.cpp
r285796 r285916 39 39 } 40 40 41 voidFEMerge::platformApplySoftware(const Filter&)41 bool FEMerge::platformApplySoftware(const Filter&) 42 42 { 43 43 unsigned size = numberOfEffectInputs(); … … 46 46 ImageBuffer* resultImage = createImageBufferResult(); 47 47 if (!resultImage) 48 return ;48 return false; 49 49 50 50 GraphicsContext& filterContext = resultImage->context(); … … 54 54 filterContext.drawImageBuffer(*inBuffer, drawingRegionOfInputImage(in->absolutePaintRect())); 55 55 } 56 57 return true; 56 58 } 57 59 -
trunk/Source/WebCore/platform/graphics/filters/FEMerge.h
r285796 r285916 33 33 FEMerge(); 34 34 35 voidplatformApplySoftware(const Filter&) override;35 bool platformApplySoftware(const Filter&) override; 36 36 37 37 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FEMorphology.cpp
r285796 r285916 240 240 } 241 241 242 voidFEMorphology::platformApplySoftware(const Filter& filter)242 bool FEMorphology::platformApplySoftware(const Filter& filter) 243 243 { 244 244 FilterEffect* in = inputEffect(0); … … 246 246 auto& destinationPixelBuffer = createPremultipliedImageResult(); 247 247 if (!destinationPixelBuffer) 248 return ;248 return false; 249 249 250 250 auto& destinationPixelArray = destinationPixelBuffer->data(); … … 256 256 IntSize radius = flooredIntSize(FloatSize(m_radiusX, m_radiusY)); 257 257 if (platformApplyDegenerate(destinationPixelArray, effectDrawingRect, radius.width(), radius.height())) 258 return ;258 return true; 259 259 260 260 auto sourcePixelArray = in->premultipliedResult(effectDrawingRect, operatingColorSpace()); 261 261 if (!sourcePixelArray) 262 return ;262 return false; 263 263 264 264 radius = flooredIntSize(filter.scaledByFilterScale({ m_radiusX, m_radiusY })); … … 267 267 268 268 if (platformApplyDegenerate(destinationPixelArray, effectDrawingRect, radiusX, radiusY)) 269 return ;269 return true; 270 270 271 271 PaintingData paintingData; … … 278 278 279 279 platformApply(paintingData); 280 return true; 280 281 } 281 282 -
trunk/Source/WebCore/platform/graphics/filters/FEMorphology.h
r285796 r285916 50 50 void determineAbsolutePaintRect(const Filter&) override; 51 51 52 voidplatformApplySoftware(const Filter&) override;52 bool platformApplySoftware(const Filter&) override; 53 53 54 54 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FEOffset.cpp
r285796 r285916 65 65 } 66 66 67 voidFEOffset::platformApplySoftware(const Filter& filter)67 bool FEOffset::platformApplySoftware(const Filter& filter) 68 68 { 69 69 FilterEffect* in = inputEffect(0); … … 72 72 ImageBuffer* inBuffer = in->imageBufferResult(); 73 73 if (!resultImage || !inBuffer) 74 return ;74 return false; 75 75 76 76 setIsAlphaImage(in->isAlphaImage()); … … 79 79 drawingRegion.move(filter.scaledByFilterScale({ m_dx, m_dy })); 80 80 resultImage->context().drawImageBuffer(*inBuffer, drawingRegion); 81 82 return true; 81 83 } 82 84 -
trunk/Source/WebCore/platform/graphics/filters/FEOffset.h
r285796 r285916 41 41 void determineAbsolutePaintRect(const Filter&) override; 42 42 43 voidplatformApplySoftware(const Filter&) override;43 bool platformApplySoftware(const Filter&) override; 44 44 45 45 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FETile.cpp
r285796 r285916 43 43 } 44 44 45 voidFETile::platformApplySoftware(const Filter& filter)45 bool FETile::platformApplySoftware(const Filter& filter) 46 46 { 47 47 // FIXME: See bug 47315. This is a hack to work around a compile failure, but is incorrect behavior otherwise. … … 51 51 ImageBuffer* inBuffer = in->imageBufferResult(); 52 52 if (!resultImage || !inBuffer) 53 return ;53 return false; 54 54 55 55 setIsAlphaImage(in->isAlphaImage()); … … 67 67 auto tileImage = SVGRenderingContext::createImageBuffer(tileRect, tileRect, DestinationColorSpace::SRGB(), filter.renderingMode()); 68 68 if (!tileImage) 69 return ;69 return false; 70 70 71 71 GraphicsContext& tileImageContext = tileImage->context(); … … 75 75 auto tileImageCopy = ImageBuffer::sinkIntoNativeImage(WTFMove(tileImage)); 76 76 if (!tileImageCopy) 77 return ;77 return false; 78 78 79 79 AffineTransform patternTransform; … … 85 85 filterContext.setFillPattern(WTFMove(pattern)); 86 86 filterContext.fillRect(FloatRect(FloatPoint(), absolutePaintRect().size())); 87 88 return true; 87 89 } 88 90 -
trunk/Source/WebCore/platform/graphics/filters/FETile.h
r285796 r285916 35 35 void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); } 36 36 37 voidplatformApplySoftware(const Filter&) override;37 bool platformApplySoftware(const Filter&) override; 38 38 39 39 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/FETurbulence.cpp
r285796 r285916 394 394 } 395 395 396 voidFETurbulence::platformApplySoftware(const Filter& filter)396 bool FETurbulence::platformApplySoftware(const Filter& filter) 397 397 { 398 398 auto& destinationPixelBuffer = createUnmultipliedImageResult(); 399 399 if (!destinationPixelBuffer) 400 return ;400 return false; 401 401 402 402 auto& destinationPixelArray = destinationPixelBuffer->data(); … … 406 406 if (resultSize.isEmpty()) { 407 407 destinationPixelArray.zeroFill(); 408 return ;408 return true; 409 409 } 410 410 … … 420 420 auto area = resultSize.area(); 421 421 if (area.hasOverflowed()) 422 return ;422 return false; 423 423 424 424 int height = resultSize.height(); … … 452 452 453 453 parallelJobs.execute(); 454 return ;454 return true; 455 455 } 456 456 } … … 458 458 // Fallback to single threaded mode if there is no room for a new thread or the paint area is too small. 459 459 fillRegion(filter, destinationPixelArray, paintingData, stitchData, 0, height); 460 return true; 460 461 } 461 462 -
trunk/Source/WebCore/platform/graphics/filters/FETurbulence.h
r285796 r285916 107 107 108 108 void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); } 109 voidplatformApplySoftware(const Filter&) override;109 bool platformApplySoftware(const Filter&) override; 110 110 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; 111 111 -
trunk/Source/WebCore/platform/graphics/filters/Filter.h
r285796 r285916 33 33 34 34 class Filter : public FilterFunction { 35 using FilterFunction::apply; 36 35 37 public: 36 38 FloatSize filterScale() const { return m_filterScale; } … … 44 46 45 47 virtual FloatSize scaledByFilterScale(FloatSize size) const { return size * m_filterScale; } 46 virtual voidapply() = 0;48 virtual bool apply() = 0; 47 49 48 50 ImageBuffer* sourceImage() const { return m_sourceImage.get(); } -
trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp
r285796 r285916 143 143 } 144 144 145 voidFilterEffect::apply(const Filter& filter)145 bool FilterEffect::apply(const Filter& filter) 146 146 { 147 147 if (hasResult()) 148 return; 148 return true; 149 149 150 unsigned size = m_inputEffects.size(); 150 151 for (unsigned i = 0; i < size; ++i) { 151 152 FilterEffect* in = m_inputEffects.at(i).get(); 152 in->apply(filter);153 if (!in->hasResult())154 return;155 153 156 154 // Convert input results to the current effect's color space. 155 ASSERT(in->hasResult()); 157 156 transformResultColorSpace(in, i); 158 157 } … … 161 160 setResultColorSpace(m_operatingColorSpace); 162 161 163 LOG_WITH_STREAM(Filters, stream << "FilterEffect " << filterName() << " " << this << " apply():\n filterPrimitiveSubregion " << m_filterPrimitiveSubregion << "\n effectBoundaries " << m_effectBoundaries << "\n absoluteUnclippedSubregion " << m_absoluteUnclippedSubregion << "\n absolutePaintRect " << m_absolutePaintRect << "\n maxEffectRect " << m_maxEffectRect << "\n filter scale " << filter.filterScale()); 162 LOG_WITH_STREAM(Filters, stream 163 << "FilterEffect " << filterName() << " " << this << " apply():" 164 << "\n filterPrimitiveSubregion " << m_filterPrimitiveSubregion 165 << "\n effectBoundaries " << m_effectBoundaries 166 << "\n absoluteUnclippedSubregion " << m_absoluteUnclippedSubregion 167 << "\n absolutePaintRect " << m_absolutePaintRect 168 << "\n maxEffectRect " << m_maxEffectRect 169 << "\n filter scale " << filter.filterScale()); 164 170 165 171 if (m_absolutePaintRect.isEmpty() || ImageBuffer::sizeNeedsClamping(m_absolutePaintRect.size())) 166 return ;172 return false; 167 173 168 174 if (requiresValidPreMultipliedPixels()) { … … 170 176 inputEffect(i)->correctFilterResultIfNeeded(); 171 177 } 172 178 173 179 // Add platform specific apply functions here and return earlier. 174 platformApplySoftware(filter);180 return platformApplySoftware(filter); 175 181 } 176 182 -
trunk/Source/WebCore/platform/graphics/filters/FilterEffect.h
r285796 r285916 25 25 #include "AlphaPremultiplication.h" 26 26 #include "DestinationColorSpace.h" 27 #include "FilterEffectVector.h" 27 28 #include "FilterFunction.h" 28 29 #include "FloatRect.h" … … 42 43 43 44 class Filter; 44 class FilterEffect;45 45 class ImageBuffer; 46 47 typedef Vector<RefPtr<FilterEffect>> FilterEffectVector;48 46 49 47 class FilterEffect : public FilterFunction { … … 85 83 void setMaxEffectRect(const FloatRect& maxEffectRect) { m_maxEffectRect = maxEffectRect; } 86 84 87 void apply(const Filter&);85 bool apply(const Filter&) override; 88 86 89 87 // Correct any invalid pixels, if necessary, in the result of a filter operation. … … 157 155 158 156 private: 159 virtual voidplatformApplySoftware(const Filter&) = 0;157 virtual bool platformApplySoftware(const Filter&) = 0; 160 158 161 159 void copyImageBytes(const Uint8ClampedArray& source, Uint8ClampedArray& destination, const IntRect&) const; -
trunk/Source/WebCore/platform/graphics/filters/FilterFunction.h
r285618 r285916 36 36 37 37 namespace WebCore { 38 39 class Filter; 38 40 39 41 class FilterFunction : public RefCounted<FilterFunction> { … … 83 85 AtomString filterName() const { return filterName(m_filterType); } 84 86 87 virtual bool apply(const Filter&) { return false; } 85 88 virtual IntOutsets outsets() const { return { }; } 86 89 virtual void clearResult() { } -
trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.cpp
r285796 r285916 46 46 } 47 47 48 voidSourceAlpha::platformApplySoftware(const Filter&)48 bool SourceAlpha::platformApplySoftware(const Filter&) 49 49 { 50 50 ImageBuffer* resultImage = createImageBufferResult(); 51 51 if (!resultImage) 52 return; 52 return false; 53 54 ImageBuffer* imageBuffer = inputEffect(0)->imageBufferResult(); 55 if (!imageBuffer) 56 return false; 57 58 FloatRect imageRect(FloatPoint(), absolutePaintRect().size()); 53 59 GraphicsContext& filterContext = resultImage->context(); 54 60 55 ImageBuffer* imageBuffer = inputEffect(0)->imageBufferResult();56 if (!imageBuffer)57 return;58 59 FloatRect imageRect(FloatPoint(), absolutePaintRect().size());60 61 filterContext.fillRect(imageRect, Color::black); 61 62 filterContext.drawImageBuffer(*imageBuffer, IntPoint(), CompositeOperator::DestinationIn); 63 64 return true; 62 65 } 63 66 -
trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.h
r285796 r285916 35 35 void determineAbsolutePaintRect(const Filter&) override; 36 36 37 voidplatformApplySoftware(const Filter&) override;37 bool platformApplySoftware(const Filter&) override; 38 38 39 39 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.cpp
r285796 r285916 44 44 } 45 45 46 voidSourceGraphic::platformApplySoftware(const Filter& filter)46 bool SourceGraphic::platformApplySoftware(const Filter& filter) 47 47 { 48 48 ImageBuffer* resultImage = createImageBufferResult(); 49 49 ImageBuffer* sourceImage = filter.sourceImage(); 50 50 if (!resultImage || !sourceImage) 51 return ;51 return false; 52 52 53 53 resultImage->context().drawImageBuffer(*sourceImage, IntPoint()); 54 return true; 54 55 } 55 56 -
trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h
r285796 r285916 36 36 void determineAbsolutePaintRect(const Filter&) override; 37 37 38 voidplatformApplySoftware(const Filter&) override;38 bool platformApplySoftware(const Filter&) override; 39 39 40 40 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override; -
trunk/Source/WebCore/rendering/CSSFilter.cpp
r285796 r285916 409 409 } 410 410 411 voidCSSFilter::apply()411 bool CSSFilter::apply() 412 412 { 413 413 auto effect = lastEffect(); … … 416 416 if (m_filterRenderer->hasResult()) { 417 417 effect->transformResultColorSpace(DestinationColorSpace::SRGB()); 418 return ;418 return true; 419 419 } 420 420 } 421 421 422 422 for (auto& function : m_functions) { 423 if (function->isSVGFilter()) { 424 downcast<SVGFilter>(function.get()).setSourceImage({ sourceImage() }); 425 downcast<SVGFilter>(function.get()).apply(); 426 } else if (function->isFilterEffect()) 427 downcast<FilterEffect>(function.get()).apply(*this); 423 if (!function->apply(*this)) 424 return false; 428 425 } 429 426 430 427 effect->transformResultColorSpace(DestinationColorSpace::SRGB()); 428 return true; 431 429 } 432 430 -
trunk/Source/WebCore/rendering/CSSFilter.h
r285796 r285916 60 60 61 61 void clearIntermediateResults(); 62 voidapply() override;62 bool apply() override; 63 63 64 64 ImageBuffer* output(); -
trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp
r285796 r285916 75 75 } 76 76 77 voidFEImage::platformApplySoftware(const Filter& filter)77 bool FEImage::platformApplySoftware(const Filter& filter) 78 78 { 79 79 // FEImage results are always in DestinationColorSpace::SRGB() … … 82 82 ImageBuffer* resultImage = createImageBufferResult(); 83 83 if (!resultImage) 84 return ;84 return false; 85 85 86 86 auto primitiveSubregion = filterPrimitiveSubregion(); … … 104 104 } 105 105 ); 106 107 return true; 106 108 } 107 109 -
trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.h
r285796 r285916 47 47 void determineAbsolutePaintRect(const Filter&) final; 48 48 49 voidplatformApplySoftware(const Filter&) final;49 bool platformApplySoftware(const Filter&) final; 50 50 51 51 WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const final; -
trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp
r285796 r285916 57 57 return nullptr; 58 58 59 filter->setLastEffect(WTFMove(lastEffect)); 59 FilterEffectVector expression; 60 if (!builder.buildExpression(expression)) 61 return nullptr; 62 63 ASSERT(!expression.isEmpty()); 64 filter->setExpression(WTFMove(expression)); 60 65 return filter; 61 66 } … … 76 81 } 77 82 78 void SVGFilter::apply()83 bool SVGFilter::apply(const Filter& filter) 79 84 { 80 m_lastEffect->apply(*this); 85 setSourceImage({ filter.sourceImage() }); 86 return apply(); 87 } 88 89 bool SVGFilter::apply() 90 { 91 ASSERT(!m_expression.isEmpty()); 92 for (auto& effect : m_expression) { 93 if (!effect->apply(*this)) 94 return false; 95 } 96 return true; 81 97 } 82 98 83 99 IntOutsets SVGFilter::outsets() const 84 100 { 85 return m_lastEffect->outsets(); 101 ASSERT(lastEffect()); 102 return lastEffect()->outsets(); 86 103 } 87 104 88 105 void SVGFilter::clearResult() 89 106 { 90 m_lastEffect->clearResultsRecursive(); 107 ASSERT(!m_expression.isEmpty()); 108 for (auto& effect : m_expression) 109 effect->clearResult(); 91 110 } 92 111 -
trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h
r285796 r285916 22 22 23 23 #include "Filter.h" 24 #include "FilterEffectVector.h" 24 25 #include "FloatRect.h" 25 26 #include <wtf/Ref.h> … … 40 41 41 42 FloatRect targetBoundingBox() const { return m_targetBoundingBox; } 42 voidapply() override;43 bool apply() override; 43 44 44 RefPtr<FilterEffect> lastEffect() { return m_lastEffect; }45 void setLastEffect(RefPtr<FilterEffect>&& lastEffect) { m_lastEffect = WTFMove(lastEffect); }45 void setExpression(FilterEffectVector&& expression) { m_expression = WTFMove(expression); } 46 RefPtr<FilterEffect> lastEffect() const { return !m_expression.isEmpty() ? m_expression.last() : nullptr; } 46 47 47 48 private: 48 49 SVGFilter(const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& targetBoundingBox, const FloatRect& filterRegion, bool effectBBoxMode); 49 50 51 bool apply(const Filter&) override; 50 52 IntOutsets outsets() const override; 51 53 void clearResult() override; … … 54 56 bool m_effectBBoxMode; 55 57 56 RefPtr<FilterEffect> m_lastEffect;58 FilterEffectVector m_expression; 57 59 }; 58 60 -
trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp
r285796 r285916 22 22 23 23 #include "ElementIterator.h" 24 #include "ImageBuffer.h"25 24 #include "SVGFilterElement.h" 26 25 #include "SVGFilterPrimitiveStandardAttributes.h" 27 26 #include "SourceAlpha.h" 28 27 #include "SourceGraphic.h" 29 #include <wtf/text/StringConcatenateNumbers.h>30 28 31 29 #if ENABLE(DESTINATION_COLOR_SPACE_LINEAR_SRGB) … … 181 179 } 182 180 181 static bool buildEffectExpression(const RefPtr<FilterEffect>& effect, FilterEffectVector& stack, FilterEffectVector& expression) 182 { 183 // A cycle is detected. 184 if (stack.contains(effect)) 185 return false; 186 187 stack.append(effect); 188 189 expression.append(effect); 190 191 for (auto& inputEffect : effect->inputEffects()) { 192 if (!buildEffectExpression(inputEffect, stack, expression)) 193 return false; 194 } 195 196 ASSERT(!stack.isEmpty()); 197 ASSERT(stack.last() == effect); 198 199 stack.removeLast(); 200 return true; 201 } 202 203 bool SVGFilterBuilder::buildExpression(FilterEffectVector& expression) const 204 { 205 if (!m_lastEffect) 206 return false; 207 208 FilterEffectVector stack; 209 if (!buildEffectExpression(m_lastEffect, stack, expression)) 210 return false; 211 212 expression.reverse(); 213 expression.shrinkToFit(); 214 return true; 215 } 216 183 217 } // namespace WebCore -
trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h
r285796 r285916 68 68 void setupBuiltinEffects(Ref<FilterEffect> sourceGraphic); 69 69 RefPtr<FilterEffect> buildFilterEffects(SVGFilterElement&); 70 bool buildExpression(FilterEffectVector& expression) const; 70 71 71 72 private:
Note:
See TracChangeset
for help on using the changeset viewer.