This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository legacy-imlib2.
View the commit online.
commit b39d33c80020aaa63bc865d640cb4cfa5eb7332a
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Fri Mar 11 19:55:51 2022 +0100
image: Change has alpha flag to separate byte
It is the only flag that should be used by the loaders
---
src/lib/Imlib2_Loader.h | 12 ++----------
src/lib/api.c | 24 ++++++++++++------------
src/lib/blend.c | 10 +++++-----
src/lib/colormod.c | 4 ++--
src/lib/colormod.h | 2 +-
src/lib/draw_ellipse.c | 12 ++++++------
src/lib/draw_line.c | 12 +++++-------
src/lib/draw_polygon.c | 14 ++++++--------
src/lib/draw_rectangle.c | 8 ++++----
src/lib/font_draw.c | 6 +++---
src/lib/grad.c | 2 +-
src/lib/image.h | 18 ++++++++----------
src/lib/types.h | 1 -
src/lib/x11_pixmap.c | 2 +-
src/lib/x11_rend.c | 11 +++++------
src/modules/loaders/loader_argb.c | 5 ++---
src/modules/loaders/loader_bmp.c | 6 +++---
src/modules/loaders/loader_ff.c | 2 +-
src/modules/loaders/loader_gif.c | 2 +-
src/modules/loaders/loader_heif.c | 2 +-
src/modules/loaders/loader_ico.c | 2 +-
src/modules/loaders/loader_j2k.c | 6 ++----
src/modules/loaders/loader_jxl.c | 2 +-
src/modules/loaders/loader_lbm.c | 4 ++--
src/modules/loaders/loader_png.c | 4 ++--
src/modules/loaders/loader_pnm.c | 4 ++--
src/modules/loaders/loader_svg.c | 2 +-
src/modules/loaders/loader_tga.c | 12 ++++++------
src/modules/loaders/loader_tiff.c | 5 ++---
src/modules/loaders/loader_webp.c | 2 +-
src/modules/loaders/loader_xpm.c | 2 +-
31 files changed, 90 insertions(+), 110 deletions(-)
diff --git a/src/lib/Imlib2_Loader.h b/src/lib/Imlib2_Loader.h
index 208826e..ad79c37 100644
--- a/src/lib/Imlib2_Loader.h
+++ b/src/lib/Imlib2_Loader.h
@@ -17,7 +17,6 @@
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,
@@ -138,7 +137,8 @@ struct _ImlibImage {
int w, h;
uint32_t *data;
- ImlibImageFlags flags;
+ char has_alpha;
+ char rsvd[3];
int canvas_w; /* Canvas size */
int canvas_h;
@@ -150,14 +150,6 @@ struct _ImlibImage {
int frame_delay; /* Frame delay (ms) */
};
-#define F_HAS_ALPHA (1 << 0)
-
-#define IM_FLAG_SET(im, f) ((im)->flags |= (f))
-#define IM_FLAG_CLR(im, f) ((im)->flags &= ~(f))
-#define IM_FLAG_UPDATE(im, f, set) \
- do { if (set) IM_FLAG_SET(im, f); else IM_FLAG_CLR(im, f); } while(0)
-#define IM_FLAG_ISSET(im, f) (((im)->flags & (f)) != 0)
-
/* 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 */
diff --git a/src/lib/api.c b/src/lib/api.c
index 530b8e3..6ec32c9 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -1017,7 +1017,7 @@ imlib_image_has_alpha(void)
CHECK_PARAM_POINTER_RETURN("image", ctx->image, 0);
CAST_IMAGE(im, ctx->image);
- if (IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (im->has_alpha)
return 1;
return 0;
}
@@ -1111,7 +1111,7 @@ imlib_image_set_has_alpha(char has_alpha)
CHECK_PARAM_POINTER("image", ctx->image);
CAST_IMAGE(im, ctx->image);
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, has_alpha);
+ im->has_alpha = has_alpha;
}
#ifdef BUILD_X11
@@ -1348,7 +1348,7 @@ imlib_create_image_from_drawable(Pixmap mask, int x, int y, int width,
ctx->colormap, ctx->depth, x, y, width,
height, &domask, need_to_grab_x))
{
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, domask);
+ im->has_alpha = domask;
}
else
{
@@ -1419,7 +1419,7 @@ imlib_create_scaled_image_from_drawable(Pixmap mask, int source_x,
source_width, source_height,
&domask, need_to_grab_x);
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, domask);
+ im->has_alpha = domask;
return im;
}
@@ -1545,9 +1545,9 @@ imlib_create_cropped_image(int x, int y, int width, int height)
__imlib_FreeImage(im);
return NULL;
}
- if (IM_FLAG_ISSET(im_old, F_HAS_ALPHA))
+ if (im_old->has_alpha)
{
- IM_FLAG_SET(im, F_HAS_ALPHA);
+ im->has_alpha = 1;
__imlib_BlendImageToImage(im_old, im, 0, 0, 1, x, y, abs(width),
abs(height), 0, 0, width, height, NULL,
(ImlibOp) IMLIB_OP_COPY,
@@ -1587,9 +1587,9 @@ imlib_create_cropped_scaled_image(int source_x, int source_y,
__imlib_FreeImage(im);
return NULL;
}
- if (IM_FLAG_ISSET(im_old, F_HAS_ALPHA))
+ if (im_old->has_alpha)
{
- IM_FLAG_SET(im, F_HAS_ALPHA);
+ im->has_alpha = 1;
__imlib_BlendImageToImage(im_old, im, ctx->anti_alias, 0, 1, source_x,
source_y, source_width, source_height, 0, 0,
destination_width, destination_height, NULL,
@@ -2426,7 +2426,7 @@ imlib_apply_color_modifier(void)
if (__imlib_LoadImageData(im))
return;
__imlib_DirtyImage(im);
- __imlib_DataCmodApply(im->data, im->w, im->h, 0, &(im->flags),
+ __imlib_DataCmodApply(im->data, im->w, im->h, 0, im->has_alpha,
(ImlibColorModifier *) ctx->color_modifier);
}
@@ -2464,7 +2464,7 @@ imlib_apply_color_modifier_to_rectangle(int x, int y, int width, int height)
return;
__imlib_DirtyImage(im);
__imlib_DataCmodApply(im->data + (y * im->w) + x, width, height,
- im->w - width, &(im->flags),
+ im->w - width, im->has_alpha,
(ImlibColorModifier *) ctx->color_modifier);
}
@@ -2957,7 +2957,7 @@ imlib_create_rotated_image(double angle)
__imlib_RotateSample(im_old->data, im->data, im_old->w, im_old->w,
im_old->h, im->w, sz, sz, x, y, dx, dy, -dy, dx);
}
- IM_FLAG_SET(im, F_HAS_ALPHA);
+ im->has_alpha = 1;
return im;
}
@@ -3016,7 +3016,7 @@ imlib_rotate_image_from_buffer(double angle, Imlib_Image source_image)
__imlib_RotateSample(im_old->data, im->data, im_old->w, im_old->w,
im_old->h, im->w, sz, sz, x, y, dx, dy, -dy, dx);
}
- IM_FLAG_SET(im, F_HAS_ALPHA);
+ im->has_alpha = 1;
return;
}
diff --git a/src/lib/blend.c b/src/lib/blend.c
index d3a3a8f..b431280 100644
--- a/src/lib/blend.c
+++ b/src/lib/blend.c
@@ -1814,9 +1814,9 @@ __imlib_BlendImageToImage(ImlibImage * im_src, ImlibImage * im_dst,
if ((ssw == ddw) && (ssh == ddh))
{
- if (!IM_FLAG_ISSET(im_dst, F_HAS_ALPHA))
+ if (!im_dst->has_alpha)
merge_alpha = 0;
- if (!IM_FLAG_ISSET(im_src, F_HAS_ALPHA))
+ if (!im_src->has_alpha)
{
rgb_src = 1;
if (merge_alpha)
@@ -1928,9 +1928,9 @@ __imlib_BlendImageToImage(ImlibImage * im_src, ImlibImage * im_dst,
/* setup h */
h = dh;
- if (!IM_FLAG_ISSET(im_dst, F_HAS_ALPHA))
+ if (!im_dst->has_alpha)
merge_alpha = 0;
- if (!IM_FLAG_ISSET(im_src, F_HAS_ALPHA))
+ if (!im_src->has_alpha)
{
rgb_src = 1;
if (merge_alpha)
@@ -1946,7 +1946,7 @@ __imlib_BlendImageToImage(ImlibImage * im_src, ImlibImage * im_dst,
/* scale the imagedata for this LINESIZE lines chunk of image */
if (aa)
{
- if (IM_FLAG_ISSET(im_src, F_HAS_ALPHA))
+ if (im_src->has_alpha)
__imlib_ScaleAARGBA(scaleinfo, buf, dxx, dyy + y,
0, 0, dw, hh, dw, im_src->w);
else
diff --git a/src/lib/colormod.c b/src/lib/colormod.c
index a133734..ee73636 100644
--- a/src/lib/colormod.c
+++ b/src/lib/colormod.c
@@ -79,13 +79,13 @@ __imlib_CmodReset(ImlibColorModifier * cm)
void
__imlib_DataCmodApply(uint32_t * data, int w, int h, int jump,
- ImlibImageFlags * fl, ImlibColorModifier * cm)
+ bool has_alpha, ImlibColorModifier * cm)
{
int x, y;
uint32_t *p;
/* We might be adding alpha */
- if (fl && !(*fl & F_HAS_ALPHA))
+ if (!has_alpha)
{
p = data;
for (y = 0; y < h; y++)
diff --git a/src/lib/colormod.h b/src/lib/colormod.h
index 2fccaca..ef80737 100644
--- a/src/lib/colormod.h
+++ b/src/lib/colormod.h
@@ -48,7 +48,7 @@ void __imlib_CmodSetTables(ImlibColorModifier * cm, uint8_t * r,
uint8_t * a);
void __imlib_CmodReset(ImlibColorModifier * cm);
void __imlib_DataCmodApply(uint32_t * data, int w, int h,
- int jump, ImlibImageFlags * fl,
+ int jump, bool has_alpha,
ImlibColorModifier * cm);
void __imlib_CmodGetTables(ImlibColorModifier * cm, uint8_t * r,
diff --git a/src/lib/draw_ellipse.c b/src/lib/draw_ellipse.c
index 6844535..df6324c 100644
--- a/src/lib/draw_ellipse.c
+++ b/src/lib/draw_ellipse.c
@@ -729,17 +729,17 @@ __imlib_Ellipse_DrawToImage(int xc, int yc, int a, int b, uint32_t color,
if (w <= 0 || h <= 0)
return;
- if (blend && IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (blend && im->has_alpha)
__imlib_build_pow_lut();
if (anti_alias)
__imlib_Ellipse_DrawToData_AA(xc, yc, a, b, color,
im->data, im->w, clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ op, im->has_alpha, blend);
else
__imlib_Ellipse_DrawToData(xc, yc, a, b, color,
im->data, im->w, clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ op, im->has_alpha, blend);
}
void
@@ -797,15 +797,15 @@ __imlib_Ellipse_FillToImage(int xc, int yc, int a, int b, uint32_t color,
if (w <= 0 || h <= 0)
return;
- if (blend && IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (blend && im->has_alpha)
__imlib_build_pow_lut();
if (anti_alias)
__imlib_Ellipse_FillToData_AA(xc, yc, a, b, color,
im->data, im->w, clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ op, im->has_alpha, blend);
else
__imlib_Ellipse_FillToData(xc, yc, a, b, color,
im->data, im->w, clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ op, im->has_alpha, blend);
}
diff --git a/src/lib/draw_line.c b/src/lib/draw_line.c
index 1fe97c7..7122914 100644
--- a/src/lib/draw_line.c
+++ b/src/lib/draw_line.c
@@ -43,11 +43,10 @@ __imlib_Point_DrawToImage(int x, int y, uint32_t color,
if (A_VAL(&color) == 0xff)
blend = 0;
- if (blend && IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (blend && im->has_alpha)
__imlib_build_pow_lut();
- pfunc = __imlib_GetPointDrawFunction(op, IM_FLAG_ISSET(im, F_HAS_ALPHA),
- blend);
+ pfunc = __imlib_GetPointDrawFunction(op, im->has_alpha, blend);
if (pfunc)
pfunc(color, im->data + (im->w * y) + x);
if (make_updates)
@@ -696,20 +695,19 @@ __imlib_Line_DrawToImage(int x0, int y0, int x1, int y1, uint32_t color,
if ((y0 >= (cly + clh)) && (y1 >= (cly + clh)))
return NULL;
- if (blend && IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (blend && im->has_alpha)
__imlib_build_pow_lut();
if (anti_alias)
drew = __imlib_Line_DrawToData_AA(x0, y0, x1, y1, color,
im->data, im->w, clx, cly, clw, clh,
&cl_x0, &cl_y0, &cl_x1, &cl_y1,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA),
- blend);
+ op, im->has_alpha, blend);
else
drew = __imlib_Line_DrawToData(x0, y0, x1, y1, color,
im->data, im->w, clx, cly, clw, clh,
&cl_x0, &cl_y0, &cl_x1, &cl_y1,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ op, im->has_alpha, blend);
if (drew && make_updates)
{
diff --git a/src/lib/draw_polygon.c b/src/lib/draw_polygon.c
index d9777a3..bba0ede 100644
--- a/src/lib/draw_polygon.c
+++ b/src/lib/draw_polygon.c
@@ -1077,19 +1077,18 @@ __imlib_Polygon_DrawToImage(ImlibPoly * poly, char close, uint32_t color,
if (clw <= 0 || clh <= 0)
return;
- if (blend && IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (blend && im->has_alpha)
__imlib_build_pow_lut();
if (anti_alias)
__imlib_Polygon_DrawToData_AA(poly, close, color,
im->data, im->w,
clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ op, im->has_alpha, blend);
else
__imlib_Polygon_DrawToData(poly, close, color,
im->data, im->w,
- clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ clx, cly, clw, clh, op, im->has_alpha, blend);
}
/** Polygon Filling **/
@@ -1833,17 +1832,16 @@ __imlib_Polygon_FillToImage(ImlibPoly * poly, uint32_t color,
if (clw <= 0 || clh <= 0)
return;
- if (blend && IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (blend && im->has_alpha)
__imlib_build_pow_lut();
if (anti_alias)
__imlib_Polygon_FillToData_AA(poly, color,
im->data, im->w,
clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ op, im->has_alpha, blend);
else
__imlib_Polygon_FillToData(poly, color,
im->data, im->w,
- clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ clx, cly, clw, clh, op, im->has_alpha, blend);
}
diff --git a/src/lib/draw_rectangle.c b/src/lib/draw_rectangle.c
index c0ca92b..82b622c 100644
--- a/src/lib/draw_rectangle.c
+++ b/src/lib/draw_rectangle.c
@@ -145,12 +145,12 @@ __imlib_Rectangle_DrawToImage(int x, int y, int w, int h, uint32_t color,
if (clw <= 0 || clh <= 0)
return;
- if (blend && IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (blend && im->has_alpha)
__imlib_build_pow_lut();
__imlib_Rectangle_DrawToData(x, y, w, h, color,
im->data, im->w, clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ op, im->has_alpha, blend);
}
void
@@ -184,10 +184,10 @@ __imlib_Rectangle_FillToImage(int x, int y, int w, int h, uint32_t color,
if (clw <= 0 || clh <= 0)
return;
- if (blend && IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (blend && im->has_alpha)
__imlib_build_pow_lut();
__imlib_Rectangle_FillToData(x, y, w, h, color,
im->data, im->w, clx, cly, clw, clh,
- op, IM_FLAG_ISSET(im, F_HAS_ALPHA), blend);
+ op, im->has_alpha, blend);
}
diff --git a/src/lib/font_draw.c b/src/lib/font_draw.c
index 17dab4a..54762bd 100644
--- a/src/lib/font_draw.c
+++ b/src/lib/font_draw.c
@@ -89,7 +89,7 @@ __imlib_render_str(ImlibImage * im, ImlibFont * fn, int drx, int dry,
free(data);
return;
}
- IM_FLAG_SET(im2, F_HAS_ALPHA);
+ im2->has_alpha = 1;
ascent = __imlib_font_max_ascent_get(fn);
@@ -125,7 +125,7 @@ __imlib_render_str(ImlibImage * im, ImlibFont * fn, int drx, int dry,
if (angle == 0.0)
{
__imlib_BlendImageToImage(im2, im, 0, 1,
- IM_FLAG_ISSET(im, F_HAS_ALPHA), 0, 0,
+ im->has_alpha, 0, 0,
im2->w, im2->h, drx, dry, im2->w, im2->h,
NULL, op, clx, cly, clw, clh);
}
@@ -148,7 +148,7 @@ __imlib_render_str(ImlibImage * im, ImlibFont * fn, int drx, int dry,
yy -= ca * im2->h;
}
__imlib_BlendImageToImageSkewed(im2, im, 1, 1,
- IM_FLAG_ISSET(im, F_HAS_ALPHA), 0,
+ im->has_alpha, 0,
0, im2->w, im2->h, xx, yy, (w * ca),
(w * sa), 0, 0, NULL, op, clx, cly, clw,
clh);
diff --git a/src/lib/grad.c b/src/lib/grad.c
index 22c1295..91bda91 100644
--- a/src/lib/grad.c
+++ b/src/lib/grad.c
@@ -342,7 +342,7 @@ _DrawGradient(ImlibImage * im, int x, int y, int w, int h,
switch (op)
{
case OP_COPY:
- if (IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (im->has_alpha)
{
__imlib_build_pow_lut();
for (yy = 0; yy < h; yy++)
diff --git a/src/lib/image.h b/src/lib/image.h
index 78872be..2e24687 100644
--- a/src/lib/image.h
+++ b/src/lib/image.h
@@ -12,15 +12,11 @@ typedef struct _imlibldctx ImlibLdCtx;
typedef void (*ImlibDataDestructorFunction)(ImlibImage * im, void *data);
typedef void *(*ImlibImageDataMemoryFunction)(void *, size_t size);
-enum _iflags {
- F_NONE = 0,
- F_HAS_ALPHA = (1 << 0),
- F_UNCACHEABLE = (1 << 1),
- F_ALWAYS_CHECK_DISK = (1 << 2),
- F_INVALID = (1 << 3),
- F_DONT_FREE_DATA = (1 << 4),
- F_FORMAT_IRRELEVANT = (1 << 5),
-};
+#define F_UNCACHEABLE (1 << 1)
+#define F_ALWAYS_CHECK_DISK (1 << 2)
+#define F_INVALID (1 << 3)
+#define F_DONT_FREE_DATA (1 << 4)
+#define F_FORMAT_IRRELEVANT (1 << 5)
/* Must match the ones in Imlib2.h.in */
#define FF_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */
@@ -49,7 +45,8 @@ struct _ImlibImage {
int w, h;
uint32_t *data;
- ImlibImageFlags flags;
+ char has_alpha;
+ char rsvd[3];
int canvas_w; /* Canvas size */
int canvas_h;
@@ -67,6 +64,7 @@ struct _ImlibImage {
char *file;
char *key;
time_t moddate;
+ unsigned int flags;
int references;
char *format;
diff --git a/src/lib/types.h b/src/lib/types.h
index 55b41ac..30be920 100644
--- a/src/lib/types.h
+++ b/src/lib/types.h
@@ -7,7 +7,6 @@
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,
diff --git a/src/lib/x11_pixmap.c b/src/lib/x11_pixmap.c
index 7ad151e..da4ac13 100644
--- a/src/lib/x11_pixmap.c
+++ b/src/lib/x11_pixmap.c
@@ -365,7 +365,7 @@ __imlib_CreatePixmapsForImage(Display * d, Drawable w, Visual * v, int depth,
}
if (m)
{
- if (IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (im->has_alpha)
mask = XCreatePixmap(d, w, dw, dh, 1);
*m = mask;
}
diff --git a/src/lib/x11_rend.c b/src/lib/x11_rend.c
index 8f86e26..7852235 100644
--- a/src/lib/x11_rend.c
+++ b/src/lib/x11_rend.c
@@ -267,8 +267,7 @@ __imlib_RenderImage(Display * d, ImlibImage * im,
ImlibMaskFunction masker = NULL;
ImlibBlendFunction blender = NULL;
- blender = __imlib_GetBlendFunction(op, 1, 0,
- !IM_FLAG_ISSET(im, F_HAS_ALPHA), NULL);
+ blender = __imlib_GetBlendFunction(op, 1, 0, !im->has_alpha, NULL);
/* dont do anything if we have a 0 widht or height image to render */
if ((dw == 0) || (dh == 0))
@@ -316,7 +315,7 @@ __imlib_RenderImage(Display * d, ImlibImage * im,
dh = abs(dh);
ct = __imlib_GetContext(d, v, cm, depth);
__imlib_RGBASetupContext(ct);
- if (blend && IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (blend && im->has_alpha)
{
back = malloc(dw * dh * sizeof(uint32_t));
if (!__imlib_GrabDrawableToRGBA
@@ -381,7 +380,7 @@ __imlib_RenderImage(Display * d, ImlibImage * im,
/* scale the imagedata for this LINESIZE lines chunk of image data */
if (antialias)
{
- if (IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (im->has_alpha)
__imlib_ScaleAARGBA(scaleinfo, buf, ((sx * dw) / sw),
((sy * dh) / sh) + y,
0, 0, dw, hh, dw, im->w);
@@ -396,7 +395,7 @@ __imlib_RenderImage(Display * d, ImlibImage * im,
jump = 0;
pointer = buf;
if (cmod)
- __imlib_DataCmodApply(buf, dw, hh, 0, NULL, cmod);
+ __imlib_DataCmodApply(buf, dw, hh, 0, true, cmod);
}
else
{
@@ -415,7 +414,7 @@ __imlib_RenderImage(Display * d, ImlibImage * im,
}
memcpy(buf, im->data + ((y + sy) * im->w),
im->w * hh * sizeof(uint32_t));
- __imlib_DataCmodApply(buf, im->w, hh, 0, NULL, cmod);
+ __imlib_DataCmodApply(buf, im->w, hh, 0, true, cmod);
pointer = buf + sx;
jump = im->w - sw;
}
diff --git a/src/modules/loaders/loader_argb.c b/src/modules/loaders/loader_argb.c
index a6ad320..7e852f6 100644
--- a/src/modules/loaders/loader_argb.c
+++ b/src/modules/loaders/loader_argb.c
@@ -74,7 +74,7 @@ load2(ImlibImage * im, int load_data)
if (!IMAGE_DIMENSIONS_OK(im->w, im->h))
goto quit;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, alpha);
+ im->has_alpha = alpha;
if (!load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
@@ -126,8 +126,7 @@ save(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity)
uint32_t *buf = (uint32_t *) malloc(im->w * 4);
#endif
- if (IM_FLAG_ISSET(im, F_HAS_ALPHA))
- alpha = 1;
+ alpha = !!im->has_alpha;
fprintf(f, "ARGB %i %i %i\n", im->w, im->h, alpha);
diff --git a/src/modules/loaders/loader_bmp.c b/src/modules/loaders/loader_bmp.c
index 25885bb..4bfdde1 100644
--- a/src/modules/loaders/loader_bmp.c
+++ b/src/modules/loaders/loader_bmp.c
@@ -257,7 +257,7 @@ load2(ImlibImage * im, int load_data)
goto quit;
}
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, amask);
+ im->has_alpha = amask;
imgsize = size - bfh_offset;
D("w=%3d h=%3d bitcount=%d comp=%d imgsize=%d\n",
@@ -686,7 +686,7 @@ load2(ImlibImage * im, int load_data)
{
pixel = *(unsigned short *)buffer_ptr;
- if (IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (im->has_alpha)
a = SCALE(a, pixel);
else
a = 0xff;
@@ -735,7 +735,7 @@ load2(ImlibImage * im, int load_data)
{
pixel = *(unsigned int *)buffer_ptr;
- if (IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (im->has_alpha)
a = SCALE(a, pixel);
else
a = 0xff;
diff --git a/src/modules/loaders/loader_ff.c b/src/modules/loaders/loader_ff.c
index 38d0e80..7b266bc 100644
--- a/src/modules/loaders/loader_ff.c
+++ b/src/modules/loaders/loader_ff.c
@@ -42,7 +42,7 @@ load2(ImlibImage * im, int load_data)
if (!IMAGE_DIMENSIONS_OK(im->w, im->h))
goto quit;
- IM_FLAG_SET(im, F_HAS_ALPHA);
+ im->has_alpha = 1;
if (!load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
diff --git a/src/modules/loaders/loader_gif.c b/src/modules/loaders/loader_gif.c
index 1c691d4..c69a263 100644
--- a/src/modules/loaders/loader_gif.c
+++ b/src/modules/loaders/loader_gif.c
@@ -246,7 +246,7 @@ load2(ImlibImage * im, int load_data)
}
}
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, transp >= 0);
+ im->has_alpha = transp >= 0;
im->frame_count = fcount;
multiframe = im->frame_count > 1;
if (multiframe)
diff --git a/src/modules/loaders/loader_heif.c b/src/modules/loaders/loader_heif.c
index e027f4d..221f558 100644
--- a/src/modules/loaders/loader_heif.c
+++ b/src/modules/loaders/loader_heif.c
@@ -79,7 +79,7 @@ load2(ImlibImage * im, int load_data)
goto quit;
img_has_alpha = heif_image_handle_has_alpha_channel(img_handle);
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, img_has_alpha);
+ im->has_alpha = img_has_alpha;
if (!load_data)
{
diff --git a/src/modules/loaders/loader_ico.c b/src/modules/loaders/loader_ico.c
index 903a6e6..7e9eff8 100644
--- a/src/modules/loaders/loader_ico.c
+++ b/src/modules/loaders/loader_ico.c
@@ -308,7 +308,7 @@ ico_load(ico_t * ico, ImlibImage * im, int load_data)
im->w = w;
im->h = h;
- IM_FLAG_SET(im, F_HAS_ALPHA);
+ im->has_alpha = 1;
if (!load_data)
return 1;
diff --git a/src/modules/loaders/loader_j2k.c b/src/modules/loaders/loader_j2k.c
index 3bfdee7..eb709ce 100644
--- a/src/modules/loaders/loader_j2k.c
+++ b/src/modules/loaders/loader_j2k.c
@@ -175,11 +175,9 @@ load2(ImlibImage * im, int load_data)
goto quit;
im->w = jimage->x1 - jimage->x0;
im->h = jimage->y1 - jimage->y0;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA,
- jimage->numcomps == 4 || jimage->numcomps == 2);
+ im->has_alpha = jimage->numcomps == 4 || jimage->numcomps == 2;
D("WxH=%dx%d alpha=%d numcomp=%d colorspace=%d\n",
- im->w, im->h, IM_FLAG_ISSET(im, F_HAS_ALPHA),
- jimage->numcomps, jimage->color_space);
+ im->w, im->h, im->has_alpha, jimage->numcomps, jimage->color_space);
for (i = 0; i < (int)jimage->numcomps; i++)
{
diff --git a/src/modules/loaders/loader_jxl.c b/src/modules/loaders/loader_jxl.c
index 22ea2f9..eb218e6 100644
--- a/src/modules/loaders/loader_jxl.c
+++ b/src/modules/loaders/loader_jxl.c
@@ -137,7 +137,7 @@ load2(ImlibImage * im, int load_data)
im->w = info.xsize;
im->h = info.ysize;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, info.alpha_bits > 0);
+ im->has_alpha = info.alpha_bits > 0;
int frame;
diff --git a/src/modules/loaders/loader_lbm.c b/src/modules/loaders/loader_lbm.c
index d632bec..b9393ed 100644
--- a/src/modules/loaders/loader_lbm.c
+++ b/src/modules/loaders/loader_lbm.c
@@ -488,13 +488,13 @@ load2(ImlibImage * im, int load_data)
ilbm.mask = ilbm.bmhd.data[9];
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, ilbm.mask || ilbm.depth == 32);
+ im->has_alpha = ilbm.mask != 0 || ilbm.depth == 32;
env = getenv("IMLIB2_LBM_NOMASK");
if (env
&& (!strcmp(env, "true") || !strcmp(env, "1") || !strcmp(env, "yes")
|| !strcmp(env, "on")))
- IM_FLAG_CLR(im, F_HAS_ALPHA);
+ im->has_alpha = 0;
if (!load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
diff --git a/src/modules/loaders/loader_png.c b/src/modules/loaders/loader_png.c
index 1b7ab3b..32216bc 100644
--- a/src/modules/loaders/loader_png.c
+++ b/src/modules/loaders/loader_png.c
@@ -153,7 +153,7 @@ info_callback(png_struct * png_ptr, png_info * info_ptr)
hasa = 1;
if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
hasa = 1;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, hasa);
+ im->has_alpha = hasa;
if (!ctx->load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
@@ -614,7 +614,7 @@ save(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity)
}
png_init_io(png_ptr, f);
- has_alpha = IM_FLAG_ISSET(im, F_HAS_ALPHA);
+ has_alpha = im->has_alpha;
if (has_alpha)
{
png_set_IHDR(png_ptr, info_ptr, im->w, im->h, 8,
diff --git a/src/modules/loaders/loader_pnm.c b/src/modules/loaders/loader_pnm.c
index 8a2009a..c48a25a 100644
--- a/src/modules/loaders/loader_pnm.c
+++ b/src/modules/loaders/loader_pnm.c
@@ -189,7 +189,7 @@ load2(ImlibImage * im, int load_data)
if (!IMAGE_DIMENSIONS_OK(w, h))
goto quit;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, p == '8');
+ im->has_alpha = p == '8';
if (!load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
@@ -490,7 +490,7 @@ save(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity)
ptr = im->data;
/* if the image has a useful alpha channel */
- if (IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (im->has_alpha)
{
fprintf(f, "P8\n" "# PNM File written by Imlib2\n" "%i %i\n" "255\n",
im->w, im->h);
diff --git a/src/modules/loaders/loader_svg.c b/src/modules/loaders/loader_svg.c
index 3696530..ecc4792 100644
--- a/src/modules/loaders/loader_svg.c
+++ b/src/modules/loaders/loader_svg.c
@@ -192,7 +192,7 @@ load2(ImlibImage * im, int load_data)
if (!IMAGE_DIMENSIONS_OK(im->w, im->h))
goto quit;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, 1);
+ im->has_alpha = 1;
if (!load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
diff --git a/src/modules/loaders/loader_tga.c b/src/modules/loaders/loader_tga.c
index 636665f..1799e08 100644
--- a/src/modules/loaders/loader_tga.c
+++ b/src/modules/loaders/loader_tga.c
@@ -187,7 +187,7 @@ load2(ImlibImage * im, int load_data)
if (!IMAGE_DIMENSIONS_OK(im->w, im->h))
goto quit;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, hasa);
+ im->has_alpha = hasa;
if (!load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
@@ -533,15 +533,15 @@ save(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity)
header.heightHi = im->h >> 8;
/* total number of bits per pixel */
- header.bpp = IM_FLAG_ISSET(im, F_HAS_ALPHA) ? 32 : 24;
+ header.bpp = im->has_alpha ? 32 : 24;
/* number of extra (alpha) bits per pixel */
- header.descriptor = IM_FLAG_ISSET(im, F_HAS_ALPHA) ? 8 : 0;
+ header.descriptor = im->has_alpha ? 8 : 0;
/* top-to-bottom storage */
header.descriptor |= TGA_DESC_VERTICAL;
/* allocate a buffer to receive the BGRA-swapped pixel values */
- buf = malloc(im->w * im->h * (IM_FLAG_ISSET(im, F_HAS_ALPHA) ? 4 : 3));
+ buf = malloc(im->w * im->h * (im->has_alpha ? 4 : 3));
if (!buf)
goto quit;
@@ -562,7 +562,7 @@ save(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity)
*bufptr++ = PIXEL_B(pixel);
*bufptr++ = PIXEL_G(pixel);
*bufptr++ = PIXEL_R(pixel);
- if (IM_FLAG_ISSET(im, F_HAS_ALPHA))
+ if (im->has_alpha)
*bufptr++ = PIXEL_A(pixel);
} /* end for (each pixel in row) */
@@ -575,7 +575,7 @@ save(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity)
fwrite(&header, sizeof(header), 1, f);
/* write the image data */
- fwrite(buf, 1, im->w * im->h * (IM_FLAG_ISSET(im, F_HAS_ALPHA) ? 4 : 3), f);
+ fwrite(buf, 1, im->w * im->h * (im->has_alpha ? 4 : 3), f);
rc = LOAD_SUCCESS;
diff --git a/src/modules/loaders/loader_tiff.c b/src/modules/loaders/loader_tiff.c
index 1a700f3..014c4cf 100644
--- a/src/modules/loaders/loader_tiff.c
+++ b/src/modules/loaders/loader_tiff.c
@@ -406,8 +406,7 @@ load2(ImlibImage * im, int load_data)
if (!IMAGE_DIMENSIONS_OK(im->w, im->h))
goto quit;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA,
- rgba_image.rgba.alpha != EXTRASAMPLE_UNSPECIFIED);
+ im->has_alpha = rgba_image.rgba.alpha != EXTRASAMPLE_UNSPECIFIED;
if (!load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
@@ -466,7 +465,7 @@ save(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity)
double alpha_factor;
int x, y;
uint8_t r, g, b, a = 0;
- int has_alpha = IM_FLAG_ISSET(im, F_HAS_ALPHA);
+ int has_alpha = im->has_alpha;
int compression_type;
int i;
ImlibImageTag *tag;
diff --git a/src/modules/loaders/loader_webp.c b/src/modules/loaders/loader_webp.c
index 31e0a24..8911598 100644
--- a/src/modules/loaders/loader_webp.c
+++ b/src/modules/loaders/loader_webp.c
@@ -76,7 +76,7 @@ load2(ImlibImage * im, int load_data)
if (!IMAGE_DIMENSIONS_OK(im->w, im->h))
goto quit;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, iter.has_alpha);
+ im->has_alpha = iter.has_alpha;
if (!load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
diff --git a/src/modules/loaders/loader_xpm.c b/src/modules/loaders/loader_xpm.c
index a2d732c..4deaca9 100644
--- a/src/modules/loaders/loader_xpm.c
+++ b/src/modules/loaders/loader_xpm.c
@@ -361,7 +361,7 @@ load2(ImlibImage * im, int load_data)
qsort(cmap, ncolors, sizeof(cmap_t), xpm_cmap_sort);
context++;
- IM_FLAG_UPDATE(im, F_HAS_ALPHA, transp >= 0);
+ im->has_alpha = transp >= 0;
if (!load_data)
QUIT_WITH_RC(LOAD_SUCCESS);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.