Move x_VAL() macros to common.h

This commit is contained in:
Kim Woelders 2022-03-04 11:28:35 +01:00
parent 46dc96436a
commit 2dd4c665d0
2 changed files with 12 additions and 16 deletions

View File

@ -3,22 +3,6 @@
#include "colormod.h"
#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 INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
((x < (xx + ww)) && \
(y < (yy + hh)) && \

View File

@ -48,6 +48,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); } \