[gnome-software/mwleeds/hardcoded-pwa-list: 224/232] epiphany: Don't try to use icons bigger than 512x512
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/mwleeds/hardcoded-pwa-list: 224/232] epiphany: Don't try to use icons bigger than 512x512
- Date: Mon, 21 Mar 2022 23:15:39 +0000 (UTC)
commit d8be83a71f86a0b0af71b87851262293002c4f40
Author: Phaedrus Leeds <mwleeds protonmail com>
Date: Wed Mar 9 15:56:35 2022 -0800
epiphany: Don't try to use icons bigger than 512x512
Some web apps only provide an icon that's 1024x1024, but the dynamic
launcher portal requires a max size of 512x512, so scale them down if
needed.
plugins/epiphany/gs-plugin-epiphany.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index 82a9088c6..b1619e380 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -754,6 +754,7 @@ get_serialized_icon (GsApp *app,
g_autoptr(GBytes) bytes = NULL;
g_autoptr(GIcon) bytes_icon = NULL;
g_autoptr(GVariant) icon_v = NULL;
+ guint icon_width;
/* Note: GsRemoteIcon will work on this GFileIcon code path.
* The icons plugin should have called
@@ -772,10 +773,15 @@ get_serialized_icon (GsApp *app,
return NULL;
}
+ /* Scale down to the portal's size limit if needed */
+ icon_width = gs_icon_get_width (icon);
+ if (icon_width > 512)
+ icon_width = 512;
+
/* Serialize the icon as a #GBytesIcon since that's
* what the dynamic launcher portal requires.
*/
- stream = g_loadable_icon_load (G_LOADABLE_ICON (icon), 0, NULL, NULL, NULL);
+ stream = g_loadable_icon_load (G_LOADABLE_ICON (icon), icon_width, NULL, NULL, NULL);
/* Icons are usually smaller than 1 MiB. Set a 10 MiB
* limit so we can't use a huge amount of memory or hit
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]