As already noted in the code comment, we all knew that the in memory
conversion to a PNG stream is a cumbersome technique. But it was worth
to remove the GTK dependency.
After finding out, that gdk_pixbuf_new_from_data can actually use a
GVariant and share its memory without allocating new memory, I poked
the cairo docs for a similar technique.
There is cairo_image_surface_create_for_data, which would achieve the
same, but cairo uses another color byte order. So we have to manually
copy and reassemble the bytes.
It may look like a big rise in complexity, but actually, it's straight
forward copying pixel by pixel and changing the byte's order.
And the gdk_pixbuf_to_cairo_surface is 33x faster.
As the get_pixbuf_from_file should retrieve a file's content, it
shouldn't fail silently, if the file isn't there.
For codepaths, which don't use the `icon_path` to search for a given
icon, it gives a clearer error message.
The icon_path has no point for searching an absolute filename. It was
actually meant to avoid the complex lookup algorithm of the icon theme
spec. And the iconname in this case should be actually just the icon's
basename when searching the path.
Concatenating icons like `~/testimg.png` with all icon paths has no
point and also an additional suffix has no point.
Cleans up the clutter in draw and since only a single icon function is
called externally from icon.c it'll make things easier if we ever decide
to switch icon libraries.
Rename both functions to make clear, what the difference between the
previous functions _from_file and _from_path is. Also remove the
superfluous `== NULL` checks as these don't match dunst's current style.