Okay more #unpaper refactoring concerns. The functions are all over the place both in terms of maintaining state and accessing global parameters. Plus structure sizes are fixed with arrays, because of course this is basic C.
@DavidNielsen@flameeyes I guess I was blocked for this, I can't see the thread any more 🤣. Rust GUI libraries are growing quickly, and I am writing many complex GUI apps for COSMIC exclusively in Rust.
@hayalci@flameeyes This wouldn't actually be such a bad idea if the original project is in C, but for graphics libraries the situation is still a bit wonky 😶
@flameeyes Over in the GNOME world we've been moving some things to use the Rust image codecs; they are working well. Do you want some details? (TL;DR - the actual codecs under the "image" crate are much better than they were when you wrote your blog entry.)
I did some research around porting libjpeg-turbo to Rust and arrived at some conclusions - also happy to talk about this.
(For unpaper - looked at the sources briefly - yes! Put things in neat structs instead of global vars!)
@flameeyes Oh man. The unpaper sources are verrrrrry similar to something I've refactored before.
Do you want some refactoring advice? I think this can be turned into reusable code reasonably easily, with bog-standard refactoring. I read your "re-designing an interface" blog post and it's totally doable.
@federicomena any advice is always appreciated 😀 but in general it's not my first refactor, it's more a balancing act between finding the time and keeping it working, given I don't actually use the tool myself directly anymore 😞
I'm already glad I managed to split it into separate files, when I forked it it was a single unpaper.c with everything inside 😬
Add comment