diff options
author | Alexander Larsson <alexl@redhat.com> | 2020-01-29 18:10:13 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2020-01-30 10:53:43 +0100 |
commit | d1c6d78ebb1de39d448b0e8afab13ad495bcadb6 (patch) | |
tree | abd5cd315faadfac12e042188677f601dbbf331f /gtk/gtkiconhelperprivate.h | |
parent | 6a8001fe7d2818d50fbf133b27c823726c28d97d (diff) | |
download | gtk+-d1c6d78ebb1de39d448b0e8afab13ad495bcadb6.tar.gz |
GtkImage: Preload icons during css validation
At the end of GtkImage css validation (during style-updated) when the
css properties (like the icon size) are valid we call _gtk_icon_helper_preload
which does an async icon theme lookup and load. This will happen on a thread
in parallel with the rest of the css machinery, and hopefully by the
time we need the icon it will be ready. If not we will block when we need
it, but during that blocking all the other icons will be loaded.
Testing widget-factory this changes the time of snapshot() from 31 to
25 msec, but on the other hand we also load a few more icons that we
didn't before causing the css validation phase to be about 8 msec slower.
This is because we're preloading all the images in the window, not only
the ones that are visible.
Unfortunately we still load a bunch of icons in snapshot(), from
GtkCssImageIconTheme, and ideally we should try to preload those also.
Diffstat (limited to 'gtk/gtkiconhelperprivate.h')
-rw-r--r-- | gtk/gtkiconhelperprivate.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gtk/gtkiconhelperprivate.h b/gtk/gtkiconhelperprivate.h index b7656bb849..9fbed2a92c 100644 --- a/gtk/gtkiconhelperprivate.h +++ b/gtk/gtkiconhelperprivate.h @@ -48,6 +48,7 @@ void _gtk_icon_helper_set_icon_name (GtkIconHelper *self, const gchar *icon_name); void _gtk_icon_helper_set_paintable (GtkIconHelper *self, GdkPaintable *paintable); +void _gtk_icon_helper_preload (GtkIconHelper *self); gboolean _gtk_icon_helper_set_pixel_size (GtkIconHelper *self, gint pixel_size); |