Changeset 79851 in webkit


Ignore:
Timestamp:
Feb 28, 2011 3:31:11 AM (13 years ago)
Author:
reni@webkit.org
Message:

2011-02-28 Renata Hodovan <reni@webkit.org>

Reviewed by Andreas Kling.

FETurbulenceElement changes doesn't require relayout
https://bugs.webkit.org/show_bug.cgi?id=55141

When the FETurbulenceElement receives an update message but the given value remains the same we don't need
to relayout the filter.
Besides fix a typo in FETurbulence and change the paramterer type of FETurbulence::setNumOctaves from bool
to int according to the spec.

No new tests are needed because this modification is covered by the dynamic update tests of FETurbulence.

  • platform/graphics/filters/FETurbulence.cpp: (WebCore::FETurbulence::FETurbulence): (WebCore::FETurbulence::create): (WebCore::FETurbulence::type): (WebCore::FETurbulence::setType): (WebCore::FETurbulence::setBaseFrequencyY): (WebCore::FETurbulence::setBaseFrequencyX): (WebCore::FETurbulence::setSeed): (WebCore::FETurbulence::setNumOctaves): (WebCore::FETurbulence::setStitchTiles): (WebCore::operator<<):
  • platform/graphics/filters/FETurbulence.h:
  • svg/SVGFETurbulenceElement.cpp: (WebCore::SVGFETurbulenceElement::setFilterEffectAttribute): (WebCore::SVGFETurbulenceElement::svgAttributeChanged): (WebCore::SVGFETurbulenceElement::build):
  • svg/SVGFETurbulenceElement.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r79850 r79851  
     12011-02-28  Renata Hodovan  <reni@webkit.org>
     2
     3        Reviewed by Andreas Kling.
     4
     5        FETurbulenceElement changes doesn't require relayout
     6        https://bugs.webkit.org/show_bug.cgi?id=55141
     7
     8        When the FETurbulenceElement receives an update message but the given value remains the same we don't need
     9        to relayout the filter.
     10        Besides fix a typo in FETurbulence and change the paramterer type of FETurbulence::setNumOctaves from bool
     11        to int according to the spec.
     12
     13        No new tests are needed because this modification is covered by the dynamic update tests of FETurbulence.
     14
     15        * platform/graphics/filters/FETurbulence.cpp:
     16        (WebCore::FETurbulence::FETurbulence):
     17        (WebCore::FETurbulence::create):
     18        (WebCore::FETurbulence::type):
     19        (WebCore::FETurbulence::setType):
     20        (WebCore::FETurbulence::setBaseFrequencyY):
     21        (WebCore::FETurbulence::setBaseFrequencyX):
     22        (WebCore::FETurbulence::setSeed):
     23        (WebCore::FETurbulence::setNumOctaves):
     24        (WebCore::FETurbulence::setStitchTiles):
     25        (WebCore::operator<<):
     26        * platform/graphics/filters/FETurbulence.h:
     27        * svg/SVGFETurbulenceElement.cpp:
     28        (WebCore::SVGFETurbulenceElement::setFilterEffectAttribute):
     29        (WebCore::SVGFETurbulenceElement::svgAttributeChanged):
     30        (WebCore::SVGFETurbulenceElement::build):
     31        * svg/SVGFETurbulenceElement.h:
     32
    1332011-02-28  Pavel Feldman  <pfeldman@chromium.org>
    234
  • trunk/Source/WebCore/platform/graphics/filters/FETurbulence.cpp

    r75377 r79851  
    5050static const int s_randR = 2836; // m % a
    5151
    52 FETurbulence::FETurbulence(Filter* filter, TurbulanceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles)
     52FETurbulence::FETurbulence(Filter* filter, TurbulenceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles)
    5353    : FilterEffect(filter)
    5454    , m_type(type)
     
    6161}
    6262
    63 PassRefPtr<FETurbulence> FETurbulence::create(Filter* filter, TurbulanceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles)
     63PassRefPtr<FETurbulence> FETurbulence::create(Filter* filter, TurbulenceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles)
    6464{
    6565    return adoptRef(new FETurbulence(filter, type, baseFrequencyX, baseFrequencyY, numOctaves, seed, stitchTiles));
    6666}
    6767
    68 TurbulanceType FETurbulence::type() const
     68TurbulenceType FETurbulence::type() const
    6969{
    7070    return m_type;
    7171}
    7272
    73 void FETurbulence::setType(TurbulanceType type)
    74 {
     73bool FETurbulence::setType(TurbulenceType type)
     74{
     75    if (m_type == type)
     76        return false;
    7577    m_type = type;
     78    return true;
    7679}
    7780
     
    8184}
    8285
    83 void FETurbulence::setBaseFrequencyY(float baseFrequencyY)
    84 {
     86bool FETurbulence::setBaseFrequencyY(float baseFrequencyY)
     87{
     88    if (m_baseFrequencyY == baseFrequencyY)
     89        return false;
    8590    m_baseFrequencyY = baseFrequencyY;
     91    return true;
    8692}
    8793
     
    9197}
    9298
    93 void FETurbulence::setBaseFrequencyX(float baseFrequencyX)
    94 {
    95        m_baseFrequencyX = baseFrequencyX;
     99bool FETurbulence::setBaseFrequencyX(float baseFrequencyX)
     100{
     101    if (m_baseFrequencyX == baseFrequencyX)
     102        return false;
     103    m_baseFrequencyX = baseFrequencyX;
     104    return true;
    96105}
    97106
     
    101110}
    102111
    103 void FETurbulence::setSeed(float seed)
    104 {
     112bool FETurbulence::setSeed(float seed)
     113{
     114    if (m_seed == seed)
     115        return false;
    105116    m_seed = seed;
     117    return true;
    106118}
    107119
     
    111123}
    112124
    113 void FETurbulence::setNumOctaves(bool numOctaves)
    114 {
     125bool FETurbulence::setNumOctaves(int numOctaves)
     126{
     127    if (m_numOctaves == numOctaves)
     128        return false;
    115129    m_numOctaves = numOctaves;
     130    return true;
    116131}
    117132
     
    121136}
    122137
    123 void FETurbulence::setStitchTiles(bool stitch)
    124 {
     138bool FETurbulence::setStitchTiles(bool stitch)
     139{
     140    if (m_stitchTiles == stitch)
     141        return false;
    125142    m_stitchTiles = stitch;
     143    return true;
    126144}
    127145
     
    354372}
    355373
    356 static TextStream& operator<<(TextStream& ts, const TurbulanceType& type)
     374static TextStream& operator<<(TextStream& ts, const TurbulenceType& type)
    357375{
    358376    switch (type) {
  • trunk/Source/WebCore/platform/graphics/filters/FETurbulence.h

    r72474 r79851  
    3131namespace WebCore {
    3232
    33 enum TurbulanceType {
     33enum TurbulenceType {
    3434    FETURBULENCE_TYPE_UNKNOWN = 0,
    3535    FETURBULENCE_TYPE_FRACTALNOISE = 1,
     
    3939class FETurbulence : public FilterEffect {
    4040public:
    41     static PassRefPtr<FETurbulence> create(Filter*, TurbulanceType, float, float, int, float, bool);
     41    static PassRefPtr<FETurbulence> create(Filter*, TurbulenceType, float, float, int, float, bool);
    4242
    43     TurbulanceType type() const;
    44     void setType(TurbulanceType);
     43    TurbulenceType type() const;
     44    bool setType(TurbulenceType);
    4545
    4646    float baseFrequencyY() const;
    47     void setBaseFrequencyY(float);
     47    bool setBaseFrequencyY(float);
    4848
    4949    float baseFrequencyX() const;
    50     void setBaseFrequencyX(float);
     50    bool setBaseFrequencyX(float);
    5151
    5252    float seed() const;
    53     void setSeed(float);
     53    bool setSeed(float);
    5454
    5555    int numOctaves() const;
    56     void setNumOctaves(bool);
     56    bool setNumOctaves(int);
    5757
    5858    bool stitchTiles() const;
    59     void setStitchTiles(bool);
     59    bool setStitchTiles(bool);
    6060
    6161    virtual void apply();
     
    8585    };
    8686
    87     FETurbulence(Filter*, TurbulanceType, float, float, int, float, bool);
     87    FETurbulence(Filter*, TurbulenceType, float, float, int, float, bool);
    8888
    8989    inline void initPaint(PaintingData&);
     
    9191    unsigned char calculateTurbulenceValueForPoint(PaintingData&, const FloatPoint&);
    9292
    93     TurbulanceType m_type;
     93    TurbulenceType m_type;
    9494    float m_baseFrequencyX;
    9595    float m_baseFrequencyY;
  • trunk/Source/WebCore/svg/SVGFETurbulenceElement.cpp

    r78345 r79851  
    9090}
    9191
     92bool SVGFETurbulenceElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName)
     93{
     94    FETurbulence* turbulence = static_cast<FETurbulence*>(effect);
     95    if (attrName == SVGNames::typeAttr)
     96        return turbulence->setType(static_cast<TurbulenceType>(type()));
     97    if (attrName == SVGNames::stitchTilesAttr)
     98        return turbulence->setStitchTiles(stitchTiles());
     99    if (attrName == SVGNames::baseFrequencyAttr)
     100        return (turbulence->setBaseFrequencyX(baseFrequencyX()) || turbulence->setBaseFrequencyY(baseFrequencyY()));
     101    if (attrName == SVGNames::seedAttr)
     102        return turbulence->setSeed(seed());
     103    if (attrName == SVGNames::numOctavesAttr)
     104       return turbulence->setNumOctaves(numOctaves());
     105
     106    ASSERT_NOT_REACHED();
     107    return false;
     108}
     109
    92110void SVGFETurbulenceElement::svgAttributeChanged(const QualifiedName& attrName)
    93111{
    94112    SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
    95    
     113
    96114    if (attrName == SVGNames::baseFrequencyAttr
    97115        || attrName == SVGNames::numOctavesAttr
     
    99117        || attrName == SVGNames::stitchTilesAttr
    100118        || attrName == SVGNames::typeAttr)
    101         invalidate();
     119        primitiveAttributeChanged(attrName);
    102120}
    103121
     
    152170        return 0;
    153171
    154     return FETurbulence::create(filter, static_cast<TurbulanceType>(type()), baseFrequencyX(),
     172    return FETurbulence::create(filter, static_cast<TurbulenceType>(type()), baseFrequencyX(),
    155173                baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH);
    156174}
  • trunk/Source/WebCore/svg/SVGFETurbulenceElement.h

    r78249 r79851  
    4545
    4646    virtual void parseMappedAttribute(Attribute*);
     47    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName);
    4748    virtual void svgAttributeChanged(const QualifiedName&);
    4849    virtual void synchronizeProperty(const QualifiedName&);
Note: See TracChangeset for help on using the changeset viewer.