Changeset 34992 in webkit


Ignore:
Timestamp:
Jul 3, 2008 6:10:08 PM (16 years ago)
Author:
oliver@apple.com
Message:

2008-07-03 Alex Mathews <possessedpenguinbob@gmail.com>

Reviewed by Oliver Hunt.

Bug 19835: WebKit needs cross-platform filter system
<https://bugs.webkit.org/show_bug.cgi?id=19835>

More class refactoring in preparation for cross-platform filter
implementation.

Location:
trunk/WebCore
Files:
3 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r34989 r34992  
     12008-07-03  Alex Mathews  <possessedpenguinbob@gmail.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Bug 19835: WebKit needs cross-platform filter system
     6        <https://bugs.webkit.org/show_bug.cgi?id=19835>
     7
     8        More class refactoring in preparation for cross-platform filter
     9        implementation.
     10
     11        * WebCore.xcodeproj/project.pbxproj:
     12        * svg/FilterEffect.h:
     13        * svg/SVGComponentTransferFunctionElement.cpp:
     14        (WebCore::SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement):
     15        (WebCore::SVGComponentTransferFunctionElement::parseMappedAttribute):
     16        (WebCore::SVGComponentTransferFunctionElement::transferFunction):
     17        * svg/SVGComponentTransferFunctionElement.h:
     18        * svg/SVGFEColorMatrixElement.cpp:
     19        (WebCore::SVGFEColorMatrixElement::SVGFEColorMatrixElement):
     20        (WebCore::SVGFEColorMatrixElement::parseMappedAttribute):
     21        (WebCore::SVGFEColorMatrixElement::filterEffect):
     22        (WebCore::SVGFEColorMatrixElement::build):
     23        * svg/SVGFEColorMatrixElement.h:
     24        * svg/SVGFEComponentTransferElement.cpp:
     25        (WebCore::SVGFEComponentTransferElement::filterEffect):
     26        (WebCore::SVGFEComponentTransferElement::build):
     27        * svg/SVGFEComponentTransferElement.h:
     28        * svg/SVGFECompositeElement.cpp:
     29        (WebCore::SVGFECompositeElement::SVGFECompositeElement):
     30        (WebCore::SVGFECompositeElement::parseMappedAttribute):
     31        (WebCore::SVGFECompositeElement::filterEffect):
     32        (WebCore::SVGFECompositeElement::build):
     33        * svg/SVGFECompositeElement.h:
     34        * svg/graphics/filters/SVGFEBlend.cpp:
     35        * svg/graphics/filters/SVGFEBlend.h:
     36        * svg/graphics/filters/SVGFEColorMatrix.cpp:
     37        (WebCore::FEColorMatrix::FEColorMatrix):
     38        (WebCore::FEColorMatrix::create):
     39        (WebCore::FEColorMatrix::type):
     40        (WebCore::FEColorMatrix::setType):
     41        (WebCore::FEColorMatrix::values):
     42        (WebCore::FEColorMatrix::setValues):
     43        (WebCore::FEColorMatrix::apply):
     44        (WebCore::FEColorMatrix::dump):
     45        * svg/graphics/filters/SVGFEColorMatrix.h:
     46        (WebCore::):
     47        * svg/graphics/filters/SVGFEComponentTransfer.cpp:
     48        (WebCore::FEComponentTransfer::FEComponentTransfer):
     49        (WebCore::FEComponentTransfer::create):
     50        (WebCore::FEComponentTransfer::redFunction):
     51        (WebCore::FEComponentTransfer::setRedFunction):
     52        (WebCore::FEComponentTransfer::greenFunction):
     53        (WebCore::FEComponentTransfer::setGreenFunction):
     54        (WebCore::FEComponentTransfer::blueFunction):
     55        (WebCore::FEComponentTransfer::setBlueFunction):
     56        (WebCore::FEComponentTransfer::alphaFunction):
     57        (WebCore::FEComponentTransfer::setAlphaFunction):
     58        (WebCore::FEComponentTransfer::apply):
     59        (WebCore::FEComponentTransfer::dump):
     60        * svg/graphics/filters/SVGFEComponentTransfer.h:
     61        (WebCore::):
     62        (WebCore::ComponentTransferFunction::ComponentTransferFunction):
     63        * svg/graphics/filters/SVGFEComposite.cpp:
     64        (WebCore::FEComposite::FEComposite):
     65        (WebCore::FEComposite::create):
     66        (WebCore::FEComposite::operation):
     67        (WebCore::FEComposite::setOperation):
     68        (WebCore::FEComposite::k1):
     69        (WebCore::FEComposite::setK1):
     70        (WebCore::FEComposite::k2):
     71        (WebCore::FEComposite::setK2):
     72        (WebCore::FEComposite::k3):
     73        (WebCore::FEComposite::setK3):
     74        (WebCore::FEComposite::k4):
     75        (WebCore::FEComposite::setK4):
     76        (WebCore::FEComposite::apply):
     77        (WebCore::FEComposite::dump):
     78        * svg/graphics/filters/SVGFEComposite.h:
     79        (WebCore::):
     80        * svg/graphics/filters/cg/SVGFEColorMatrixCg.mm: Removed.
     81        * svg/graphics/filters/cg/SVGFEComponentTransferCg.mm: Removed.
     82        * svg/graphics/filters/cg/SVGFECompositeCg.mm: Removed.
     83
    1842008-07-03  Dan Bernstein  <mitz@apple.com>
    285
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r34971 r34992  
    30023002                B25599350D00D8BA00BB825C /* SVGResourceFilterCg.mm in Sources */ = {isa = PBXBuildFile; fileRef = B25598990D00D8B800BB825C /* SVGResourceFilterCg.mm */; };
    30033003                B25599370D00D8BA00BB825C /* SVGResourceMaskerCg.mm in Sources */ = {isa = PBXBuildFile; fileRef = B255989B0D00D8B800BB825C /* SVGResourceMaskerCg.mm */; };
    3004                 B25599390D00D8BA00BB825C /* SVGFEColorMatrixCg.mm in Sources */ = {isa = PBXBuildFile; fileRef = B255989F0D00D8B800BB825C /* SVGFEColorMatrixCg.mm */; };
    3005                 B255993A0D00D8BA00BB825C /* SVGFEComponentTransferCg.mm in Sources */ = {isa = PBXBuildFile; fileRef = B25598A00D00D8B800BB825C /* SVGFEComponentTransferCg.mm */; };
    3006                 B255993B0D00D8BA00BB825C /* SVGFECompositeCg.mm in Sources */ = {isa = PBXBuildFile; fileRef = B25598A10D00D8B800BB825C /* SVGFECompositeCg.mm */; };
    30073004                B255993C0D00D8BA00BB825C /* SVGFEDiffuseLightingCg.mm in Sources */ = {isa = PBXBuildFile; fileRef = B25598A20D00D8B800BB825C /* SVGFEDiffuseLightingCg.mm */; };
    30083005                B255993D0D00D8BA00BB825C /* SVGFEDisplacementMapCg.mm in Sources */ = {isa = PBXBuildFile; fileRef = B25598A30D00D8B800BB825C /* SVGFEDisplacementMapCg.mm */; };
     
    73537350                B25598990D00D8B800BB825C /* SVGResourceFilterCg.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SVGResourceFilterCg.mm; sourceTree = "<group>"; };
    73547351                B255989B0D00D8B800BB825C /* SVGResourceMaskerCg.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SVGResourceMaskerCg.mm; sourceTree = "<group>"; };
    7355                 B255989F0D00D8B800BB825C /* SVGFEColorMatrixCg.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SVGFEColorMatrixCg.mm; sourceTree = "<group>"; };
    7356                 B25598A00D00D8B800BB825C /* SVGFEComponentTransferCg.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SVGFEComponentTransferCg.mm; sourceTree = "<group>"; };
    7357                 B25598A10D00D8B800BB825C /* SVGFECompositeCg.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SVGFECompositeCg.mm; sourceTree = "<group>"; };
    73587352                B25598A20D00D8B800BB825C /* SVGFEDiffuseLightingCg.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SVGFEDiffuseLightingCg.mm; sourceTree = "<group>"; };
    73597353                B25598A30D00D8B800BB825C /* SVGFEDisplacementMapCg.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SVGFEDisplacementMapCg.mm; sourceTree = "<group>"; };
     
    1194511939                        isa = PBXGroup;
    1194611940                        children = (
    11947                                 B255989F0D00D8B800BB825C /* SVGFEColorMatrixCg.mm */,
    11948                                 B25598A00D00D8B800BB825C /* SVGFEComponentTransferCg.mm */,
    11949                                 B25598A10D00D8B800BB825C /* SVGFECompositeCg.mm */,
    1195011941                                B25598A20D00D8B800BB825C /* SVGFEDiffuseLightingCg.mm */,
    1195111942                                B25598A30D00D8B800BB825C /* SVGFEDisplacementMapCg.mm */,
     
    1656816559                                B22279C70D00BF220071B782 /* SVGFEBlendElement.cpp in Sources */,
    1656916560                                B25599740D00D8BA00BB825C /* SVGFEColorMatrix.cpp in Sources */,
    16570                                 B25599390D00D8BA00BB825C /* SVGFEColorMatrixCg.mm in Sources */,
    1657116561                                B22279CA0D00BF220071B782 /* SVGFEColorMatrixElement.cpp in Sources */,
    1657216562                                B25599760D00D8BA00BB825C /* SVGFEComponentTransfer.cpp in Sources */,
    16573                                 B255993A0D00D8BA00BB825C /* SVGFEComponentTransferCg.mm in Sources */,
    1657416563                                B22279CD0D00BF220071B782 /* SVGFEComponentTransferElement.cpp in Sources */,
    1657516564                                B25599780D00D8BA00BB825C /* SVGFEComposite.cpp in Sources */,
    16576                                 B255993B0D00D8BA00BB825C /* SVGFECompositeCg.mm in Sources */,
    1657716565                                B22279D00D00BF220071B782 /* SVGFECompositeElement.cpp in Sources */,
    1657816566                                B255997A0D00D8BA00BB825C /* SVGFEConvolveMatrix.cpp in Sources */,
  • trunk/WebCore/svg/FilterEffect.h

    r34942 r34992  
    2222
    2323#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
     24#include <wtf/PassRefPtr.h>
    2425#include <wtf/RefCounted.h>
     26#include <wtf/RefPtr.h>
    2527
    2628namespace WebCore {
  • trunk/WebCore/svg/SVGComponentTransferFunctionElement.cpp

    r34925 r34992  
    3434SVGComponentTransferFunctionElement::SVGComponentTransferFunctionElement(const QualifiedName& tagName, Document* doc)
    3535    : SVGElement(tagName, doc)
    36     , m_type(SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN)
     36    , m_type(FECOMPONENTTRANSFER_TYPE_UNKNOWN)
    3737    , m_tableValues(SVGNumberList::create(SVGNames::tableValuesAttr))
    3838    , m_slope(1.0f)
     
    6262    {
    6363        if (value == "identity")
    64             setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY);
     64            setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_IDENTITY);
    6565        else if (value == "table")
    66             setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_TABLE);
     66            setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_TABLE);
    6767        else if (value == "discrete")
    68             setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE);
     68            setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_DISCRETE);
    6969        else if (value == "linear")
    70             setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_LINEAR);
     70            setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_LINEAR);
    7171        else if (value == "gamma")
    72             setTypeBaseValue(SVG_FECOMPONENTTRANSFER_TYPE_GAMMA);
     72            setTypeBaseValue(FECOMPONENTTRANSFER_TYPE_GAMMA);
    7373    }
    7474    else if (attr->name() == SVGNames::tableValuesAttr)
     
    8888}
    8989
    90 SVGComponentTransferFunction SVGComponentTransferFunctionElement::transferFunction() const
     90ComponentTransferFunction SVGComponentTransferFunctionElement::transferFunction() const
    9191{
    92     SVGComponentTransferFunction func;
    93     func.type = (SVGComponentTransferType) type();
     92    ComponentTransferFunction func;
     93    func.type = (ComponentTransferType) type();
    9494    func.slope = slope();
    9595    func.intercept = intercept();
  • trunk/WebCore/svg/SVGComponentTransferFunctionElement.h

    r34925 r34992  
    4242        virtual void parseMappedAttribute(MappedAttribute* attr);
    4343       
    44         SVGComponentTransferFunction transferFunction() const;
     44        ComponentTransferFunction transferFunction() const;
    4545
    4646    private:
  • trunk/WebCore/svg/SVGFEColorMatrixElement.cpp

    r34925 r34992  
    3434SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document* doc)
    3535    : SVGFilterPrimitiveStandardAttributes(tagName, doc)
    36     , m_type(SVG_FECOLORMATRIX_TYPE_UNKNOWN)
     36    , m_type(FECOLORMATRIX_TYPE_UNKNOWN)
    3737    , m_values(SVGNumberList::create(SVGNames::valuesAttr))
    3838    , m_filterEffect(0)
     
    5353    if (attr->name() == SVGNames::typeAttr) {
    5454        if (value == "matrix")
    55             setTypeBaseValue(SVG_FECOLORMATRIX_TYPE_MATRIX);
     55            setTypeBaseValue(FECOLORMATRIX_TYPE_MATRIX);
    5656        else if (value == "saturate")
    57             setTypeBaseValue(SVG_FECOLORMATRIX_TYPE_SATURATE);
     57            setTypeBaseValue(FECOLORMATRIX_TYPE_SATURATE);
    5858        else if (value == "hueRotate")
    59             setTypeBaseValue(SVG_FECOLORMATRIX_TYPE_HUEROTATE);
     59            setTypeBaseValue(FECOLORMATRIX_TYPE_HUEROTATE);
    6060        else if (value == "luminanceToAlpha")
    61             setTypeBaseValue(SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA);
     61            setTypeBaseValue(FECOLORMATRIX_TYPE_LUMINANCETOALPHA);
    6262    }
    6363    else if (attr->name() == SVGNames::inAttr)
     
    6969}
    7070
    71 SVGFEColorMatrix* SVGFEColorMatrixElement::filterEffect(SVGResourceFilter* filter) const
     71SVGFilterEffect* SVGFEColorMatrixElement::filterEffect(SVGResourceFilter* filter) const
    7272{
    73     if (!m_filterEffect)
    74         m_filterEffect = SVGFEColorMatrix::create(filter);
    75        
    76     m_filterEffect->setIn(in1());
    77     setStandardAttributes(m_filterEffect.get());
     73    ASSERT_NOT_REACHED();
     74    return 0;
     75}
    7876
     77bool SVGFEColorMatrixElement::build(FilterBuilder* builder)
     78{
     79    FilterEffect* input1 = builder->getEffectById(in1());
     80   
     81    if(!input1)
     82        return false;
     83   
    7984    Vector<float> _values;
    8085    SVGNumberList* numbers = values();
     
    8590        _values.append(numbers->getItem(i, ec));
    8691
    87     m_filterEffect->setValues(_values);
    88     m_filterEffect->setType((SVGColorMatrixType) type());
     92    RefPtr<FilterEffect> addedEffect = FEColorMatrix::create(input1, static_cast<ColorMatrixType> (type()), _values);
     93    builder->add(result(), addedEffect.release());
    8994   
    90     return m_filterEffect.get();
     95    return true;
    9196}
    9297
    93 }
     98} //namespace WebCore
    9499
    95100#endif // ENABLE(SVG)
  • trunk/WebCore/svg/SVGFEColorMatrixElement.h

    r34925 r34992  
    2525
    2626#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
     27#include "FilterBuilder.h"
    2728#include "SVGFEColorMatrix.h"
    2829#include "SVGFilterPrimitiveStandardAttributes.h"
     
    3940
    4041        virtual void parseMappedAttribute(MappedAttribute*);
    41         virtual SVGFEColorMatrix* filterEffect(SVGResourceFilter*) const;
     42        virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const;
     43        bool build(FilterBuilder*);
    4244
    4345    protected:
     
    4951        ANIMATED_PROPERTY_DECLARATIONS(SVGFEColorMatrixElement, SVGNumberList*, RefPtr<SVGNumberList>, Values, values)
    5052
    51         mutable RefPtr<SVGFEColorMatrix> m_filterEffect;
     53        mutable RefPtr<FEColorMatrix> m_filterEffect;
    5254    };
    5355
  • trunk/WebCore/svg/SVGFEComponentTransferElement.cpp

    r34656 r34992  
    5858}
    5959
    60 SVGFEComponentTransfer* SVGFEComponentTransferElement::filterEffect(SVGResourceFilter* filter) const
     60SVGFilterEffect* SVGFEComponentTransferElement::filterEffect(SVGResourceFilter* filter) const
    6161{
    62     if (!m_filterEffect)
    63         m_filterEffect = SVGFEComponentTransfer::create(filter);
     62    ASSERT_NOT_REACHED();
     63    return 0;
     64}
     65
     66bool SVGFEComponentTransferElement::build(FilterBuilder* builder)
     67{
     68    FilterEffect* input1 = builder->getEffectById(in1());
    6469   
    65     m_filterEffect->setIn(in1());
    66     setStandardAttributes(m_filterEffect.get());
     70    if(!input1)
     71        return false;
     72
     73    ComponentTransferFunction red;
     74    ComponentTransferFunction green;
     75    ComponentTransferFunction blue;
     76    ComponentTransferFunction alpha;
    6777   
    6878    for (Node* n = firstChild(); n != 0; n = n->nextSibling()) {
    6979        if (n->hasTagName(SVGNames::feFuncRTag))
    70             m_filterEffect->setRedFunction(static_cast<SVGFEFuncRElement*>(n)->transferFunction());
     80            red = static_cast<SVGFEFuncRElement*>(n)->transferFunction();
    7181        else if (n->hasTagName(SVGNames::feFuncGTag))
    72             m_filterEffect->setGreenFunction(static_cast<SVGFEFuncGElement*>(n)->transferFunction());
     82            green = static_cast<SVGFEFuncGElement*>(n)->transferFunction();
    7383        else if (n->hasTagName(SVGNames::feFuncBTag))
    74             m_filterEffect->setBlueFunction(static_cast<SVGFEFuncBElement*>(n)->transferFunction());
     84           blue = static_cast<SVGFEFuncBElement*>(n)->transferFunction();
    7585        else if (n->hasTagName(SVGNames::feFuncATag))
    76             m_filterEffect->setAlphaFunction(static_cast<SVGFEFuncAElement*>(n)->transferFunction());
     86            alpha = static_cast<SVGFEFuncAElement*>(n)->transferFunction();
    7787    }
    78 
    79     return m_filterEffect.get();
     88   
     89    RefPtr<FilterEffect> addedEffect = FEComponentTransfer::create(input1, red, green, blue, alpha);
     90    builder->add(result(), addedEffect.release());
     91   
     92    return true;
    8093}
    8194
  • trunk/WebCore/svg/SVGFEComponentTransferElement.h

    r34925 r34992  
    2525
    2626#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
     27#include "FilterBuilder.h"
    2728#include "SVGFilterPrimitiveStandardAttributes.h"
    2829#include "SVGFEComponentTransfer.h"
     
    3839
    3940        virtual void parseMappedAttribute(MappedAttribute*);
    40         virtual SVGFEComponentTransfer* filterEffect(SVGResourceFilter*) const;
     41        virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const;
     42        bool build(FilterBuilder*);
    4143
    4244    protected:
     
    4648        ANIMATED_PROPERTY_DECLARATIONS(SVGFEComponentTransferElement, String, String, In1, in1)
    4749
    48         mutable RefPtr<SVGFEComponentTransfer> m_filterEffect;
     50        mutable RefPtr<FEComponentTransfer> m_filterEffect;
    4951    };
    5052
  • trunk/WebCore/svg/SVGFECompositeElement.cpp

    r34656 r34992  
    3333SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document* doc)
    3434    : SVGFilterPrimitiveStandardAttributes(tagName, doc)
    35     , m__operator(SVG_FECOMPOSITE_OPERATOR_OVER)
     35    , m__operator(FECOMPOSITE_OPERATOR_OVER)
    3636    , m_k1(0.0f)
    3737    , m_k2(0.0f)
     
    5959    if (attr->name() == SVGNames::operatorAttr) {
    6060        if (value == "over")
    61             set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_OVER);
     61            set_operatorBaseValue(FECOMPOSITE_OPERATOR_OVER);
    6262        else if (value == "in")
    63             set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_IN);
     63            set_operatorBaseValue(FECOMPOSITE_OPERATOR_IN);
    6464        else if (value == "out")
    65             set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_OUT);
     65            set_operatorBaseValue(FECOMPOSITE_OPERATOR_OUT);
    6666        else if (value == "atop")
    67             set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_ATOP);
     67            set_operatorBaseValue(FECOMPOSITE_OPERATOR_ATOP);
    6868        else if (value == "xor")
    69             set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_XOR);
     69            set_operatorBaseValue(FECOMPOSITE_OPERATOR_XOR);
    7070        else if (value == "arithmetic")
    71             set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
     71            set_operatorBaseValue(FECOMPOSITE_OPERATOR_ARITHMETIC);
    7272    }
    7373    else if (attr->name() == SVGNames::inAttr)
     
    8787}
    8888
    89 SVGFEComposite* SVGFECompositeElement::filterEffect(SVGResourceFilter* filter) const
     89SVGFilterEffect* SVGFECompositeElement::filterEffect(SVGResourceFilter* filter) const
    9090{
    91     if (!m_filterEffect)
    92         m_filterEffect = SVGFEComposite::create(filter);
     91    ASSERT_NOT_REACHED();
     92    return 0;
     93}
     94
     95bool SVGFECompositeElement::build(FilterBuilder* builder)
     96{
     97    FilterEffect* input1 = builder->getEffectById(in1());
     98    FilterEffect* input2 = builder->getEffectById(in2());
    9399   
    94     m_filterEffect->setOperation((SVGCompositeOperationType) _operator());
    95     m_filterEffect->setIn(in1());
    96     m_filterEffect->setIn2(in2());
    97     m_filterEffect->setK1(k1());
    98     m_filterEffect->setK2(k2());
    99     m_filterEffect->setK3(k3());
    100     m_filterEffect->setK4(k4());
     100    if(!input1 || !input2)
     101        return false;
     102   
     103    RefPtr<FilterEffect> addedEffect = FEComposite::create(input1, input2, static_cast<CompositeOperationType> (_operator()),
     104        k1(), k2(), k3(), k4());
     105    builder->add(result(), addedEffect.release());
    101106
    102     setStandardAttributes(m_filterEffect.get());
    103     return m_filterEffect.get();
     107    return true;
    104108}
    105109
  • trunk/WebCore/svg/SVGFECompositeElement.h

    r34925 r34992  
    2525
    2626#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
     27#include "FilterBuilder.h"
    2728#include "SVGFEComposite.h"
    2829#include "SVGFilterPrimitiveStandardAttributes.h"
     
    3839
    3940        virtual void parseMappedAttribute(MappedAttribute*);
    40         virtual SVGFEComposite* filterEffect(SVGResourceFilter*) const;
     41        virtual SVGFilterEffect* filterEffect(SVGResourceFilter*) const;
     42        bool build(FilterBuilder*);
    4143
    4244    protected:
     
    5254        ANIMATED_PROPERTY_DECLARATIONS(SVGFECompositeElement, float, float, K4, k4)
    5355
    54         mutable RefPtr<SVGFEComposite> m_filterEffect;
     56        mutable RefPtr<FEComposite> m_filterEffect;
    5557    };
    5658
  • trunk/WebCore/svg/graphics/filters/SVGFEBlend.cpp

    r34971 r34992  
    2424#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
    2525#include "SVGFEBlend.h"
    26 #include "TextStream.h"
    2726
    2827namespace WebCore {
  • trunk/WebCore/svg/graphics/filters/SVGFEBlend.h

    r34971 r34992  
    2525#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
    2626#include "FilterEffect.h"
    27 #include "SVGFilterEffect.h"
    2827
    2928namespace WebCore {
  • trunk/WebCore/svg/graphics/filters/SVGFEColorMatrix.cpp

    r34656 r34992  
    2727namespace WebCore {
    2828
    29 SVGFEColorMatrix::SVGFEColorMatrix(SVGResourceFilter* filter)
    30     : SVGFilterEffect(filter)
    31     , m_type(SVG_FECOLORMATRIX_TYPE_UNKNOWN)
     29FEColorMatrix::FEColorMatrix(FilterEffect* in, ColorMatrixType type, const Vector<float>& values)
     30    : FilterEffect()
     31    , m_in(in)
     32    , m_type(type)
     33    , m_values(values)
    3234{
    3335}
    3436
    35 PassRefPtr<SVGFEColorMatrix> SVGFEColorMatrix::create(SVGResourceFilter* filter)
     37PassRefPtr<FEColorMatrix> FEColorMatrix::create(FilterEffect* in, ColorMatrixType type, const Vector<float>& values)
    3638{
    37     return adoptRef(new SVGFEColorMatrix(filter));
     39    return adoptRef(new FEColorMatrix(in, type, values));
    3840}
    3941
    40 SVGColorMatrixType SVGFEColorMatrix::type() const
     42ColorMatrixType FEColorMatrix::type() const
    4143{
    4244    return m_type;
    4345}
    4446
    45 void SVGFEColorMatrix::setType(SVGColorMatrixType type)
     47void FEColorMatrix::setType(ColorMatrixType type)
    4648{
    4749    m_type = type;
    4850}
    4951
    50 const Vector<float>& SVGFEColorMatrix::values() const
     52const Vector<float>& FEColorMatrix::values() const
    5153{
    5254    return m_values;
    5355}
    5456
    55 void SVGFEColorMatrix::setValues(const Vector<float> &values)
     57void FEColorMatrix::setValues(const Vector<float> &values)
    5658{
    5759    m_values = values;
    5860}
    5961
    60 static TextStream& operator<<(TextStream& ts, SVGColorMatrixType t)
     62void FEColorMatrix::apply()
    6163{
    62     switch (t)
    63     {
    64         case SVG_FECOLORMATRIX_TYPE_UNKNOWN:
    65             ts << "UNKNOWN"; break;
    66         case SVG_FECOLORMATRIX_TYPE_MATRIX:
    67             ts << "CMT_MATRIX"; break;
    68         case SVG_FECOLORMATRIX_TYPE_SATURATE:
    69             ts << "CMT_SATURATE"; break;
    70         case SVG_FECOLORMATRIX_TYPE_HUEROTATE:
    71             ts << "HUE-ROTATE"; break;
    72         case SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA:
    73             ts << "LUMINANCE-TO-ALPHA"; break;
    74     }
    75     return ts;
    7664}
    7765
    78 TextStream& SVGFEColorMatrix::externalRepresentation(TextStream& ts) const
     66void FEColorMatrix::dump()
    7967{
    80     ts << "[type=COLOR-MATRIX] ";
    81     SVGFilterEffect::externalRepresentation(ts);
    82     ts << " [color matrix type=" << type() << "]"
    83         << " [values=" << values() << "]";
    84     return ts;
    8568}
    8669
  • trunk/WebCore/svg/graphics/filters/SVGFEColorMatrix.h

    r34656 r34992  
    2424
    2525#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
    26 #include "SVGFilterEffect.h"
    27 #include "SVGRenderTreeAsText.h"
     26#include "FilterEffect.h"
     27#include <wtf/Vector.h>
    2828
    2929namespace WebCore {
    3030
    31 enum SVGColorMatrixType {
    32     SVG_FECOLORMATRIX_TYPE_UNKNOWN          = 0,
    33     SVG_FECOLORMATRIX_TYPE_MATRIX           = 1,
    34     SVG_FECOLORMATRIX_TYPE_SATURATE         = 2,
    35     SVG_FECOLORMATRIX_TYPE_HUEROTATE        = 3,
    36     SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4
    37 };
     31    enum ColorMatrixType {
     32        FECOLORMATRIX_TYPE_UNKNOWN          = 0,
     33        FECOLORMATRIX_TYPE_MATRIX           = 1,
     34        FECOLORMATRIX_TYPE_SATURATE         = 2,
     35        FECOLORMATRIX_TYPE_HUEROTATE        = 3,
     36        FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4
     37    };
    3838
    39 class SVGFEColorMatrix : public SVGFilterEffect {
    40 public:
    41     static PassRefPtr<SVGFEColorMatrix> create(SVGResourceFilter*);
     39    class FEColorMatrix : public FilterEffect {
     40    public:
     41        static PassRefPtr<FEColorMatrix> create(FilterEffect*, ColorMatrixType, const Vector<float>&);
    4242
    43     SVGColorMatrixType type() const;
    44     void setType(SVGColorMatrixType);
     43        ColorMatrixType type() const;
     44        void setType(ColorMatrixType);
    4545
    46     const Vector<float>& values() const;
    47     void setValues(const Vector<float>&);
     46        const Vector<float>& values() const;
     47        void setValues(const Vector<float>&);
     48       
     49        virtual void apply();
     50        virtual void dump();
    4851
    49     virtual TextStream& externalRepresentation(TextStream&) const;
     52    private:
     53        FEColorMatrix(FilterEffect*, ColorMatrixType, const Vector<float>&);
    5054
    51 #if PLATFORM(CI)
    52     virtual CIFilter* getCIFilter(const FloatRect& bbox) const;
    53 #endif
    54 
    55 private:
    56     SVGFEColorMatrix(SVGResourceFilter*);
    57 
    58     SVGColorMatrixType m_type;
    59     Vector<float> m_values;
    60 };
     55        RefPtr<FilterEffect> m_in;
     56        ColorMatrixType m_type;
     57        Vector<float> m_values;
     58    };
    6159
    6260} // namespace WebCore
  • trunk/WebCore/svg/graphics/filters/SVGFEComponentTransfer.cpp

    r34656 r34992  
    2424#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
    2525#include "SVGFEComponentTransfer.h"
    26 #include "TextStream.h"
    2726
    2827namespace WebCore {
    2928
    30 SVGFEComponentTransfer::SVGFEComponentTransfer(SVGResourceFilter* filter)
    31     : SVGFilterEffect(filter)
     29FEComponentTransfer::FEComponentTransfer(FilterEffect* in, const ComponentTransferFunction& redFunc,
     30    const ComponentTransferFunction& greenFunc, const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc)
     31    : FilterEffect()
     32    , m_in(in)
     33    , m_redFunc(redFunc)
     34    , m_greenFunc(greenFunc)
     35    , m_blueFunc(blueFunc)
     36    , m_alphaFunc(alphaFunc)
    3237{
    3338}
    3439
    35 PassRefPtr<SVGFEComponentTransfer> SVGFEComponentTransfer::create(SVGResourceFilter* filter)
     40PassRefPtr<FEComponentTransfer> FEComponentTransfer::create(FilterEffect* in, const ComponentTransferFunction& redFunc,
     41    const ComponentTransferFunction& greenFunc, const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc)
    3642{
    37     return adoptRef(new SVGFEComponentTransfer(filter));
     43    return adoptRef(new FEComponentTransfer(in, redFunc, greenFunc, blueFunc, alphaFunc));
    3844}
    3945
    40 SVGComponentTransferFunction SVGFEComponentTransfer::redFunction() const
     46ComponentTransferFunction FEComponentTransfer::redFunction() const
    4147{
    4248    return m_redFunc;
    4349}
    4450
    45 void SVGFEComponentTransfer::setRedFunction(const SVGComponentTransferFunction& func)
     51void FEComponentTransfer::setRedFunction(const ComponentTransferFunction& func)
    4652{
    4753    m_redFunc = func;
    4854}
    4955
    50 SVGComponentTransferFunction SVGFEComponentTransfer::greenFunction() const
     56ComponentTransferFunction FEComponentTransfer::greenFunction() const
    5157{
    5258    return m_greenFunc;
    5359}
    5460
    55 void SVGFEComponentTransfer::setGreenFunction(const SVGComponentTransferFunction& func)
     61void FEComponentTransfer::setGreenFunction(const ComponentTransferFunction& func)
    5662{
    5763    m_greenFunc = func;
    5864}
    5965
    60 SVGComponentTransferFunction SVGFEComponentTransfer::blueFunction() const
     66ComponentTransferFunction FEComponentTransfer::blueFunction() const
    6167{
    6268    return m_blueFunc;
    6369}
    6470
    65 void SVGFEComponentTransfer::setBlueFunction(const SVGComponentTransferFunction& func)
     71void FEComponentTransfer::setBlueFunction(const ComponentTransferFunction& func)
    6672{
    6773    m_blueFunc = func;
    6874}
    6975
    70 SVGComponentTransferFunction SVGFEComponentTransfer::alphaFunction() const
     76ComponentTransferFunction FEComponentTransfer::alphaFunction() const
    7177{
    7278    return m_alphaFunc;
    7379}
    7480
    75 void SVGFEComponentTransfer::setAlphaFunction(const SVGComponentTransferFunction& func)
     81void FEComponentTransfer::setAlphaFunction(const ComponentTransferFunction& func)
    7682{
    7783    m_alphaFunc = func;
    7884}
    7985
    80 static TextStream& operator<<(TextStream& ts, SVGComponentTransferType t)
     86void FEComponentTransfer::apply()
    8187{
    82     switch (t)
    83     {
    84         case SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN:
    85             ts << "UNKNOWN"; break;
    86         case SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
    87             ts << "IDENTITY"; break;
    88         case SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
    89             ts << "TABLE"; break;
    90         case SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
    91             ts << "DISCRETE"; break;
    92         case SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
    93             ts << "LINEAR"; break;
    94         case SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
    95             ts << "GAMMA"; break;
    96     }
    97     return ts;
    9888}
    9989
    100 static TextStream& operator<<(TextStream& ts, const SVGComponentTransferFunction &func)
     90void FEComponentTransfer::dump()
    10191{
    102     ts << "[type=" << func.type << "]";
    103     switch (func.type) {
    104         case SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN:
    105         case SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
    106             break;
    107         case SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
    108         case SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
    109         {
    110             ts << " [table values=";
    111             Vector<float>::const_iterator itr=func.tableValues.begin();
    112             if (itr != func.tableValues.end()) {
    113                 ts << *itr++;
    114                 for (; itr!=func.tableValues.end(); itr++) {
    115                     ts << " " << *itr;
    116                 }
    117             }
    118             ts << "]";
    119             break;
    120         }
    121         case SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
    122             ts << " [slope=" << func.slope << "]"
    123                << " [intercept=" << func.intercept << "]";
    124             break;
    125         case SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
    126             ts << " [amplitude=" << func.amplitude << "]"
    127                << " [exponent=" << func.exponent << "]"
    128                << " [offset=" << func.offset << "]";
    129             break;
    130     }
    131     return ts;
    132 }
    133 
    134 TextStream& SVGFEComponentTransfer::externalRepresentation(TextStream& ts) const
    135 {
    136     ts << "[type=COMPONENT-TRANSFER] ";
    137     SVGFilterEffect::externalRepresentation(ts);
    138     ts << " [red func=" << redFunction() << "]"
    139         << " [green func=" << greenFunction() << "]"
    140         << " [blue func=" << blueFunction() << "]"
    141         << " [alpha func=" << alphaFunction() << "]";
    142     return ts;
    14392}
    14493
  • trunk/WebCore/svg/graphics/filters/SVGFEComponentTransfer.h

    r34656 r34992  
    2424
    2525#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
    26 #include <wtf/Vector.h>
    27 
    28 #include "SVGFilterEffect.h"
     26#include "FilterEffect.h"
    2927#include "SVGFEDisplacementMap.h"
    3028
    31 #if PLATFORM(CI)
    32 #ifdef __OBJC__
    33 @class CIImage;
    34 @class CIFilter;
    35 #else
    36 class CIImage;
    37 class CIFilter;
    38 #endif
    39 #endif
     29#include <wtf/Vector.h>
    4030
    4131namespace WebCore {
    4232
    43 enum SVGComponentTransferType {
    44     SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN  = 0,
    45     SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1,
    46     SVG_FECOMPONENTTRANSFER_TYPE_TABLE    = 2,
    47     SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3,
    48     SVG_FECOMPONENTTRANSFER_TYPE_LINEAR   = 4,
    49     SVG_FECOMPONENTTRANSFER_TYPE_GAMMA    = 5
    50 };
     33    enum ComponentTransferType {
     34        FECOMPONENTTRANSFER_TYPE_UNKNOWN  = 0,
     35        FECOMPONENTTRANSFER_TYPE_IDENTITY = 1,
     36        FECOMPONENTTRANSFER_TYPE_TABLE    = 2,
     37        FECOMPONENTTRANSFER_TYPE_DISCRETE = 3,
     38        FECOMPONENTTRANSFER_TYPE_LINEAR   = 4,
     39        FECOMPONENTTRANSFER_TYPE_GAMMA    = 5
     40    };
    5141
    52 struct SVGComponentTransferFunction {
    53     SVGComponentTransferFunction()
    54         : type(SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN)
    55         , slope(0.0f)
    56         , intercept(0.0f)
    57         , amplitude(0.0f)
    58         , exponent(0.0f)
    59         , offset(0.0f)
    60     {
    61     }
     42    struct ComponentTransferFunction {
     43        ComponentTransferFunction()
     44            : type(FECOMPONENTTRANSFER_TYPE_UNKNOWN)
     45            , slope(0.0f)
     46            , intercept(0.0f)
     47            , amplitude(0.0f)
     48            , exponent(0.0f)
     49            , offset(0.0f)
     50        {
     51        }
    6252
    63     SVGComponentTransferType type;
     53        ComponentTransferType type;
    6454
    65     float slope;
    66     float intercept;
    67     float amplitude;
    68     float exponent;
    69     float offset;
     55        float slope;
     56        float intercept;
     57        float amplitude;
     58        float exponent;
     59        float offset;
    7060
    71     Vector<float> tableValues;
    72 };
     61        Vector<float> tableValues;
     62    };
    7363
    74 class SVGFEComponentTransfer : public SVGFilterEffect {
    75 public:
    76     static PassRefPtr<SVGFEComponentTransfer> create(SVGResourceFilter*);
     64    class FEComponentTransfer : public FilterEffect {
     65    public:
     66        static PassRefPtr<FEComponentTransfer> create(FilterEffect*, const ComponentTransferFunction&,
     67                const ComponentTransferFunction&, const ComponentTransferFunction&, const ComponentTransferFunction&);
    7768
    78     SVGComponentTransferFunction redFunction() const;
    79     void setRedFunction(const SVGComponentTransferFunction&);
     69        ComponentTransferFunction redFunction() const;
     70        void setRedFunction(const ComponentTransferFunction&);
    8071
    81     SVGComponentTransferFunction greenFunction() const;
    82     void setGreenFunction(const SVGComponentTransferFunction&);
     72        ComponentTransferFunction greenFunction() const;
     73        void setGreenFunction(const ComponentTransferFunction&);
    8374
    84     SVGComponentTransferFunction blueFunction() const;
    85     void setBlueFunction(const SVGComponentTransferFunction&);
     75        ComponentTransferFunction blueFunction() const;
     76        void setBlueFunction(const ComponentTransferFunction&);
    8677
    87     SVGComponentTransferFunction alphaFunction() const;
    88     void setAlphaFunction(const SVGComponentTransferFunction&);
     78        ComponentTransferFunction alphaFunction() const;
     79        void setAlphaFunction(const ComponentTransferFunction&);
     80       
     81        virtual void apply();
     82        virtual void dump();
    8983
    90     virtual TextStream& externalRepresentation(TextStream&) const;
     84    private:
     85        FEComponentTransfer(FilterEffect*,const ComponentTransferFunction&, const ComponentTransferFunction&,
     86                const ComponentTransferFunction&, const ComponentTransferFunction&);
    9187
    92 #if PLATFORM(CI)
    93     virtual CIFilter* getCIFilter(const FloatRect& bbox) const;
    94 
    95 private:
    96     CIFilter* getFunctionFilter(SVGChannelSelectorType, CIImage* inputImage) const;
    97 #endif
    98 
    99 private:
    100     SVGFEComponentTransfer(SVGResourceFilter*);
    101 
    102     SVGComponentTransferFunction m_redFunc;
    103     SVGComponentTransferFunction m_greenFunc;
    104     SVGComponentTransferFunction m_blueFunc;
    105     SVGComponentTransferFunction m_alphaFunc;
    106 };
     88        RefPtr<FilterEffect> m_in;
     89        ComponentTransferFunction m_redFunc;
     90        ComponentTransferFunction m_greenFunc;
     91        ComponentTransferFunction m_blueFunc;
     92        ComponentTransferFunction m_alphaFunc;
     93    };
    10794
    10895} // namespace WebCore
  • trunk/WebCore/svg/graphics/filters/SVGFEComposite.cpp

    r34656 r34992  
    2424#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
    2525#include "SVGFEComposite.h"
    26 #include "TextStream.h"
    2726
    2827namespace WebCore {
    2928
    30 SVGFEComposite::SVGFEComposite(SVGResourceFilter* filter)
    31     : SVGFilterEffect(filter)
    32     , m_operation(SVG_FECOMPOSITE_OPERATOR_UNKNOWN)
    33     , m_k1(0.0f)
    34     , m_k2(0.0f)
    35     , m_k3(0.0f)
    36     , m_k4(0.0f)
     29FEComposite::FEComposite(FilterEffect* in, FilterEffect* in2, const CompositeOperationType& type,
     30    const float& k1, const float& k2, const float& k3, const float& k4)
     31    : FilterEffect()
     32    , m_in(in)
     33    , m_in2(in2)
     34    , m_type(type)
     35    , m_k1(k1)
     36    , m_k2(k2)
     37    , m_k3(k3)
     38    , m_k4(k4)
    3739{
    3840}
    3941
    40 PassRefPtr<SVGFEComposite> SVGFEComposite::create(SVGResourceFilter* filter)
     42PassRefPtr<FEComposite> FEComposite::create(FilterEffect* in, FilterEffect* in2, const CompositeOperationType& type,
     43    const float& k1, const float& k2, const float& k3, const float& k4)
    4144{
    42     return adoptRef(new SVGFEComposite(filter));
     45    return adoptRef(new FEComposite(in, in2, type, k1, k2, k3, k4));
    4346}
    4447
    45 String SVGFEComposite::in2() const
     48CompositeOperationType FEComposite::operation() const
    4649{
    47     return m_in2;
     50    return m_type;
    4851}
    4952
    50 void SVGFEComposite::setIn2(const String& in2)
     53void FEComposite::setOperation(CompositeOperationType type)
    5154{
    52     m_in2 = in2;
     55    m_type = type;
    5356}
    5457
    55 SVGCompositeOperationType SVGFEComposite::operation() const
    56 {
    57     return m_operation;
    58 }
    59 
    60 void SVGFEComposite::setOperation(SVGCompositeOperationType oper)
    61 {
    62     m_operation = oper;
    63 }
    64 
    65 float SVGFEComposite::k1() const
     58float FEComposite::k1() const
    6659{
    6760    return m_k1;
    6861}
    6962
    70 void SVGFEComposite::setK1(float k1)
     63void FEComposite::setK1(float k1)
    7164{
    7265    m_k1 = k1;
    7366}
    7467
    75 float SVGFEComposite::k2() const
     68float FEComposite::k2() const
    7669{
    7770    return m_k2;
    7871}
    7972
    80 void SVGFEComposite::setK2(float k2)
     73void FEComposite::setK2(float k2)
    8174{
    8275    m_k2 = k2;
    8376}
    8477
    85 float SVGFEComposite::k3() const
     78float FEComposite::k3() const
    8679{
    8780    return m_k3;
    8881}
    8982
    90 void SVGFEComposite::setK3(float k3)
     83void FEComposite::setK3(float k3)
    9184{
    9285    m_k3 = k3;
    9386}
    9487
    95 float SVGFEComposite::k4() const
     88float FEComposite::k4() const
    9689{
    9790    return m_k4;
    9891}
    9992
    100 void SVGFEComposite::setK4(float k4)
     93void FEComposite::setK4(float k4)
    10194{
    10295    m_k4 = k4;
    10396}
    10497
    105 TextStream& SVGFEComposite::externalRepresentation(TextStream& ts) const
     98void FEComposite::apply()
    10699{
    107     ts << "[type=COMPOSITE] ";
    108     SVGFilterEffect::externalRepresentation(ts);
    109     if (!in2().isEmpty())
    110         ts << " [in2=\"" << in2() << "\"]";
    111     ts << " [k1=" << k1() << " k2=" << k2() << " k3=" << k3() << " k4=" << k4() << "]";
    112     return ts;
     100}
     101
     102void FEComposite::dump()
     103{
    113104}
    114105
  • trunk/WebCore/svg/graphics/filters/SVGFEComposite.h

    r34656 r34992  
    2424
    2525#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
    26 #include "SVGFilterEffect.h"
     26#include "FilterEffect.h"
     27#include "PlatformString.h"
    2728
    2829namespace WebCore {
    2930
    30 enum SVGCompositeOperationType {
    31     SVG_FECOMPOSITE_OPERATOR_UNKNOWN    = 0,
    32     SVG_FECOMPOSITE_OPERATOR_OVER       = 1,
    33     SVG_FECOMPOSITE_OPERATOR_IN         = 2,
    34     SVG_FECOMPOSITE_OPERATOR_OUT        = 3,
    35     SVG_FECOMPOSITE_OPERATOR_ATOP       = 4,
    36     SVG_FECOMPOSITE_OPERATOR_XOR        = 5,
    37     SVG_FECOMPOSITE_OPERATOR_ARITHMETIC = 6
    38 };
     31    enum CompositeOperationType {
     32        FECOMPOSITE_OPERATOR_UNKNOWN    = 0,
     33        FECOMPOSITE_OPERATOR_OVER       = 1,
     34        FECOMPOSITE_OPERATOR_IN         = 2,
     35        FECOMPOSITE_OPERATOR_OUT        = 3,
     36        FECOMPOSITE_OPERATOR_ATOP       = 4,
     37        FECOMPOSITE_OPERATOR_XOR        = 5,
     38        FECOMPOSITE_OPERATOR_ARITHMETIC = 6
     39    };
    3940
    40 class SVGFEComposite : public SVGFilterEffect {
    41 public:
    42     static PassRefPtr<SVGFEComposite> create(SVGResourceFilter*);
     41    class FEComposite : public FilterEffect {
     42    public:
     43        static PassRefPtr<FEComposite> create(FilterEffect*, FilterEffect*, const CompositeOperationType&,
     44                const float&, const float&, const float&, const float&);
    4345
    44     String in2() const;
    45     void setIn2(const String&);
     46        CompositeOperationType operation() const;
     47        void setOperation(CompositeOperationType);
    4648
    47     SVGCompositeOperationType operation() const;
    48     void setOperation(SVGCompositeOperationType);
     49        float k1() const;
     50        void setK1(float);
    4951
    50     float k1() const;
    51     void setK1(float);
     52        float k2() const;
     53        void setK2(float);
    5254
    53     float k2() const;
    54     void setK2(float);
     55        float k3() const;
     56        void setK3(float);
    5557
    56     float k3() const;
    57     void setK3(float);
     58        float k4() const;
     59        void setK4(float);
     60       
     61        virtual void apply();
     62        virtual void dump();
    5863
    59     float k4() const;
    60     void setK4(float);
     64    private:
     65        FEComposite(FilterEffect*, FilterEffect*, const CompositeOperationType&,
     66                const float&, const float&, const float&, const float&);
    6167
    62     virtual TextStream& externalRepresentation(TextStream&) const;
    63 
    64 #if PLATFORM(CI)
    65     virtual CIFilter* getCIFilter(const FloatRect& bbox) const;
    66 #endif
    67 
    68 private:
    69     SVGFEComposite(SVGResourceFilter*);
    70 
    71     SVGCompositeOperationType m_operation;
    72     float m_k1;
    73     float m_k2;
    74     float m_k3;
    75     float m_k4;
    76     String m_in2;
    77 };
     68        RefPtr<FilterEffect> m_in;
     69        RefPtr<FilterEffect> m_in2;
     70        CompositeOperationType m_type;
     71        float m_k1;
     72        float m_k2;
     73        float m_k3;
     74        float m_k4;
     75    };
    7876
    7977} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.