Commit 0a2d2ccf authored by Nathan Lee's avatar Nathan Lee

Crashfix opening filters.svg in flatpak

In the feComponentTransfer table parameter, adds
extra cases per specs. Matches old behavior if
one value in table (not well defined in the specs)
http://www.w3.org/TR/SVG11/filters.html#feFuncAElement

#815
(cherry-picked from 4337e477)
parent 18639f5d
Pipeline #183671194 passed with stages
in 92 minutes and 6 seconds
......@@ -76,11 +76,20 @@ struct ComponentTransferTable : public ComponentTransfer {
}
}
guint32 operator()(guint32 in) {
if (_v.empty()) {
return in;
}
guint32 component = (in & _mask) >> _shift;
guint32 k = (_v.size() - 1) * component;
guint32 dx = k % 255; k /= 255;
component = _v[k]*255 + (_v[k+1] - _v[k])*dx;
component = (component + 127) / 255;
if (_v.size() == 1 || component == 255) {
component = _v.back();
} else {
guint32 k = ((_v.size() - 1) * component);
guint32 dx = k % 255;
k /= 255;
component = _v[k]*255 + (_v[k+1] - _v[k])*dx;
component = (component + 127) / 255;
}
return (in & ~_mask) | (component << _shift);
}
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment