[gnome-software/1131-featured-carousel: 12/21] gs-appstream: Load 256px icon for use by featured apps when in hi-DPI




commit f2a7c88bef0a5977748b75a53dc6052b88d78419
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Feb 17 20:24:07 2021 +0000

    gs-appstream: Load 256px icon for use by featured apps when in hi-DPI
    
    This could be optimised in future to only load the icon on demand, but
    for now this will get the featured apps carousel working in time for the
    UI freeze.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1131

 plugins/core/gs-appstream.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index 930416ae7..062761623 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -208,24 +208,20 @@ gs_appstream_refine_icon (GsPlugin *plugin, GsApp *app, XbNode *component)
                gs_app_add_icon (app, icon);
        }
 
-       /* if HiDPI get a 128px cached icon */
-       if (gs_plugin_get_scale (plugin) == 2) {
-               icon = gs_appstream_get_icon_by_kind_and_size (component,
-                                                              AS_ICON_KIND_CACHED,
-                                                              128);
-               if (icon != NULL) {
-                       gs_app_add_icon (app, icon);
-                       return;
-               }
+       /* cached icon for large uses */
+       icon = gs_appstream_get_icon_by_kind_and_size (component,
+                                                      AS_ICON_KIND_CACHED,
+                                                      128 * gs_plugin_get_scale (plugin));
+       if (icon != NULL) {
+               gs_app_add_icon (app, icon);
        }
 
-       /* non-HiDPI cached icon */
+       /* cached icon for normal uses */
        icon = gs_appstream_get_icon_by_kind_and_size (component,
                                                       AS_ICON_KIND_CACHED,
-                                                      64);
+                                                      64 * gs_plugin_get_scale (plugin));
        if (icon != NULL) {
                gs_app_add_icon (app, icon);
-               return;
        }
 
        /* prefer local */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]