kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2_loaders.git/commit/?id=0072a7d858913658b73e82d3b57ea2a7d3a19ee9
commit 0072a7d858913658b73e82d3b57ea2a7d3a19ee9 Author: Kim Woelders <[email protected]> Date: Sun Feb 6 13:58:22 2022 +0100 Copy updated headers from imlib2 --- src/modules/loaders/debug.h | 7 ++++- src/modules/loaders/image.h | 62 ++++++++++++++++++++++++------------- src/modules/loaders/loader_common.h | 10 ++++++ 3 files changed, 57 insertions(+), 22 deletions(-) diff --git a/src/modules/loaders/debug.h b/src/modules/loaders/debug.h index f6bab08..f9e6547 100644 --- a/src/modules/loaders/debug.h +++ b/src/modules/loaders/debug.h @@ -9,10 +9,12 @@ #define DBG_FILE 0x0001 #define DBG_LOAD 0x0002 #define DBG_LDR 0x0004 +#define DBG_LDR2 0x0008 #if __LOADER_COMMON_H #undef D -#define D(fmt...) DC(DBG_LDR, fmt) +#define D(fmt...) DC(DBG_LDR, fmt) +#define DL(fmt...) DC(DBG_LDR2, fmt) #endif __EXPORT__ extern unsigned int __imlib_debug; @@ -26,6 +28,9 @@ unsigned int __imlib_time_us(void); #define D(fmt...) #define DC(fmt...) +#if __LOADER_COMMON_H +#define DL(fmt...) +#endif #endif /* IMLIB2_DEBUG */ diff --git a/src/modules/loaders/image.h b/src/modules/loaders/image.h index 712269e..393c37b 100644 --- a/src/modules/loaders/image.h +++ b/src/modules/loaders/image.h @@ -3,13 +3,10 @@ #include "common.h" -typedef struct _imlibimage ImlibImage; typedef struct _imlibldctx ImlibLdCtx; - -typedef struct _imlibborder ImlibBorder; typedef struct _imlibloader ImlibLoader; -typedef struct _imlibimagetag ImlibImageTag; -typedef enum _imlib_load_error ImlibLoadError; + +typedef struct _ImlibImage ImlibImage; typedef int (*ImlibProgressFunction)(ImlibImage * im, char percent, int update_x, int update_y, @@ -32,19 +29,25 @@ enum _iflags { typedef enum _iflags ImlibImageFlags; -struct _imlibborder { +/* Must match the ones in Imlib2.h.in */ +#define FF_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */ +#define FF_FRAME_BLEND (1 << 1) /* Blend current onto previous frame */ +#define FF_FRAME_DISPOSE_CLEAR (1 << 2) /* Clear before rendering next frame */ +#define FF_FRAME_DISPOSE_PREV (1 << 3) /* Revert before rendering next frame */ + +typedef struct { int left, right, top, bottom; -}; +} ImlibBorder; -struct _imlibimagetag { +typedef struct _ImlibImageTag { char *key; int val; void *data; void (*destructor)(ImlibImage * im, void *data); - ImlibImageTag *next; -}; + struct _ImlibImageTag *next; +} ImlibImageTag; -struct _imlibimage { +struct _ImlibImage { char *file; int w, h; DATA32 *data; @@ -62,8 +65,26 @@ struct _imlibimage { ImlibLdCtx *lc; FILE *fp; off_t fsize; + int canvas_w; /* Canvas size */ + int canvas_h; + int frame_count; /* Number of frames */ + int frame_num; /* Current frame */ + int frame_x; /* Frame origin */ + int frame_y; + int frame_flags; /* Frame flags */ + int frame_delay; /* Frame delay (ms) */ }; +typedef struct { + FILE *fp; + ImlibProgressFunction pfunc; + int pgran; + char immed; + char nocache; + int err; + int frame; +} ImlibLoadArgs; + void __imlib_RemoveAllLoaders(void); ImlibLoader **__imlib_GetLoaderList(void); ImlibLoader *__imlib_FindBestLoaderForFile(const char *file, @@ -78,11 +99,7 @@ void __imlib_LoaderSetFormats(ImlibLoader * l, unsigned int num); ImlibImage *__imlib_CreateImage(int w, int h, DATA32 * data); -ImlibImage *__imlib_LoadImage(const char *file, FILE * fp, - ImlibProgressFunction progress, - char progress_granularity, - char immediate_load, char dont_cache, - ImlibLoadError * er); +ImlibImage *__imlib_LoadImage(const char *file, ImlibLoadArgs * ila); int __imlib_LoadEmbedded(ImlibLoader * l, ImlibImage * im, const char *file, int load_data); int __imlib_LoadImageData(ImlibImage * im); @@ -90,8 +107,7 @@ void __imlib_DirtyImage(ImlibImage * im); void __imlib_FreeImage(ImlibImage * im); void __imlib_SaveImage(ImlibImage * im, const char *file, ImlibProgressFunction progress, - char progress_granularity, - ImlibLoadError * er); + char progress_granularity, int *er); DATA32 *__imlib_AllocateData(ImlibImage * im); void __imlib_FreeData(ImlibImage * im); @@ -128,9 +144,13 @@ int __imlib_CurrentCacheSize(void); #define UPDATE_FLAG(flags, f, set) \ do { if (set) SET_FLAG(flags, f); else UNSET_FLAG(flags, f); } while(0) -#define LOAD_FAIL 0 -#define LOAD_SUCCESS 1 -#define LOAD_BREAK 2 +#define LOAD_BREAK 2 /* Break signaled by progress callback */ +#define LOAD_SUCCESS 1 /* Image loaded successfully */ +#define LOAD_FAIL 0 /* Image was not recognized by loader */ +#define LOAD_OOM -1 /* Could not allocate memory */ +#define LOAD_BADFILE -2 /* File could not be accessed */ +#define LOAD_BADIMAGE -3 /* Image is corrupt */ +#define LOAD_BADFRAME -4 /* Requested frame not found */ /* 32767 is the maximum pixmap dimension and ensures that * (w * h * sizeof(DATA32)) won't exceed ULONG_MAX */ diff --git a/src/modules/loaders/loader_common.h b/src/modules/loaders/loader_common.h index 512ade8..f81725b 100644 --- a/src/modules/loaders/loader_common.h +++ b/src/modules/loaders/loader_common.h @@ -13,4 +13,14 @@ __EXPORT__ char save(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity); __EXPORT__ void formats(ImlibLoader * l); +typedef int (imlib_decompress_load_f) (const void *fdata, + unsigned int fsize, int dest); + +int decompress_load(ImlibImage * im, int load_data, + const char *const *pext, int next, + imlib_decompress_load_f * fdec); + +#define QUIT_WITH_RC(_err) { rc = _err; goto quit; } +#define QUITx_WITH_RC(_err, _lbl) { rc = _err; goto _lbl; } + #endif /* __LOADER_COMMON_H */ --
