[gnome-software/mwleeds/hardcoded-pwa-list: 4/6] 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: 4/6] epiphany: Don't try to use icons bigger than 512x512
- Date: Fri, 11 Mar 2022 18:06:18 +0000 (UTC)
commit 638e1819bb7ab55164354c5aebe7004c48a96f4a
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 b0f306e92..5f1f0845b 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -712,6 +712,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
@@ -730,10 +731,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]