⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285916 in webkit


Ignore:
Timestamp:
Nov 16, 2021, 10:24:11 PM (5 years ago)
Author:
Said Abou-Hallawa
Message:

[GPU Process] Build a postfix expression for applying the FilterEffects of the SVGFilter
https://bugs.webkit.org/show_bug.cgi?id=233214

Reviewed by Cameron McCormack.

The goal of building this expression is to have all inputs of each
FilterEffect be applied before applying it. This will eliminate the need
to do recursive applying in FilterEffect::apply(). And it will also
eliminate the need to store the rectangle of the result of FilterEffect.
Once the absolutePaintRect is calculated, the result image can be created.

Filter::apply() and FilterEffect::apply() should return a boolean so the
caller knows that applying the filter function was not successful.

  • WebCore.xcodeproj/project.pbxproj:
  • platform/graphics/cpu/arm/filters/FEBlendNEON.h:

(WebCore::FEBlend::platformApplySoftware):

  • platform/graphics/filters/FEBlend.cpp:

(WebCore::FEBlend::platformApplySoftware):

  • platform/graphics/filters/FEBlend.h:
  • platform/graphics/filters/FEColorMatrix.cpp:

(WebCore::FEColorMatrix::platformApplySoftware):

  • platform/graphics/filters/FEColorMatrix.h:
  • platform/graphics/filters/FEComponentTransfer.cpp:

(WebCore::FEComponentTransfer::platformApplySoftware):

  • platform/graphics/filters/FEComponentTransfer.h:
  • platform/graphics/filters/FEComposite.cpp:

(WebCore::FEComposite::platformApplySoftware):

  • platform/graphics/filters/FEComposite.h:
  • platform/graphics/filters/FEConvolveMatrix.cpp:

(WebCore::FEConvolveMatrix::platformApplySoftware):

  • platform/graphics/filters/FEConvolveMatrix.h:
  • platform/graphics/filters/FEDisplacementMap.cpp:

(WebCore::FEDisplacementMap::platformApplySoftware):

  • platform/graphics/filters/FEDisplacementMap.h:
  • platform/graphics/filters/FEDropShadow.cpp:

(WebCore::FEDropShadow::platformApplySoftware):

  • platform/graphics/filters/FEDropShadow.h:
  • platform/graphics/filters/FEFlood.cpp:

(WebCore::FEFlood::platformApplySoftware):

  • platform/graphics/filters/FEFlood.h:
  • platform/graphics/filters/FEGaussianBlur.cpp:

(WebCore::FEGaussianBlur::platformApplySoftware):

  • platform/graphics/filters/FEGaussianBlur.h:
  • platform/graphics/filters/FELighting.cpp:

(WebCore::FELighting::platformApplySoftware):

  • platform/graphics/filters/FELighting.h:
  • platform/graphics/filters/FEMerge.cpp:

(WebCore::FEMerge::platformApplySoftware):

  • platform/graphics/filters/FEMerge.h:
  • platform/graphics/filters/FEMorphology.cpp:

(WebCore::FEMorphology::platformApplySoftware):

  • platform/graphics/filters/FEMorphology.h:
  • platform/graphics/filters/FEOffset.cpp:

(WebCore::FEOffset::platformApplySoftware):

  • platform/graphics/filters/FEOffset.h:
  • platform/graphics/filters/FETile.cpp:

(WebCore::FETile::platformApplySoftware):

  • platform/graphics/filters/FETile.h:
  • platform/graphics/filters/FETurbulence.cpp:

(WebCore::FETurbulence::platformApplySoftware):

  • platform/graphics/filters/FETurbulence.h:
  • platform/graphics/filters/Filter.h:
  • platform/graphics/filters/FilterEffect.cpp:

(WebCore::FilterEffect::apply):

  • platform/graphics/filters/FilterEffect.h:
  • platform/graphics/filters/FilterEffectVector.h: Added.
  • platform/graphics/filters/FilterFunction.h:

(WebCore::FilterFunction::apply):

  • platform/graphics/filters/SourceAlpha.cpp:

(WebCore::SourceAlpha::platformApplySoftware):

  • platform/graphics/filters/SourceAlpha.h:
  • platform/graphics/filters/SourceGraphic.cpp:

(WebCore::SourceGraphic::platformApplySoftware):

  • platform/graphics/filters/SourceGraphic.h:
  • rendering/CSSFilter.cpp:

(WebCore::CSSFilter::apply):

  • rendering/CSSFilter.h:
  • svg/graphics/filters/SVGFEImage.cpp:

(WebCore::FEImage::platformApplySoftware):

  • svg/graphics/filters/SVGFEImage.h:
  • svg/graphics/filters/SVGFilter.cpp:

(WebCore::SVGFilter::create):
(WebCore::SVGFilter::apply):
(WebCore::SVGFilter::outsets const):
(WebCore::SVGFilter::clearResult):

  • svg/graphics/filters/SVGFilter.h:
  • svg/graphics/filters/SVGFilterBuilder.cpp:

(WebCore::buildEffectExpression):
(WebCore::SVGFilterBuilder::buildExpression const):

  • svg/graphics/filters/SVGFilterBuilder.h:
Location:
trunk/Source/WebCore
Files:
1 added
49 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r285915 r285916  
     12021-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
    1952021-11-16  Joonghun Park  <jh718.park@samsung.com>
    296
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r285867 r285916  
    1085310853                721443452240C8BA00F12FF7 /* SVGAnimatedValueProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedValueProperty.h; sourceTree = "<group>"; };
    1085410854                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>"; };
    1085510856                721B496F2512AC0400FE9D3B /* ImageBitmapBacking.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBitmapBacking.cpp; sourceTree = "<group>"; };
    1085610857                721B49702512AC0400FE9D3B /* ImageBitmapBacking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBitmapBacking.h; sourceTree = "<group>"; };
     
    2592625927                                2C85653824C10B0B00A37673 /* FilterEffectRenderer.cpp */,
    2592725928                                2C85653324C0F73C00A37673 /* FilterEffectRenderer.h */,
     25929                                7214B9B7274458FA003BE6DF /* FilterEffectVector.h */,
    2592825930                                7262D757272A174100C56A09 /* FilterFunction.cpp */,
    2592925931                                7262D756272A174100C56A09 /* FilterFunction.h */,
  • trunk/Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h

    r285796 r285916  
    107107};
    108108
    109 void FEBlend::platformApplySoftware(const Filter&)
     109bool FEBlend::platformApplySoftware(const Filter&)
    110110{
    111111    FilterEffect* in = inputEffect(0);
     
    114114    auto& destinationPixelBuffer = createPremultipliedImageResult();
    115115    if (!destinationPixelBuffer)
    116         return;
     116        return false;
    117117
    118118    auto& destinationPixelArray = destinationPixelBuffer->data();
     
    129129    if (sourcePixelArrayLength >= 8) {
    130130        platformApplyNEON(sourcePixelArrayA->data(), sourcePixelArrayB->data(), destinationPixelArray.data(), sourcePixelArrayLength);
    131         return;
     131        return true;
    132132    }
    133133    // If there is just one pixel we expand it to two.
     
    140140    platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8);
    141141    reinterpret_cast<uint32_t*>(destinationPixelArray.data())[0] = sourceBAndDest[0];
     142    return true;
    142143}
    143144
  • trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp

    r285796 r285916  
    5555
    5656#if !HAVE(ARM_NEON_INTRINSICS)
    57 void FEBlend::platformApplySoftware(const Filter&)
     57bool FEBlend::platformApplySoftware(const Filter&)
    5858{
    5959    FilterEffect* in = inputEffect(0);
     
    6262    ImageBuffer* resultImage = createImageBufferResult();
    6363    if (!resultImage)
    64         return;
     64        return false;
    6565    GraphicsContext& filterContext = resultImage->context();
    6666
     
    6868    ImageBuffer* imageBuffer2 = in2->imageBufferResult();
    6969    if (!imageBuffer || !imageBuffer2)
    70         return;
     70        return false;
    7171
    7272    filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()));
    7373    filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, { CompositeOperator::SourceOver, m_mode });
     74    return true;
    7475}
    7576#endif
  • trunk/Source/WebCore/platform/graphics/filters/FEBlend.h

    r285796 r285916  
    3838    FEBlend(BlendMode);
    3939
    40     void platformApplySoftware(const Filter&) override;
     40    bool platformApplySoftware(const Filter&) override;
    4141    void platformApplyGeneric(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray,
    4242                           unsigned colorArrayLength);
  • trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp

    r285796 r285916  
    274274}
    275275
    276 void FEColorMatrix::platformApplySoftware(const Filter&)
     276bool FEColorMatrix::platformApplySoftware(const Filter&)
    277277{
    278278    FilterEffect* in = inputEffect(0);
     
    280280    ImageBuffer* resultImage = createImageBufferResult();
    281281    if (!resultImage)
    282         return;
     282        return false;
    283283
    284284    ImageBuffer* inBuffer = in->imageBufferResult();
     
    290290    auto pixelBuffer = resultImage->getPixelBuffer(format, imageRect);
    291291    if (!pixelBuffer)
    292         return;
     292        return false;
    293293
    294294    auto& pixelArray = pixelBuffer->data();
     
    316316
    317317    resultImage->putPixelBuffer(*pixelBuffer, imageRect);
     318    return true;
    318319}
    319320
  • trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.h

    r285796 r285916  
    5151    FEColorMatrix(ColorMatrixType, Vector<float>&&);
    5252
    53     void platformApplySoftware(const Filter&) override;
     53    bool platformApplySoftware(const Filter&) override;
    5454
    5555    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp

    r285796 r285916  
    102102}
    103103
    104 void FEComponentTransfer::platformApplySoftware(const Filter&)
     104bool FEComponentTransfer::platformApplySoftware(const Filter&)
    105105{
    106106    FilterEffect* in = inputEffect(0);
     
    108108    auto& destinationPixelBuffer = createUnmultipliedImageResult();
    109109    if (!destinationPixelBuffer)
    110         return;
     110        return false;
    111111
    112112    auto& destinationPixelArray = destinationPixelBuffer->data();
     
    128128        data[pixelOffset + 3] = alphaTable[data[pixelOffset + 3]];
    129129    }
     130
     131    return true;
    130132}
    131133
  • trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.h

    r285796 r285916  
    7272    void computeLookupTables(LookupTable& redTable, LookupTable& greenTable, LookupTable& blueTable, LookupTable& alphaTable);
    7373
    74     void platformApplySoftware(const Filter&) override;
     74    bool platformApplySoftware(const Filter&) override;
    7575
    7676    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FEComposite.cpp

    r285796 r285916  
    224224}
    225225
    226 void FEComposite::platformApplySoftware(const Filter&)
     226bool FEComposite::platformApplySoftware(const Filter&)
    227227{
    228228    FilterEffect* in = inputEffect(0);
     
    232232        auto& destinationPixelBuffer = createPremultipliedImageResult();
    233233        if (!destinationPixelBuffer)
    234             return;
     234            return false;
    235235       
    236236        auto& destinationPixelArray = destinationPixelBuffer->data();
     
    239239        auto sourcePixelArray = in->premultipliedResult(effectADrawingRect, operatingColorSpace());
    240240        if (!sourcePixelArray)
    241             return;
     241            return false;
    242242
    243243        IntRect effectBDrawingRect = requestedRegionOfInputPixelBuffer(in2->absolutePaintRect());
     
    245245
    246246        platformArithmeticSoftware(*sourcePixelArray, destinationPixelArray, m_k1, m_k2, m_k3, m_k4);
    247         return;
     247        return true;
    248248    }
    249249
    250250    ImageBuffer* resultImage = createImageBufferResult();
    251251    if (!resultImage)
    252         return;
     252        return false;
    253253    GraphicsContext& filterContext = resultImage->context();
    254254
     
    256256    ImageBuffer* imageBuffer2 = in2->imageBufferResult();
    257257    if (!imageBuffer || !imageBuffer2)
    258         return;
     258        return false;
    259259
    260260    switch (m_type) {
     
    296296        break;
    297297    }
     298
     299    return true;
    298300}
    299301
  • trunk/Source/WebCore/platform/graphics/filters/FEComposite.h

    r285796 r285916  
    6666    void determineAbsolutePaintRect(const Filter&) override;
    6767
    68     void platformApplySoftware(const Filter&) override;
     68    bool platformApplySoftware(const Filter&) override;
    6969
    7070    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp

    r285796 r285916  
    362362}
    363363
    364 void FEConvolveMatrix::platformApplySoftware(const Filter&)
     364bool FEConvolveMatrix::platformApplySoftware(const Filter&)
    365365{
    366366    FilterEffect* in = inputEffect(0);
     
    368368    auto& destinationPixelBuffer = m_preserveAlpha ? createUnmultipliedImageResult() : createPremultipliedImageResult();
    369369    if (!destinationPixelBuffer)
    370         return;
     370        return false;
    371371
    372372    auto& destinationPixelArray = destinationPixelBuffer->data();
     
    380380        sourcePixelArray = in->premultipliedResult(effectDrawingRect, operatingColorSpace());
    381381    if (!sourcePixelArray)
    382         return;
     382        return false;
    383383
    384384    IntSize paintSize = absolutePaintRect().size();
     
    398398
    399399    if (clipRight < 0 || clipBottom < 0) {
    400         // Rare situation, not optimizied for speed
     400        // Rare situation, not optimized for speed
    401401        setOuterPixels(paintingData, 0, 0, paintSize.width(), paintSize.height());
    402         return;
     402        return true;
    403403    }
    404404
     
    426426    if (clipRight < paintSize.width())
    427427        setOuterPixels(paintingData, clipRight, m_targetOffset.y(), paintSize.width(), clipBottom);
     428
     429    return true;
    428430}
    429431
  • trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.h

    r285796 r285916  
    7979    void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
    8080
    81     void platformApplySoftware(const Filter&) override;
     81    bool platformApplySoftware(const Filter&) override;
    8282
    8383    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FEDisplacementMap.cpp

    r285796 r285916  
    9191}
    9292
    93 void FEDisplacementMap::platformApplySoftware(const Filter& filter)
     93bool FEDisplacementMap::platformApplySoftware(const Filter& filter)
    9494{
    9595    FilterEffect* in = inputEffect(0);
     
    101101    auto& destinationPixelBuffer = createPremultipliedImageResult();
    102102    if (!destinationPixelBuffer)
    103         return;
     103        return false;
    104104
    105105    auto& destinationPixelArray = destinationPixelBuffer->data();
     
    113113   
    114114    if (!inputImage || !displacementImage)
    115         return;
     115        return false;
    116116
    117117    ASSERT(inputImage->length() == displacementImage->length());
     
    148148        }
    149149    }
     150
     151    return true;
    150152}
    151153
  • trunk/Source/WebCore/platform/graphics/filters/FEDisplacementMap.h

    r285796 r285916  
    5454    FEDisplacementMap(ChannelSelectorType xChannelSelector, ChannelSelectorType yChannelSelector, float);
    5555
    56     void platformApplySoftware(const Filter&) override;
     56    bool platformApplySoftware(const Filter&) override;
    5757
    5858    void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
  • trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp

    r285796 r285916  
    7070}
    7171
    72 void FEDropShadow::platformApplySoftware(const Filter& filter)
     72bool FEDropShadow::platformApplySoftware(const Filter& filter)
    7373{
    7474    FilterEffect* in = inputEffect(0);
     
    7676    ImageBuffer* resultImage = createImageBufferResult();
    7777    if (!resultImage)
    78         return;
     78        return false;
    7979
    8080    FloatSize blurRadius = 2 * filter.scaledByFilterScale({ m_stdX, m_stdY });
     
    8787    ImageBuffer* sourceImage = in->imageBufferResult();
    8888    if (!sourceImage)
    89         return;
     89        return false;
    9090
    9191    GraphicsContext& resultContext = resultImage->context();
     
    100100    auto pixelBuffer = resultImage->getPixelBuffer(format, shadowArea);
    101101    if (!pixelBuffer)
    102         return;
     102        return false;
    103103
    104104    auto& sourcePixelArray = pixelBuffer->data();
     
    112112
    113113    resultImage->context().drawImageBuffer(*sourceImage, drawingRegion);
     114
     115    return true;
    114116}
    115117
  • trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.h

    r285796 r285916  
    5454    IntOutsets outsets() const override;
    5555
    56     void platformApplySoftware(const Filter&) override;
     56    bool platformApplySoftware(const Filter&) override;
    5757
    5858    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FEFlood.cpp

    r285796 r285916  
    5959}
    6060
    61 void FEFlood::platformApplySoftware(const Filter&)
     61bool FEFlood::platformApplySoftware(const Filter&)
    6262{
    6363    ImageBuffer* resultImage = createImageBufferResult();
    6464    if (!resultImage)
    65         return;
     65        return false;
    6666
    6767    auto color = floodColor().colorWithAlphaMultipliedBy(floodOpacity());
    6868    resultImage->context().fillRect(FloatRect(FloatPoint(), absolutePaintRect().size()), color);
     69
     70    return true;
    6971}
    7072
  • trunk/Source/WebCore/platform/graphics/filters/FEFlood.h

    r285796 r285916  
    4949    void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
    5050
    51     void platformApplySoftware(const Filter&) override;
     51    bool platformApplySoftware(const Filter&) override;
    5252
    5353    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp

    r285796 r285916  
    520520}
    521521
    522 void FEGaussianBlur::platformApplySoftware(const Filter& filter)
     522bool FEGaussianBlur::platformApplySoftware(const Filter& filter)
    523523{
    524524    FilterEffect* in = inputEffect(0);
     
    526526    auto& destinationPixelBuffer = createPremultipliedImageResult();
    527527    if (!destinationPixelBuffer)
    528         return;
     528        return false;
    529529
    530530    auto& destinationPixelArray = destinationPixelBuffer->data();
     
    535535    in->copyPremultipliedResult(destinationPixelArray, effectDrawingRect, operatingColorSpace());
    536536    if (!m_stdX && !m_stdY)
    537         return;
     537        return true;
    538538
    539539    IntSize kernelSize = calculateKernelSize(filter, { m_stdX, m_stdY });
     
    542542    auto tmpImageData = Uint8ClampedArray::tryCreateUninitialized(paintSize.area() * 4);
    543543    if (!tmpImageData)
    544         return;
     544        return false;
    545545
    546546    platformApply(destinationPixelArray, *tmpImageData, kernelSize.width(), kernelSize.height(), paintSize);
     547    return true;
    547548}
    548549
  • trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h

    r285796 r285916  
    6161    void determineAbsolutePaintRect(const Filter&) override;
    6262
    63     void platformApplySoftware(const Filter&) override;
     63    bool platformApplySoftware(const Filter&) override;
    6464
    6565    IntOutsets outsets() const override;
  • trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp

    r285796 r285916  
    472472}
    473473
    474 void FELighting::platformApplySoftware(const Filter&)
     474bool FELighting::platformApplySoftware(const Filter&)
    475475{
    476476    FilterEffect* in = inputEffect(0);
     
    478478    auto& destinationPixelBuffer = createPremultipliedImageResult();
    479479    if (!destinationPixelBuffer)
    480         return;
     480        return false;
    481481
    482482    auto& destinationPixelArray = destinationPixelBuffer->data();
     
    493493    IntSize absolutePaintSize = absolutePaintRect().size();
    494494    drawLighting(destinationPixelArray, absolutePaintSize.width(), absolutePaintSize.height());
     495    return true;
    495496}
    496497
  • trunk/Source/WebCore/platform/graphics/filters/FELighting.h

    r285796 r285916  
    135135    void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
    136136
    137     void platformApplySoftware(const Filter&) override;
     137    bool platformApplySoftware(const Filter&) override;
    138138
    139139    void platformApply(const LightingData&, const LightSource::PaintingData&);
  • trunk/Source/WebCore/platform/graphics/filters/FEMerge.cpp

    r285796 r285916  
    3939}
    4040
    41 void FEMerge::platformApplySoftware(const Filter&)
     41bool FEMerge::platformApplySoftware(const Filter&)
    4242{
    4343    unsigned size = numberOfEffectInputs();
     
    4646    ImageBuffer* resultImage = createImageBufferResult();
    4747    if (!resultImage)
    48         return;
     48        return false;
    4949
    5050    GraphicsContext& filterContext = resultImage->context();
     
    5454            filterContext.drawImageBuffer(*inBuffer, drawingRegionOfInputImage(in->absolutePaintRect()));
    5555    }
     56
     57    return true;
    5658}
    5759
  • trunk/Source/WebCore/platform/graphics/filters/FEMerge.h

    r285796 r285916  
    3333    FEMerge();
    3434
    35     void platformApplySoftware(const Filter&) override;
     35    bool platformApplySoftware(const Filter&) override;
    3636
    3737    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FEMorphology.cpp

    r285796 r285916  
    240240}
    241241
    242 void FEMorphology::platformApplySoftware(const Filter& filter)
     242bool FEMorphology::platformApplySoftware(const Filter& filter)
    243243{
    244244    FilterEffect* in = inputEffect(0);
     
    246246    auto& destinationPixelBuffer = createPremultipliedImageResult();
    247247    if (!destinationPixelBuffer)
    248         return;
     248        return false;
    249249
    250250    auto& destinationPixelArray = destinationPixelBuffer->data();
     
    256256    IntSize radius = flooredIntSize(FloatSize(m_radiusX, m_radiusY));
    257257    if (platformApplyDegenerate(destinationPixelArray, effectDrawingRect, radius.width(), radius.height()))
    258         return;
     258        return true;
    259259
    260260    auto sourcePixelArray = in->premultipliedResult(effectDrawingRect, operatingColorSpace());
    261261    if (!sourcePixelArray)
    262         return;
     262        return false;
    263263
    264264    radius = flooredIntSize(filter.scaledByFilterScale({ m_radiusX, m_radiusY }));
     
    267267
    268268    if (platformApplyDegenerate(destinationPixelArray, effectDrawingRect, radiusX, radiusY))
    269         return;
     269        return true;
    270270   
    271271    PaintingData paintingData;
     
    278278
    279279    platformApply(paintingData);
     280    return true;
    280281}
    281282
  • trunk/Source/WebCore/platform/graphics/filters/FEMorphology.h

    r285796 r285916  
    5050    void determineAbsolutePaintRect(const Filter&) override;
    5151
    52     void platformApplySoftware(const Filter&) override;
     52    bool platformApplySoftware(const Filter&) override;
    5353
    5454    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FEOffset.cpp

    r285796 r285916  
    6565}
    6666
    67 void FEOffset::platformApplySoftware(const Filter& filter)
     67bool FEOffset::platformApplySoftware(const Filter& filter)
    6868{
    6969    FilterEffect* in = inputEffect(0);
     
    7272    ImageBuffer* inBuffer = in->imageBufferResult();
    7373    if (!resultImage || !inBuffer)
    74         return;
     74        return false;
    7575
    7676    setIsAlphaImage(in->isAlphaImage());
     
    7979    drawingRegion.move(filter.scaledByFilterScale({ m_dx, m_dy }));
    8080    resultImage->context().drawImageBuffer(*inBuffer, drawingRegion);
     81
     82    return true;
    8183}
    8284
  • trunk/Source/WebCore/platform/graphics/filters/FEOffset.h

    r285796 r285916  
    4141    void determineAbsolutePaintRect(const Filter&) override;
    4242
    43     void platformApplySoftware(const Filter&) override;
     43    bool platformApplySoftware(const Filter&) override;
    4444
    4545    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FETile.cpp

    r285796 r285916  
    4343}
    4444
    45 void FETile::platformApplySoftware(const Filter& filter)
     45bool FETile::platformApplySoftware(const Filter& filter)
    4646{
    4747// FIXME: See bug 47315. This is a hack to work around a compile failure, but is incorrect behavior otherwise.
     
    5151    ImageBuffer* inBuffer = in->imageBufferResult();
    5252    if (!resultImage || !inBuffer)
    53         return;
     53        return false;
    5454
    5555    setIsAlphaImage(in->isAlphaImage());
     
    6767    auto tileImage = SVGRenderingContext::createImageBuffer(tileRect, tileRect, DestinationColorSpace::SRGB(), filter.renderingMode());
    6868    if (!tileImage)
    69         return;
     69        return false;
    7070
    7171    GraphicsContext& tileImageContext = tileImage->context();
     
    7575    auto tileImageCopy = ImageBuffer::sinkIntoNativeImage(WTFMove(tileImage));
    7676    if (!tileImageCopy)
    77         return;
     77        return false;
    7878
    7979    AffineTransform patternTransform;
     
    8585    filterContext.setFillPattern(WTFMove(pattern));
    8686    filterContext.fillRect(FloatRect(FloatPoint(), absolutePaintRect().size()));
     87
     88    return true;
    8789}
    8890
  • trunk/Source/WebCore/platform/graphics/filters/FETile.h

    r285796 r285916  
    3535    void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
    3636
    37     void platformApplySoftware(const Filter&) override;
     37    bool platformApplySoftware(const Filter&) override;
    3838
    3939    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/FETurbulence.cpp

    r285796 r285916  
    394394}
    395395
    396 void FETurbulence::platformApplySoftware(const Filter& filter)
     396bool FETurbulence::platformApplySoftware(const Filter& filter)
    397397{
    398398    auto& destinationPixelBuffer = createUnmultipliedImageResult();
    399399    if (!destinationPixelBuffer)
    400         return;
     400        return false;
    401401
    402402    auto& destinationPixelArray = destinationPixelBuffer->data();
     
    406406    if (resultSize.isEmpty()) {
    407407        destinationPixelArray.zeroFill();
    408         return;
     408        return true;
    409409    }
    410410
     
    420420    auto area = resultSize.area();
    421421    if (area.hasOverflowed())
    422         return;
     422        return false;
    423423
    424424    int height = resultSize.height();
     
    452452
    453453            parallelJobs.execute();
    454             return;
     454            return true;
    455455        }
    456456    }
     
    458458    // Fallback to single threaded mode if there is no room for a new thread or the paint area is too small.
    459459    fillRegion(filter, destinationPixelArray, paintingData, stitchData, 0, height);
     460    return true;
    460461}
    461462
  • trunk/Source/WebCore/platform/graphics/filters/FETurbulence.h

    r285796 r285916  
    107107
    108108    void determineAbsolutePaintRect(const Filter&) override { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
    109     void platformApplySoftware(const Filter&) override;
     109    bool platformApplySoftware(const Filter&) override;
    110110    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
    111111
  • trunk/Source/WebCore/platform/graphics/filters/Filter.h

    r285796 r285916  
    3333
    3434class Filter : public FilterFunction {
     35    using FilterFunction::apply;
     36
    3537public:
    3638    FloatSize filterScale() const { return m_filterScale; }
     
    4446
    4547    virtual FloatSize scaledByFilterScale(FloatSize size) const { return size * m_filterScale; }
    46     virtual void apply() = 0;
     48    virtual bool apply() = 0;
    4749
    4850    ImageBuffer* sourceImage() const { return m_sourceImage.get(); }
  • trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp

    r285796 r285916  
    143143}
    144144
    145 void FilterEffect::apply(const Filter& filter)
     145bool FilterEffect::apply(const Filter& filter)
    146146{
    147147    if (hasResult())
    148         return;
     148        return true;
     149
    149150    unsigned size = m_inputEffects.size();
    150151    for (unsigned i = 0; i < size; ++i) {
    151152        FilterEffect* in = m_inputEffects.at(i).get();
    152         in->apply(filter);
    153         if (!in->hasResult())
    154             return;
    155153
    156154        // Convert input results to the current effect's color space.
     155        ASSERT(in->hasResult());
    157156        transformResultColorSpace(in, i);
    158157    }
     
    161160    setResultColorSpace(m_operatingColorSpace);
    162161
    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());
    164170
    165171    if (m_absolutePaintRect.isEmpty() || ImageBuffer::sizeNeedsClamping(m_absolutePaintRect.size()))
    166         return;
     172        return false;
    167173
    168174    if (requiresValidPreMultipliedPixels()) {
     
    170176            inputEffect(i)->correctFilterResultIfNeeded();
    171177    }
    172    
     178
    173179    // Add platform specific apply functions here and return earlier.
    174     platformApplySoftware(filter);
     180    return platformApplySoftware(filter);
    175181}
    176182
  • trunk/Source/WebCore/platform/graphics/filters/FilterEffect.h

    r285796 r285916  
    2525#include "AlphaPremultiplication.h"
    2626#include "DestinationColorSpace.h"
     27#include "FilterEffectVector.h"
    2728#include "FilterFunction.h"
    2829#include "FloatRect.h"
     
    4243
    4344class Filter;
    44 class FilterEffect;
    4545class ImageBuffer;
    46 
    47 typedef Vector<RefPtr<FilterEffect>> FilterEffectVector;
    4846
    4947class FilterEffect : public FilterFunction {
     
    8583    void setMaxEffectRect(const FloatRect& maxEffectRect) { m_maxEffectRect = maxEffectRect; }
    8684
    87     void apply(const Filter&);
     85    bool apply(const Filter&) override;
    8886
    8987    // Correct any invalid pixels, if necessary, in the result of a filter operation.
     
    157155
    158156private:
    159     virtual void platformApplySoftware(const Filter&) = 0;
     157    virtual bool platformApplySoftware(const Filter&) = 0;
    160158
    161159    void copyImageBytes(const Uint8ClampedArray& source, Uint8ClampedArray& destination, const IntRect&) const;
  • trunk/Source/WebCore/platform/graphics/filters/FilterFunction.h

    r285618 r285916  
    3636
    3737namespace WebCore {
     38
     39class Filter;
    3840
    3941class FilterFunction : public RefCounted<FilterFunction> {
     
    8385    AtomString filterName() const { return filterName(m_filterType); }
    8486
     87    virtual bool apply(const Filter&) { return false; }
    8588    virtual IntOutsets outsets() const { return { }; }
    8689    virtual void clearResult() { }
  • trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.cpp

    r285796 r285916  
    4646}
    4747
    48 void SourceAlpha::platformApplySoftware(const Filter&)
     48bool SourceAlpha::platformApplySoftware(const Filter&)
    4949{
    5050    ImageBuffer* resultImage = createImageBufferResult();
    5151    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());
    5359    GraphicsContext& filterContext = resultImage->context();
    5460
    55     ImageBuffer* imageBuffer = inputEffect(0)->imageBufferResult();
    56     if (!imageBuffer)
    57         return;
    58 
    59     FloatRect imageRect(FloatPoint(), absolutePaintRect().size());
    6061    filterContext.fillRect(imageRect, Color::black);
    6162    filterContext.drawImageBuffer(*imageBuffer, IntPoint(), CompositeOperator::DestinationIn);
     63
     64    return true;
    6265}
    6366
  • trunk/Source/WebCore/platform/graphics/filters/SourceAlpha.h

    r285796 r285916  
    3535    void determineAbsolutePaintRect(const Filter&) override;
    3636
    37     void platformApplySoftware(const Filter&) override;
     37    bool platformApplySoftware(const Filter&) override;
    3838
    3939    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.cpp

    r285796 r285916  
    4444}
    4545
    46 void SourceGraphic::platformApplySoftware(const Filter& filter)
     46bool SourceGraphic::platformApplySoftware(const Filter& filter)
    4747{
    4848    ImageBuffer* resultImage = createImageBufferResult();
    4949    ImageBuffer* sourceImage = filter.sourceImage();
    5050    if (!resultImage || !sourceImage)
    51         return;
     51        return false;
    5252
    5353    resultImage->context().drawImageBuffer(*sourceImage, IntPoint());
     54    return true;
    5455}
    5556
  • trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h

    r285796 r285916  
    3636    void determineAbsolutePaintRect(const Filter&) override;
    3737
    38     void platformApplySoftware(const Filter&) override;
     38    bool platformApplySoftware(const Filter&) override;
    3939
    4040    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
  • trunk/Source/WebCore/rendering/CSSFilter.cpp

    r285796 r285916  
    409409}
    410410
    411 void CSSFilter::apply()
     411bool CSSFilter::apply()
    412412{
    413413    auto effect = lastEffect();
     
    416416        if (m_filterRenderer->hasResult()) {
    417417            effect->transformResultColorSpace(DestinationColorSpace::SRGB());
    418             return;
     418            return true;
    419419        }
    420420    }
    421421
    422422    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;
    428425    }
    429426
    430427    effect->transformResultColorSpace(DestinationColorSpace::SRGB());
     428    return true;
    431429}
    432430
  • trunk/Source/WebCore/rendering/CSSFilter.h

    r285796 r285916  
    6060
    6161    void clearIntermediateResults();
    62     void apply() override;
     62    bool apply() override;
    6363
    6464    ImageBuffer* output();
  • trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp

    r285796 r285916  
    7575}
    7676
    77 void FEImage::platformApplySoftware(const Filter& filter)
     77bool FEImage::platformApplySoftware(const Filter& filter)
    7878{
    7979    // FEImage results are always in DestinationColorSpace::SRGB()
     
    8282    ImageBuffer* resultImage = createImageBufferResult();
    8383    if (!resultImage)
    84         return;
     84        return false;
    8585
    8686    auto primitiveSubregion = filterPrimitiveSubregion();
     
    104104        }
    105105    );
     106
     107    return true;
    106108}
    107109
  • trunk/Source/WebCore/svg/graphics/filters/SVGFEImage.h

    r285796 r285916  
    4747    void determineAbsolutePaintRect(const Filter&) final;
    4848
    49     void platformApplySoftware(const Filter&) final;
     49    bool platformApplySoftware(const Filter&) final;
    5050
    5151    WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const final;
  • trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp

    r285796 r285916  
    5757        return nullptr;
    5858
    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));
    6065    return filter;
    6166}
     
    7681}
    7782
    78 void SVGFilter::apply()
     83bool SVGFilter::apply(const Filter& filter)
    7984{
    80     m_lastEffect->apply(*this);
     85    setSourceImage({ filter.sourceImage() });
     86    return apply();
     87}
     88
     89bool 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;
    8197}
    8298
    8399IntOutsets SVGFilter::outsets() const
    84100{
    85     return m_lastEffect->outsets();
     101    ASSERT(lastEffect());
     102    return lastEffect()->outsets();
    86103}
    87104
    88105void SVGFilter::clearResult()
    89106{
    90     m_lastEffect->clearResultsRecursive();
     107    ASSERT(!m_expression.isEmpty());
     108    for (auto& effect : m_expression)
     109        effect->clearResult();
    91110}
    92111
  • trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h

    r285796 r285916  
    2222
    2323#include "Filter.h"
     24#include "FilterEffectVector.h"
    2425#include "FloatRect.h"
    2526#include <wtf/Ref.h>
     
    4041
    4142    FloatRect targetBoundingBox() const { return m_targetBoundingBox; }
    42     void apply() override;
     43    bool apply() override;
    4344
    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; }
    4647
    4748private:
    4849    SVGFilter(const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& targetBoundingBox, const FloatRect& filterRegion, bool effectBBoxMode);
    4950
     51    bool apply(const Filter&) override;
    5052    IntOutsets outsets() const override;
    5153    void clearResult() override;
     
    5456    bool m_effectBBoxMode;
    5557
    56     RefPtr<FilterEffect> m_lastEffect;
     58    FilterEffectVector m_expression;
    5759};
    5860
  • trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.cpp

    r285796 r285916  
    2222
    2323#include "ElementIterator.h"
    24 #include "ImageBuffer.h"
    2524#include "SVGFilterElement.h"
    2625#include "SVGFilterPrimitiveStandardAttributes.h"
    2726#include "SourceAlpha.h"
    2827#include "SourceGraphic.h"
    29 #include <wtf/text/StringConcatenateNumbers.h>
    3028
    3129#if ENABLE(DESTINATION_COLOR_SPACE_LINEAR_SRGB)
     
    181179}
    182180
     181static 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
     203bool 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
    183217} // namespace WebCore
  • trunk/Source/WebCore/svg/graphics/filters/SVGFilterBuilder.h

    r285796 r285916  
    6868    void setupBuiltinEffects(Ref<FilterEffect> sourceGraphic);
    6969    RefPtr<FilterEffect> buildFilterEffects(SVGFilterElement&);
     70    bool buildExpression(FilterEffectVector& expression) const;
    7071
    7172private:
Note: See TracChangeset for help on using the changeset viewer.