kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2_loaders.git/commit/?id=5f9ca24535cd3020263f7a9bfefc027a4b93f495

commit 5f9ca24535cd3020263f7a9bfefc027a4b93f495
Author: Kim Woelders <[email protected]>
Date:   Sat Mar 12 13:14:31 2022 +0100

    Update headers, adapt to imlib2 changes
---
 src/modules/loaders/Makefile.am     |  2 +-
 src/modules/loaders/common.h        | 28 +++++++++++++---------------
 src/modules/loaders/debug.h         |  5 ++---
 src/modules/loaders/image.h         | 28 ++++++++++------------------
 src/modules/loaders/loader_ani.c    |  2 +-
 src/modules/loaders/loader_common.h |  7 ++++++-
 src/modules/loaders/types.h         | 25 +++++++++++++++++++++++++
 7 files changed, 58 insertions(+), 39 deletions(-)

diff --git a/src/modules/loaders/Makefile.am b/src/modules/loaders/Makefile.am
index 2e5c392..276e45a 100644
--- a/src/modules/loaders/Makefile.am
+++ b/src/modules/loaders/Makefile.am
@@ -19,7 +19,7 @@ $(ANI_L) \
 $(EET_L) \
 $(XCF_L)
 
-EXTRA_DIST = common.h debug.h image.h loader_common.h
+EXTRA_DIST = common.h debug.h image.h types.h loader_common.h
 
 eet_la_SOURCES      = loader_eet.c
 eet_la_CPPFLAGS     = @EET_CFLAGS@
diff --git a/src/modules/loaders/common.h b/src/modules/loaders/common.h
index ec0ddb4..b0c0271 100644
--- a/src/modules/loaders/common.h
+++ b/src/modules/loaders/common.h
@@ -2,13 +2,7 @@
 #define __COMMON 1
 
 #include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <math.h>
-#include <time.h>
+#include "types.h"
 
 #if __GNUC__
 #define __PRINTF_N__(no)  __attribute__((__format__(__printf__, (no), (no)+1)))
@@ -20,12 +14,6 @@
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
 
-#define DATABIG unsigned long long
-#define DATA64  unsigned long long
-#define DATA32  unsigned int
-#define DATA16  unsigned short
-#define DATA8   unsigned char
-
 #define SWAP32(x) \
     ((((x) & 0x000000ff ) << 24) | \
      (((x) & 0x0000ff00 ) <<  8) | \
@@ -55,6 +43,18 @@
 #define PIXEL_G(argb)  (((argb) >>  8) & 0xff)
 #define PIXEL_B(argb)  (((argb)      ) & 0xff)
 
+#ifndef WORDS_BIGENDIAN
+#define A_VAL(p) ((DATA8 *)(p))[3]
+#define R_VAL(p) ((DATA8 *)(p))[2]
+#define G_VAL(p) ((DATA8 *)(p))[1]
+#define B_VAL(p) ((DATA8 *)(p))[0]
+#else
+#define A_VAL(p) ((DATA8 *)(p))[0]
+#define R_VAL(p) ((DATA8 *)(p))[1]
+#define G_VAL(p) ((DATA8 *)(p))[2]
+#define B_VAL(p) ((DATA8 *)(p))[3]
+#endif
+
 #define CLIP(x, y, w, h, xx, yy, ww, hh) \
     if (x < (xx)) { w += (x - (xx)); x = (xx); } \
     if (y < (yy)) { h += (y - (yy)); y = (yy); } \
@@ -64,6 +64,4 @@
 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
 
-#define round(x) ((x) >=0 ? (int)((x) + 0.5) : (int)((x) - 0.5))
-
 #endif
diff --git a/src/modules/loaders/debug.h b/src/modules/loaders/debug.h
index f9e6547..128fe61 100644
--- a/src/modules/loaders/debug.h
+++ b/src/modules/loaders/debug.h
@@ -17,10 +17,9 @@
 #define DL(fmt...) DC(DBG_LDR2, fmt)
 #endif
 
-__EXPORT__ extern unsigned int __imlib_debug;
+extern unsigned int __imlib_debug;
 
-__EXPORT__ __PRINTF_2__ void __imlib_printf(const char *pfx,
-                                            const char *fmt, ...);
+__PRINTF_2__ void   __imlib_printf(const char *pfx, const char *fmt, ...);
 
 unsigned int        __imlib_time_us(void);
 
diff --git a/src/modules/loaders/image.h b/src/modules/loaders/image.h
index 56a0bc0..240355f 100644
--- a/src/modules/loaders/image.h
+++ b/src/modules/loaders/image.h
@@ -1,16 +1,14 @@
 #ifndef __IMAGE
 #define __IMAGE 1
 
-#include "common.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
 
-typedef struct _imlibldctx ImlibLdCtx;
-typedef struct _imlibloader ImlibLoader;
+#include "types.h"
 
-typedef struct _ImlibImage ImlibImage;
+typedef struct _imlibldctx ImlibLdCtx;
 
-typedef int         (*ImlibProgressFunction)(ImlibImage * im, char percent,
-                                             int update_x, int update_y,
-                                             int update_w, int update_h);
 typedef void        (*ImlibDataDestructorFunction)(ImlibImage * im, void 
*data);
 typedef void       *(*ImlibImageDataMemoryFunction)(void *, size_t size);
 
@@ -24,8 +22,6 @@ enum _iflags {
    F_FORMAT_IRRELEVANT = (1 << 5),
 };
 
-typedef enum _iflags ImlibImageFlags;
-
 /* 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  */
@@ -82,15 +78,9 @@ typedef struct {
    int                 frame;
 } ImlibLoadArgs;
 
-void                __imlib_RemoveAllLoaders(void);
-ImlibLoader       **__imlib_GetLoaderList(void);
-ImlibLoader        *__imlib_FindBestLoaderForFile(const char *file,
-                                                  int for_save);
-ImlibLoader        *__imlib_FindBestLoaderForFormat(const char *format,
-                                                    int for_save);
-ImlibLoader        *__imlib_FindBestLoaderForFileFormat(const char *file,
-                                                        const char *format,
-                                                        int for_save);
+ImlibLoader        *__imlib_FindBestLoader(const char *file, const char 
*format,
+                                           int for_save);
+
 void                __imlib_LoaderSetFormats(ImlibLoader * l,
                                              const char *const *fmt,
                                              unsigned int num);
@@ -117,6 +107,8 @@ int                 __imlib_LoadProgress(ImlibImage * im,
 int                 __imlib_LoadProgressRows(ImlibImage * im,
                                              int row, int nrows);
 
+const char         *__imlib_GetKey(const ImlibImage * im);
+
 void                __imlib_AttachTag(ImlibImage * im, const char *key,
                                       int val, void *data,
                                       ImlibDataDestructorFunction destructor);
diff --git a/src/modules/loaders/loader_ani.c b/src/modules/loaders/loader_ani.c
index 3113145..7fc5b5e 100644
--- a/src/modules/loaders/loader_ani.c
+++ b/src/modules/loaders/loader_ani.c
@@ -230,7 +230,7 @@ load2(ImlibImage * im, int load_data)
    MsAni              *ani = NULL;
    MsChunk            *chunk;
 
-   loader = __imlib_FindBestLoaderForFormat("ico", 0);
+   loader = __imlib_FindBestLoader(NULL, "ico", 0);
    if (!loader)
       return LOAD_FAIL;
 
diff --git a/src/modules/loaders/loader_common.h 
b/src/modules/loaders/loader_common.h
index f81725b..5afbac1 100644
--- a/src/modules/loaders/loader_common.h
+++ b/src/modules/loaders/loader_common.h
@@ -1,8 +1,13 @@
 #ifndef __LOADER_COMMON_H
 #define __LOADER_COMMON_H 1
 
-#include "config.h"
 #include "common.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
 #include "debug.h"
 #include "image.h"
 
diff --git a/src/modules/loaders/types.h b/src/modules/loaders/types.h
new file mode 100644
index 0000000..5a09b8a
--- /dev/null
+++ b/src/modules/loaders/types.h
@@ -0,0 +1,25 @@
+#ifndef TYPES_H
+#define TYPES_H 1
+
+#define DATABIG unsigned long long
+#define DATA64  unsigned long long
+#define DATA32  unsigned int
+#define DATA16  unsigned short
+#define DATA8   unsigned char
+
+typedef struct _ImlibLoader ImlibLoader;
+
+typedef struct _ImlibImage ImlibImage;
+typedef unsigned int ImlibImageFlags;
+
+typedef int         (*ImlibProgressFunction)(ImlibImage * im, char percent,
+                                             int update_x, int update_y,
+                                             int update_w, int update_h);
+
+typedef int         ImlibOp;
+
+typedef struct _ImlibColorModifier ImlibColorModifier;
+
+typedef struct _ImlibUpdate ImlibUpdate;
+
+#endif /* TYPES_H */

-- 


Reply via email to