forked from old/legacy-imlib2
api.c: Cosmetics
- Change 'filename' to 'file' for consistency - Drop some unnecessary casts
This commit is contained in:
parent
7b671819f6
commit
af1018bd65
|
@ -188,7 +188,7 @@ imlib_context_new(void)
|
||||||
|
|
||||||
*context = ctx_default;
|
*context = ctx_default;
|
||||||
|
|
||||||
return (Imlib_Context) context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* frees the given context if it doesn't have any reference anymore. The
|
/* frees the given context if it doesn't have any reference anymore. The
|
||||||
|
@ -248,7 +248,7 @@ imlib_context_pop(void)
|
||||||
EAPI Imlib_Context
|
EAPI Imlib_Context
|
||||||
imlib_context_get(void)
|
imlib_context_get(void)
|
||||||
{
|
{
|
||||||
return (Imlib_Context) ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* context setting/getting functions */
|
/* context setting/getting functions */
|
||||||
|
@ -736,7 +736,7 @@ imlib_load_image(const char *file)
|
||||||
|
|
||||||
im = __imlib_LoadImage(file, &ila);
|
im = __imlib_LoadImage(file, &ila);
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -749,7 +749,7 @@ imlib_load_image_immediately(const char *file)
|
||||||
|
|
||||||
im = __imlib_LoadImage(file, &ila);
|
im = __imlib_LoadImage(file, &ila);
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -762,7 +762,7 @@ imlib_load_image_without_cache(const char *file)
|
||||||
|
|
||||||
im = __imlib_LoadImage(file, &ila);
|
im = __imlib_LoadImage(file, &ila);
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -775,7 +775,7 @@ imlib_load_image_immediately_without_cache(const char *file)
|
||||||
|
|
||||||
im = __imlib_LoadImage(file, &ila);
|
im = __imlib_LoadImage(file, &ila);
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -798,7 +798,7 @@ imlib_load_image_fd(int fd, const char *file)
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -820,14 +820,14 @@ imlib_load_image_with_error_return(const char *file,
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
imlib_load_image_frame(const char *file, int frame)
|
imlib_load_image_frame(const char *file, int frame)
|
||||||
{
|
{
|
||||||
ImlibImage *im;
|
Imlib_Image im;
|
||||||
ImlibLoadArgs ila = { ILA0(ctx, 1, 0),.frame = frame };
|
ImlibLoadArgs ila = { ILA0(ctx, 1, 0),.frame = frame };
|
||||||
|
|
||||||
CHECK_PARAM_POINTER_RETURN("file", file, NULL);
|
CHECK_PARAM_POINTER_RETURN("file", file, NULL);
|
||||||
|
|
||||||
im = __imlib_LoadImage(file, &ila);
|
im = __imlib_LoadImage(file, &ila);
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -898,7 +898,7 @@ imlib_image_get_filename(void)
|
||||||
CHECK_PARAM_POINTER_RETURN("image", ctx->image, 0);
|
CHECK_PARAM_POINTER_RETURN("image", ctx->image, 0);
|
||||||
CAST_IMAGE(im, ctx->image);
|
CAST_IMAGE(im, ctx->image);
|
||||||
/* strdup() the returned value if you want to alter it! */
|
/* strdup() the returned value if you want to alter it! */
|
||||||
return (const char *)(im->file);
|
return im->file;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI DATA32 *
|
EAPI DATA32 *
|
||||||
|
@ -1194,7 +1194,7 @@ imlib_create_image(int width, int height)
|
||||||
return NULL;
|
return NULL;
|
||||||
data = malloc(width * height * sizeof(DATA32));
|
data = malloc(width * height * sizeof(DATA32));
|
||||||
if (data)
|
if (data)
|
||||||
return (Imlib_Image) __imlib_CreateImage(width, height, data);
|
return __imlib_CreateImage(width, height, data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1209,7 +1209,7 @@ imlib_create_image_using_data(int width, int height, DATA32 * data)
|
||||||
im = __imlib_CreateImage(width, height, data);
|
im = __imlib_CreateImage(width, height, data);
|
||||||
if (im)
|
if (im)
|
||||||
IM_FLAG_SET(im, F_DONT_FREE_DATA);
|
IM_FLAG_SET(im, F_DONT_FREE_DATA);
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -1225,7 +1225,7 @@ EAPI Imlib_Image
|
||||||
if (im)
|
if (im)
|
||||||
im->data_memory_func = func;
|
im->data_memory_func = func;
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -1243,7 +1243,7 @@ imlib_create_image_using_copied_data(int width, int height, DATA32 * data)
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
memcpy(im->data, data, width * height * sizeof(DATA32));
|
memcpy(im->data, data, width * height * sizeof(DATA32));
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
__imlib_FreeImage(im);
|
__imlib_FreeImage(im);
|
||||||
|
@ -1281,7 +1281,7 @@ imlib_create_image_from_drawable(Pixmap mask, int x, int y, int width,
|
||||||
im = NULL;
|
im = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -1297,7 +1297,7 @@ imlib_create_image_from_ximage(XImage * image, XImage * mask, int x, int y,
|
||||||
__imlib_GrabXImageToRGBA(im->data, 0, 0, width, height,
|
__imlib_GrabXImageToRGBA(im->data, 0, 0, width, height,
|
||||||
ctx->display, image, mask, ctx->visual,
|
ctx->display, image, mask, ctx->visual,
|
||||||
ctx->depth, x, y, width, height, need_to_grab_x);
|
ctx->depth, x, y, width, height, need_to_grab_x);
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -1332,7 +1332,7 @@ imlib_create_scaled_image_from_drawable(Pixmap mask, int source_x,
|
||||||
|
|
||||||
IM_FLAG_UPDATE(im, F_HAS_ALPHA, domask);
|
IM_FLAG_UPDATE(im, F_HAS_ALPHA, domask);
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI char
|
EAPI char
|
||||||
|
@ -1435,7 +1435,7 @@ imlib_clone_image(void)
|
||||||
im->format = strdup(im_old->format);
|
im->format = strdup(im_old->format);
|
||||||
if (im_old->file)
|
if (im_old->file)
|
||||||
im->file = strdup(im_old->file);
|
im->file = strdup(im_old->file);
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -1473,7 +1473,7 @@ imlib_create_cropped_image(int x, int y, int width, int height)
|
||||||
ctx->cliprect.x, ctx->cliprect.y,
|
ctx->cliprect.x, ctx->cliprect.y,
|
||||||
ctx->cliprect.w, ctx->cliprect.h);
|
ctx->cliprect.w, ctx->cliprect.h);
|
||||||
}
|
}
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Image
|
EAPI Imlib_Image
|
||||||
|
@ -1517,7 +1517,7 @@ imlib_create_cropped_scaled_image(int source_x, int source_y,
|
||||||
ctx->cliprect.x, ctx->cliprect.y,
|
ctx->cliprect.x, ctx->cliprect.y,
|
||||||
ctx->cliprect.w, ctx->cliprect.h);
|
ctx->cliprect.w, ctx->cliprect.h);
|
||||||
}
|
}
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Updates
|
EAPI Imlib_Updates
|
||||||
|
@ -1526,7 +1526,7 @@ imlib_updates_clone(Imlib_Updates updates)
|
||||||
ImlibUpdate *u;
|
ImlibUpdate *u;
|
||||||
|
|
||||||
u = (ImlibUpdate *) updates;
|
u = (ImlibUpdate *) updates;
|
||||||
return (Imlib_Updates) __imlib_DupUpdates(u);
|
return __imlib_DupUpdates(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Updates
|
EAPI Imlib_Updates
|
||||||
|
@ -1535,7 +1535,7 @@ imlib_update_append_rect(Imlib_Updates updates, int x, int y, int w, int h)
|
||||||
ImlibUpdate *u;
|
ImlibUpdate *u;
|
||||||
|
|
||||||
u = (ImlibUpdate *) updates;
|
u = (ImlibUpdate *) updates;
|
||||||
return (Imlib_Updates) __imlib_AddUpdate(u, x, y, w, h);
|
return __imlib_AddUpdate(u, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Updates
|
EAPI Imlib_Updates
|
||||||
|
@ -1544,7 +1544,7 @@ imlib_updates_merge(Imlib_Updates updates, int w, int h)
|
||||||
ImlibUpdate *u;
|
ImlibUpdate *u;
|
||||||
|
|
||||||
u = (ImlibUpdate *) updates;
|
u = (ImlibUpdate *) updates;
|
||||||
return (Imlib_Updates) __imlib_MergeUpdate(u, w, h, 0);
|
return __imlib_MergeUpdate(u, w, h, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Updates
|
EAPI Imlib_Updates
|
||||||
|
@ -1553,7 +1553,7 @@ imlib_updates_merge_for_rendering(Imlib_Updates updates, int w, int h)
|
||||||
ImlibUpdate *u;
|
ImlibUpdate *u;
|
||||||
|
|
||||||
u = (ImlibUpdate *) updates;
|
u = (ImlibUpdate *) updates;
|
||||||
return (Imlib_Updates) __imlib_MergeUpdate(u, w, h, 3);
|
return __imlib_MergeUpdate(u, w, h, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -1571,7 +1571,7 @@ imlib_updates_get_next(Imlib_Updates updates)
|
||||||
ImlibUpdate *u;
|
ImlibUpdate *u;
|
||||||
|
|
||||||
u = (ImlibUpdate *) updates;
|
u = (ImlibUpdate *) updates;
|
||||||
return (Imlib_Updates) (u->next);
|
return u->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -1640,7 +1640,7 @@ imlib_render_image_updates_on_drawable(Imlib_Updates updates, int x, int y)
|
||||||
EAPI Imlib_Updates
|
EAPI Imlib_Updates
|
||||||
imlib_updates_init(void)
|
imlib_updates_init(void)
|
||||||
{
|
{
|
||||||
return (Imlib_Updates) NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Updates
|
EAPI Imlib_Updates
|
||||||
|
@ -1652,9 +1652,9 @@ imlib_updates_append_updates(Imlib_Updates updates,
|
||||||
u = (ImlibUpdate *) updates;
|
u = (ImlibUpdate *) updates;
|
||||||
uu = (ImlibUpdate *) appended_updates;
|
uu = (ImlibUpdate *) appended_updates;
|
||||||
if (!uu)
|
if (!uu)
|
||||||
return (Imlib_Updates) u;
|
return u;
|
||||||
if (!u)
|
if (!u)
|
||||||
return (Imlib_Updates) uu;
|
return uu;
|
||||||
while (u)
|
while (u)
|
||||||
{
|
{
|
||||||
if (!(u->next))
|
if (!(u->next))
|
||||||
|
@ -1664,7 +1664,7 @@ imlib_updates_append_updates(Imlib_Updates updates,
|
||||||
}
|
}
|
||||||
u = u->next;
|
u = u->next;
|
||||||
}
|
}
|
||||||
return (Imlib_Updates) u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -2266,7 +2266,7 @@ imlib_get_maximum_font_descent(void)
|
||||||
EAPI Imlib_Color_Modifier
|
EAPI Imlib_Color_Modifier
|
||||||
imlib_create_color_modifier(void)
|
imlib_create_color_modifier(void)
|
||||||
{
|
{
|
||||||
return (Imlib_Color_Modifier) __imlib_CreateCmod();
|
return __imlib_CreateCmod();
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -2389,13 +2389,12 @@ imlib_image_draw_pixel(int x, int y, char make_updates)
|
||||||
if (__imlib_LoadImageData(im))
|
if (__imlib_LoadImageData(im))
|
||||||
return NULL;
|
return NULL;
|
||||||
__imlib_DirtyImage(im);
|
__imlib_DirtyImage(im);
|
||||||
return (Imlib_Updates) __imlib_Point_DrawToImage(x, y, ctx->pixel, im,
|
return __imlib_Point_DrawToImage(x, y, ctx->pixel, im,
|
||||||
ctx->cliprect.x,
|
ctx->cliprect.x,
|
||||||
ctx->cliprect.y,
|
ctx->cliprect.y,
|
||||||
ctx->cliprect.w,
|
ctx->cliprect.w,
|
||||||
ctx->cliprect.h,
|
ctx->cliprect.h,
|
||||||
ctx->operation, ctx->blend,
|
ctx->operation, ctx->blend, make_updates);
|
||||||
make_updates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Imlib_Updates
|
EAPI Imlib_Updates
|
||||||
|
@ -2408,14 +2407,13 @@ imlib_image_draw_line(int x1, int y1, int x2, int y2, char make_updates)
|
||||||
if (__imlib_LoadImageData(im))
|
if (__imlib_LoadImageData(im))
|
||||||
return NULL;
|
return NULL;
|
||||||
__imlib_DirtyImage(im);
|
__imlib_DirtyImage(im);
|
||||||
return (Imlib_Updates) __imlib_Line_DrawToImage(x1, y1, x2, y2, ctx->pixel,
|
return __imlib_Line_DrawToImage(x1, y1, x2, y2, ctx->pixel,
|
||||||
im, ctx->cliprect.x,
|
im, ctx->cliprect.x,
|
||||||
ctx->cliprect.y,
|
ctx->cliprect.y,
|
||||||
ctx->cliprect.w,
|
ctx->cliprect.w,
|
||||||
ctx->cliprect.h,
|
ctx->cliprect.h,
|
||||||
ctx->operation, ctx->blend,
|
ctx->operation, ctx->blend,
|
||||||
ctx->anti_alias,
|
ctx->anti_alias, make_updates);
|
||||||
make_updates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -2542,7 +2540,7 @@ imlib_image_copy_rect(int x, int y, int width, int height, int new_x, int new_y)
|
||||||
EAPI Imlib_Color_Range
|
EAPI Imlib_Color_Range
|
||||||
imlib_create_color_range(void)
|
imlib_create_color_range(void)
|
||||||
{
|
{
|
||||||
return (Imlib_Color_Range) __imlib_CreateRange();
|
return __imlib_CreateRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -2779,37 +2777,37 @@ imlib_image_remove_and_free_attached_data_value(const char *key)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
imlib_save_image(const char *filename)
|
imlib_save_image(const char *file)
|
||||||
{
|
{
|
||||||
ImlibImage *im;
|
ImlibImage *im;
|
||||||
|
|
||||||
CHECK_PARAM_POINTER("image", ctx->image);
|
CHECK_PARAM_POINTER("image", ctx->image);
|
||||||
CHECK_PARAM_POINTER("filename", filename);
|
CHECK_PARAM_POINTER("file", file);
|
||||||
CAST_IMAGE(im, ctx->image);
|
CAST_IMAGE(im, ctx->image);
|
||||||
|
|
||||||
if (__imlib_LoadImageData(im))
|
if (__imlib_LoadImageData(im))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
__imlib_SaveImage(im, filename, (ImlibProgressFunction) ctx->progress_func,
|
__imlib_SaveImage(im, file, (ImlibProgressFunction) ctx->progress_func,
|
||||||
ctx->progress_granularity, NULL);
|
ctx->progress_granularity, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
imlib_save_image_with_error_return(const char *filename,
|
imlib_save_image_with_error_return(const char *file,
|
||||||
Imlib_Load_Error * error_return)
|
Imlib_Load_Error * error_return)
|
||||||
{
|
{
|
||||||
ImlibImage *im;
|
ImlibImage *im;
|
||||||
int er;
|
int er;
|
||||||
|
|
||||||
CHECK_PARAM_POINTER("image", ctx->image);
|
CHECK_PARAM_POINTER("image", ctx->image);
|
||||||
CHECK_PARAM_POINTER("filename", filename);
|
CHECK_PARAM_POINTER("file", file);
|
||||||
CHECK_PARAM_POINTER("error_return", error_return);
|
CHECK_PARAM_POINTER("error_return", error_return);
|
||||||
CAST_IMAGE(im, ctx->image);
|
CAST_IMAGE(im, ctx->image);
|
||||||
|
|
||||||
if (__imlib_LoadImageData(im))
|
if (__imlib_LoadImageData(im))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
__imlib_SaveImage(im, filename, (ImlibProgressFunction) ctx->progress_func,
|
__imlib_SaveImage(im, file, (ImlibProgressFunction) ctx->progress_func,
|
||||||
ctx->progress_granularity, &er);
|
ctx->progress_granularity, &er);
|
||||||
*error_return = er;
|
*error_return = er;
|
||||||
}
|
}
|
||||||
|
@ -2860,7 +2858,7 @@ imlib_create_rotated_image(double angle)
|
||||||
}
|
}
|
||||||
IM_FLAG_SET(im, F_HAS_ALPHA);
|
IM_FLAG_SET(im, F_HAS_ALPHA);
|
||||||
|
|
||||||
return (Imlib_Image) im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -3043,7 +3041,7 @@ imlib_image_filter(void)
|
||||||
EAPI Imlib_Filter
|
EAPI Imlib_Filter
|
||||||
imlib_create_filter(int initsize)
|
imlib_create_filter(int initsize)
|
||||||
{
|
{
|
||||||
return (Imlib_Filter) __imlib_CreateFilter(initsize);
|
return __imlib_CreateFilter(initsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
@ -3152,7 +3150,7 @@ imlib_apply_filter(const char *script, ...)
|
||||||
EAPI ImlibPolygon
|
EAPI ImlibPolygon
|
||||||
imlib_polygon_new(void)
|
imlib_polygon_new(void)
|
||||||
{
|
{
|
||||||
return (ImlibPolygon) __imlib_polygon_new();
|
return __imlib_polygon_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
Loading…
Reference in New Issue