[gnome-software/mwleeds/hardcoded-pwa-list: 6/10] 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: 6/10] epiphany: Don't try to use icons bigger than 512x512
- Date: Thu, 19 May 2022 19:00:46 +0000 (UTC)
commit 735544ac475633a28a94bd4e55a5430726be4849
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 133d9a215..8d98833f7 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -872,6 +872,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
@@ -890,10 +891,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]