Skip to content
  • Alexander Larsson's avatar
    GtkImage: Preload icons during css validation · d1c6d78e
    Alexander Larsson authored
    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.
    d1c6d78e