Bug 130779 - FEGaussianBlur: unify and const-ify calculateKernelSize
Summary: FEGaussianBlur: unify and const-ify calculateKernelSize
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P3 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-26 10:15 PDT by Adenilson Cavalcanti Silva
Modified: 2014-03-26 21:15 PDT (History)
14 users (show)

See Also:


Attachments
Patch (6.51 KB, patch)
2014-03-26 10:21 PDT, Adenilson Cavalcanti Silva
no flags Details | Formatted Diff | Diff
Patch (7.25 KB, patch)
2014-03-26 10:33 PDT, Adenilson Cavalcanti Silva
no flags Details | Formatted Diff | Diff
Patch (7.26 KB, patch)
2014-03-26 10:51 PDT, Adenilson Cavalcanti Silva
no flags Details | Formatted Diff | Diff
Patch (21.90 KB, patch)
2014-03-26 13:14 PDT, Adenilson Cavalcanti Silva
no flags Details | Formatted Diff | Diff
Patch (21.66 KB, patch)
2014-03-26 18:11 PDT, Adenilson Cavalcanti Silva
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adenilson Cavalcanti Silva 2014-03-26 10:15:17 PDT
Some methods can benefit of using const refs as also it makes sense to unify the interface (i.e. parameters) in calculateKernelSize and calculateUnscaledKernelSize.
Comment 1 Adenilson Cavalcanti Silva 2014-03-26 10:21:18 PDT
Created attachment 227857 [details]
Patch
Comment 2 Simon Fraser (smfr) 2014-03-26 10:24:28 PDT
Comment on attachment 227857 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=227857&action=review

> Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp:408
> +IntSize FEGaussianBlur::calculateKernelSize(Filter* filter, const FloatPoint& std)

const Filter* ?
Please rename "std" to something better (is it stdDeviation?)
Comment 3 Adenilson Cavalcanti Silva 2014-03-26 10:33:45 PDT
Created attachment 227860 [details]
Patch
Comment 4 Adenilson Cavalcanti Silva 2014-03-26 10:50:24 PDT
FilterEffect() provides the filter and it uses a pointer as constructor parameter (which can be null).

But we can have a const pointer, since applyVerticalScale/HorizontalScale() are const methods.
Comment 5 Adenilson Cavalcanti Silva 2014-03-26 10:51:19 PDT
Created attachment 227864 [details]
Patch
Comment 6 Adenilson Cavalcanti Silva 2014-03-26 10:52:11 PDT
Last patch uses const Filter*.
Comment 7 Simon Fraser (smfr) 2014-03-26 10:59:39 PDT
Comment on attachment 227864 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=227864&action=review

> Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp:410
> +    FloatPoint stdFilterScaled(filter->applyHorizontalScale(stdDeviation.x()), filter->applyVerticalScale(stdDeviation.y()));

Since you dereference filter without a null check, you should make it a const Filter&
Comment 8 Adenilson Cavalcanti Silva 2014-03-26 13:14:40 PDT
Created attachment 227879 [details]
Patch
Comment 9 Adenilson Cavalcanti Silva 2014-03-26 13:15:23 PDT
Agreed, FilterEffect will now return a ref.
Comment 10 Simon Fraser (smfr) 2014-03-26 17:52:14 PDT
Comment on attachment 227879 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=227879&action=review

> Source/WebCore/platform/graphics/filters/Filter.h:50
> +    virtual float applyHorizontalScale(const float value) const { return value * m_filterResolution.width(); }
> +    virtual float applyVerticalScale(const float value) const { return value * m_filterResolution.height(); }

no need for const float
Comment 11 Adenilson Cavalcanti Silva 2014-03-26 18:11:43 PDT
Created attachment 227902 [details]
Patch
Comment 12 Adenilson Cavalcanti Silva 2014-03-26 18:12:22 PDT
Removed unnecessary const.
Comment 13 Simon Fraser (smfr) 2014-03-26 18:29:28 PDT
Comment on attachment 227902 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=227902&action=review

> Source/WebCore/platform/graphics/filters/Filter.h:49
> +    // TODO: verify descendants that overload this method and turn them to const.

Not sure why you need the comment. AFAICT all subclasses use "override" so you would get a build failure with mismatched signatures.
Comment 14 WebKit Commit Bot 2014-03-26 21:14:52 PDT
Comment on attachment 227902 [details]
Patch

Clearing flags on attachment: 227902

Committed r166341: <http://trac.webkit.org/changeset/166341>
Comment 15 WebKit Commit Bot 2014-03-26 21:15:00 PDT
All reviewed patches have been landed.  Closing bug.