When we are loading symbolic pngs or svgs, we know
that we need to the png or svg loader, so there is
no need to go through (surprisingly expensive) mime
sniffing to find the right loader.
When we are loading themed icons, we know if
we deal with an svg or png file, so it is
entirely unnecessarily to have gdk-pixbuf
use g_content_type guess to rediscover that
information.
Change the pixbuf utils apis we have to allow
passing format information down to where we
can use it when creating the pixbuf loader.
We were converting the same colors over and over again to a string, just
to free them again at the end of the function. We know the colors at
compile time however, so don't convert them at all.
load_symbolic_svg was loading the pixbuf just to get its size via
gdk_pixbuf_get_{width,height}. However, this function is called in a
loop in gtk_make_symbolic_pixbuf_from_data.
So, do this only once and pass the icon size along to load_symbolic_svg.
We wrap SVG data from icons within another SVG with extra styling
information. The wrapped SVG may contain characters that cannot be
part of a data: URL (https://fetch.spec.whatwg.org/#data-urls).
Librsvg 2.45 got more strict in its parsing of data: URLs; whereas
previously it ignored '#' characters in them, now it considers them to
be the start of a fragment identifier, which is not allowed in data:
URLs anyway.
To avoid unallowed characters, we now create a data: URL with a
base-64 encoded SVG.
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1471