RESOLVED FIXED 130779
FEGaussianBlur: unify and const-ify calculateKernelSize
https://bugs.webkit.org/show_bug.cgi?id=130779
Summary FEGaussianBlur: unify and const-ify calculateKernelSize
Adenilson Cavalcanti Silva
Reported 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.
Attachments
Patch (6.51 KB, patch)
2014-03-26 10:21 PDT, Adenilson Cavalcanti Silva
no flags
Patch (7.25 KB, patch)
2014-03-26 10:33 PDT, Adenilson Cavalcanti Silva
no flags
Patch (7.26 KB, patch)
2014-03-26 10:51 PDT, Adenilson Cavalcanti Silva
no flags
Patch (21.90 KB, patch)
2014-03-26 13:14 PDT, Adenilson Cavalcanti Silva
no flags
Patch (21.66 KB, patch)
2014-03-26 18:11 PDT, Adenilson Cavalcanti Silva
no flags
Adenilson Cavalcanti Silva
Comment 1 2014-03-26 10:21:18 PDT
Simon Fraser (smfr)
Comment 2 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?)
Adenilson Cavalcanti Silva
Comment 3 2014-03-26 10:33:45 PDT
Adenilson Cavalcanti Silva
Comment 4 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.
Adenilson Cavalcanti Silva
Comment 5 2014-03-26 10:51:19 PDT
Adenilson Cavalcanti Silva
Comment 6 2014-03-26 10:52:11 PDT
Last patch uses const Filter*.
Simon Fraser (smfr)
Comment 7 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&
Adenilson Cavalcanti Silva
Comment 8 2014-03-26 13:14:40 PDT
Adenilson Cavalcanti Silva
Comment 9 2014-03-26 13:15:23 PDT
Agreed, FilterEffect will now return a ref.
Simon Fraser (smfr)
Comment 10 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
Adenilson Cavalcanti Silva
Comment 11 2014-03-26 18:11:43 PDT
Adenilson Cavalcanti Silva
Comment 12 2014-03-26 18:12:22 PDT
Removed unnecessary const.
Simon Fraser (smfr)
Comment 13 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.
WebKit Commit Bot
Comment 14 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>
WebKit Commit Bot
Comment 15 2014-03-26 21:15:00 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.