Introduce types.h

Avoiding more conveluted header file inclusion order issues.
This commit is contained in:
Kim Woelders 2022-03-04 14:34:48 +01:00
parent 2dd4c665d0
commit 97b3aa9b9b
42 changed files with 55 additions and 83 deletions

View File

@ -42,6 +42,7 @@ rotate.c rotate.h \
scale.c scale.h \
script.c script.h \
span.c span.h \
types.h \
updates.c updates.h
MMX_SRCS = \

View File

@ -1,7 +1,7 @@
#ifndef __BLEND
#define __BLEND 1
#include "colormod.h"
#include "types.h"
#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
((x < (xx + ww)) && \
@ -337,8 +337,6 @@ enum _imlibop {
OP_RESHADE
};
typedef enum _imlibop ImlibOp;
typedef void (*ImlibBlendFunction)(DATA32 *, int, DATA32 *, int, int,
int, ImlibColorModifier *);

View File

@ -1,16 +1,15 @@
#ifndef __COLORMOD
#define __COLORMOD 1
#include "common.h"
#include "image.h"
#include "types.h"
typedef struct {
struct _ImlibColorModifier {
DATA8 red_mapping[256];
DATA8 green_mapping[256];
DATA8 blue_mapping[256];
DATA8 alpha_mapping[256];
DATABIG modification_count;
} ImlibColorModifier;
};
#define CMOD_APPLY_RGB(cm, r, g, b) \
(r) = (cm)->red_mapping[(int)(r)]; \

View File

@ -2,6 +2,7 @@
#define __COMMON 1
#include "config.h"
#include "types.h"
#if __GNUC__
#define __PRINTF_N__(no) __attribute__((__format__(__printf__, (no), (no)+1)))
@ -13,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) | \

View File

@ -14,7 +14,6 @@
#include "dynamic_filters.h"
#include "file.h"
#include "image.h"
#include "script.h"
static ImlibExternalFilter *filters = NULL;

View File

@ -1,7 +1,6 @@
#include "common.h"
#include "blend.h"
#include "colormod.h"
#include "image.h"
#include "rgbadraw.h"
#include "span.h"

View File

@ -2,8 +2,6 @@
#include <stdlib.h>
#include "blend.h"
#include "colormod.h"
#include "filter.h"
#include "image.h"

View File

@ -5,8 +5,8 @@
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include "common.h"
#include "object.h"
#include "types.h"
typedef struct _Imlib_Font {
Imlib_Object_List _list_data;

View File

@ -8,7 +8,6 @@
#include <sys/types.h>
#include "blend.h"
#include "colormod.h"
#include "font.h"
#include "image.h"
#include "rgbadraw.h"

View File

@ -7,13 +7,8 @@
#include <string.h>
#include <sys/types.h>
#include "blend.h"
#include "colormod.h"
#include "file.h"
#include "font.h"
#include "image.h"
#include "rgbadraw.h"
#include "rotate.h"
extern FT_Library ft_lib;

View File

@ -7,12 +7,7 @@
#include <string.h>
#include <sys/types.h>
#include "blend.h"
#include "colormod.h"
#include "font.h"
#include "image.h"
#include "rgbadraw.h"
#include "rotate.h"
FT_Library ft_lib;

View File

@ -7,12 +7,7 @@
#include <string.h>
#include <sys/types.h>
#include "blend.h"
#include "colormod.h"
#include "image.h"
#include "font.h"
#include "rgbadraw.h"
#include "rotate.h"
extern FT_Library ft_lib;

View File

@ -4,7 +4,6 @@
#include <stdlib.h>
#include "blend.h"
#include "colormod.h"
#include "color_helpers.h"
#include "grad.h"
#include "image.h"

View File

@ -1,7 +1,7 @@
#ifndef __GRAD
#define __GRAD 1
#include "common.h"
#include "types.h"
typedef struct _ImlibRangeColor {
DATA8 red, green, blue, alpha;

View File

@ -5,16 +5,10 @@
#include <stdlib.h>
#include <time.h>
#include "common.h"
#include "types.h"
typedef struct _imlibldctx ImlibLdCtx;
typedef struct _ImlibLoader ImlibLoader;
typedef struct _ImlibImage ImlibImage;
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);
@ -28,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 */

View File

@ -3,7 +3,6 @@
#include <stdlib.h>
#include "blend.h"
#include "colormod.h"
#include "image.h"
#include "rgbadraw.h"
#include "span.h"

View File

@ -8,7 +8,6 @@
#include "debug.h"
#include "file.h"
#include "image.h"
#include "loaders.h"
#define DBG_PFX "LOAD"

View File

@ -1,7 +1,7 @@
#ifndef __LOADERS
#define __LOADERS 1
#include "image.h"
#include "types.h"
struct _ImlibLoader {
char *file;

View File

@ -5,7 +5,6 @@
#include <string.h>
#include "file.h"
#include "image.h"
static const char *
__imlib_PathToModules(void)

View File

@ -4,7 +4,6 @@
#include <string.h>
#include "blend.h"
#include "colormod.h"
#include "image.h"
#include "rgbadraw.h"
#include "span.h"

View File

@ -1,7 +1,6 @@
#include "common.h"
#include "blend.h"
#include "colormod.h"
#include "image.h"
#include "rgbadraw.h"
#include "span.h"

View File

@ -4,12 +4,8 @@
#include <stdlib.h>
#include <string.h>
#include "blend.h"
#include "colormod.h"
#include "image.h"
#include "rgbadraw.h"
#include "scale.h"
#include "updates.h"
void
__imlib_FlipImageHoriz(ImlibImage * im)

View File

@ -1,8 +1,7 @@
#ifndef __RGBADRAW
#define __RGBADRAW 1
#include "common.h"
#include "updates.h"
#include "types.h"
#define IN_SEGMENT(x, sx, sw) \
((unsigned)((x) - (sx)) < (unsigned)(sw))

View File

@ -4,6 +4,7 @@
#include "asm_c.h"
#include "blend.h"
#include "image.h"
#include "rotate.h"
/*\ Linear interpolation functions \*/

View File

@ -1,10 +1,7 @@
#ifndef __ROTATE
#define __ROTATE 1
#include "common.h"
#include "image.h"
#include "colormod.h"
#include "blend.h"
#include "types.h"
/*\ Calc precision \*/
#define _ROTATE_PREC 12

View File

@ -5,8 +5,6 @@
#include <string.h>
#include "asm_c.h"
#include "blend.h"
#include "colormod.h"
#include "image.h"
#include "scale.h"

View File

@ -1,7 +1,7 @@
#ifndef __SCALE
#define __SCALE 1
#include "common.h"
#include "types.h"
typedef struct _imlib_scale_info ImlibScaleInfo;

View File

@ -14,7 +14,6 @@
#include <sys/stat.h>
#include "dynamic_filters.h"
#include "image.h"
#include "script.h"
/*

View File

@ -2,8 +2,7 @@
#define _DYN_FUNCTION_H_
#include <stdarg.h>
#include "common.h"
#include "image.h"
#include "types.h"
#define VAR_CHAR 1
#define VAR_PTR 2

View File

@ -3,8 +3,6 @@
#include <stddef.h>
#include "blend.h"
#include "colormod.h"
#include "image.h"
#include "span.h"
#define ADD_COPY(r, g, b, dest) \

View File

@ -1,7 +1,7 @@
#ifndef __SPAN
#define __SPAN 1
#include "common.h"
#include "types.h"
typedef void (*ImlibPointDrawFunction)(DATA32, DATA32 *);

25
src/lib/types.h Normal file
View File

@ -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 */

View File

@ -1,10 +1,10 @@
#ifndef __UPDATES
#define __UPDATES 1
typedef struct _ImlibUpdate {
struct _ImlibUpdate {
int x, y, w, h;
struct _ImlibUpdate *next;
} ImlibUpdate;
};
ImlibUpdate *__imlib_AddUpdate(ImlibUpdate * u,
int x, int y, int w, int h);

View File

@ -1,7 +1,8 @@
#ifndef X11_COLOR_H
#define X11_COLOR_H 1
#include "common.h"
#include <X11/Xlib.h>
#include "types.h"
typedef enum {
PAL_TYPE_332, /* 0 */

View File

@ -3,7 +3,6 @@
#include <stdlib.h>
#include <X11/Xlib.h>
#include "image.h"
#include "x11_color.h"
#include "x11_context.h"
#include "x11_rgba.h"

View File

@ -1,7 +1,8 @@
#ifndef X11_CONTEXT_H
#define X11_CONTEXT_H 1
#include "common.h"
#include <X11/Xlib.h>
#include "types.h"
typedef struct _Context {
int last_use;

View File

@ -1,7 +1,8 @@
#ifndef X11_GRAB_H
#define X11_GRAB_H 1
#include "common.h"
#include <X11/Xlib.h>
#include "types.h"
int __imlib_GrabDrawableToRGBA(DATA32 * data, int x_dst,
int y_dst, int w_dst, int h_dst,

View File

@ -4,6 +4,9 @@
#include <string.h>
#include <X11/Xlib.h>
#include "blend.h"
#include "colormod.h"
#include "image.h"
#include "x11_pixmap.h"
#include "x11_rend.h"

View File

@ -3,7 +3,7 @@
#include <X11/Xlib.h>
#include "image.h"
#include "types.h"
void __imlib_CleanupImagePixmapCache(void);
int __imlib_PixmapCacheSize(void);
@ -12,8 +12,6 @@ void __imlib_FreePixmap(Display * d, Pixmap p);
void __imlib_DirtyPixmapsForImage(const ImlibImage * im);
void __imlib_PixmapUnrefImage(const ImlibImage * im);
#include "colormod.h"
char __imlib_CreatePixmapsForImage(Display * d, Drawable w,
Visual * v, int depth,
Colormap cm, ImlibImage * im,

View File

@ -1,8 +1,7 @@
#ifndef X11_REND_H
#define X11_REND_H 1
#include "common.h"
#include "blend.h"
#include "types.h"
DATA32 __imlib_RenderGetPixel(Display * d, Drawable w, Visual * v,
Colormap cm, int depth, DATA8 r,

View File

@ -1,7 +1,7 @@
#ifndef X11_RGBA_H
#define X11_RGBA_H 1
#include "common.h"
#include "types.h"
#define DM_BS1 (8 + 3)
#define DM_BS2 (8)

View File

@ -6,7 +6,6 @@
#include <string.h>
#include "filter_common.h"
#include "colormod.h"
#include "blend.h"
#define PI (4 * atan(1))