Skip to content

Port Image, refactor filter bounds, add some tests, fix #277

Ivan Molodetskikh requested to merge YaLTeR/librsvg:filters-to-rust-4 into master
  • Ported feImage and added some of the reference tests.
  • Fixed bbox computation in draw_surface() (it was setting incorrect bbox for <image> tags, which lead to one of the newly added feImage test which happens to use both image and feImage to produce incorrect results).

Other reference tests are failing due to what I'm rather sure is incorrect filter bounding box computation. I'll try fixing (or rather re-making) the bounding box computation over the next few days; I need to familiarize myself with more of the rendering code to do that.

  • Remade filter bounds computations which fixed the above. Unfortunately it added one more row of pixels to composite-02, however once again at zoom level 3 it disappears. I tried debugging it but everything seems more or less ok. I suspect multiple float->int conversions (feImage bounds float->int, then used in composite bounds computations ->float, then back into ->int). Maybe it'll be a better idea to change the code so that intermediate bounds are stored in floats (which should be possible now).

  • Fixed the crash in #277 (closed), added the file as a test.

  • Added a couple of misc bounds tests.

  • Fixed one of the input surfaces in composite arithmetic not being linearized (I must've accidentally removed that when doing the get_input refactor). So turns out not linearizing the second surface gives much closer results on the tests (241 light source as well as newly added composite tests)? Am I missing something here?

  • Fixed feOffset using RsvgLength when it should have been using regular numbers.

  • Split parse() into parse() and parse_and_validate().

  • Made it so filters with errors aren't rendered.

  • Added strict units checking to filter bounds.

Edited by Ivan Molodetskikh

Merge request reports