mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
icon-loader: add a new loader for XPM icons, used by many legacy X11 apps
Adapted from gdk-pixbuf, see the original at: https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/blob/master/gdk-pixbuf/io-xpm.c rgb.txt is from X.org, see: https://gitlab.freedesktop.org/xorg/app/rgb/-/blob/master/rgb.txt Differences from the gdk-pixbuf version: - GdkPixbuf replaced with struct lab_data_buffer - Progressive and in-memory loading code removed - Two functions that had separate BSD copyright rewritten - Stores colors as ARGB32 earlier in the decoding process for efficiency - Limited to 1024x1024 px and 1024 colors to prevent abuse - Uses struct buf to build strings, in place of manual g_new/g_realloc - Uses xzalloc/xznew_n for other memory allocations - Uses g_strlcpy in place of banned strcpy/strncpy/strncat - Uses standard C types (int, bool, etc.) in place of the GLib ones - Follows labwc coding style (whitespace, braces, letter case, etc.) - Et cetera ... v2: add Perl fixes from @domo141
This commit is contained in:
parent
887ec70ba4
commit
c9e0a6e125
8 changed files with 2880 additions and 2 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include "config.h"
|
||||
#include "icon-loader.h"
|
||||
#include "img/img-png.h"
|
||||
#include "img/img-xpm.h"
|
||||
|
||||
#if HAVE_RSVG
|
||||
#include "img/img-svg.h"
|
||||
|
|
@ -211,7 +212,7 @@ icon_loader_lookup(struct server *server, const char *app_id, int size, int scal
|
|||
#endif
|
||||
break;
|
||||
case SFDO_ICON_FILE_FORMAT_XPM:
|
||||
/* XPM is not supported */
|
||||
img_xpm_load(ctx.path, &icon_buffer);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue