Created attachment 258111 [details] test case Open the attached test case which contains an text SVG element with feMorphology filter on Retina display. Result: The display is corrupted. Note: If the same test case is opened on non-Retina display, the text is displayed fine.
<rdar://problem/22098031>
Created attachment 258224 [details] Patch
Created attachment 258254 [details] Patch
Comment on attachment 258254 [details] Patch Clearing flags on attachment: 258254 Committed r188271: <http://trac.webkit.org/changeset/188271>
All reviewed patches have been landed. Closing bug.
Comment on attachment 258254 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=258254&action=review > Source/WebCore/platform/graphics/filters/FEMorphology.cpp:244 > + paintingData.width = ceilf(effectDrawingRect.width() * filter.filterScale()); > + paintingData.height = ceilf(effectDrawingRect.height() * filter.filterScale()); > + paintingData.radiusX = ceilf(radiusX * filter.filterScale()); > + paintingData.radiusY = ceilf(radiusY * filter.filterScale()); Why are we ceiling both the location and the dimension here?
(In reply to comment #6) > Comment on attachment 258254 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=258254&action=review > > > Source/WebCore/platform/graphics/filters/FEMorphology.cpp:244 > > + paintingData.width = ceilf(effectDrawingRect.width() * filter.filterScale()); > > + paintingData.height = ceilf(effectDrawingRect.height() * filter.filterScale()); > > + paintingData.radiusX = ceilf(radiusX * filter.filterScale()); > > + paintingData.radiusY = ceilf(radiusY * filter.filterScale()); > > Why are we ceiling both the location and the dimension here? Is it wrong to do ceiling here? The filterScale() is set only to renderer().frame().page()->deviceScaleFactor() which is float. But it is 2 on Retina and 1 on none Retina. Can it be for example 1.5? I do not know. So I assumed filterScale() is just a float and can be any value. Now I have floating point calculations even the variables before scaling and after scaling are all integers. I thought it is safer to do ceiling to avoid not setting the bits of the last row or the last column if filterScale() has a fraction. And since we are dealing with a memory bitmap, we are sure that nothing will be drawn outside the image pre allocated area.