forked from old/legacy-imlib2
add loader flush call and fix gif loader to be able to load when theres no
progress set :) SVN revision: 1855
This commit is contained in:
parent
03b120d9ff
commit
79d2919f9f
|
@ -43,13 +43,13 @@ load(ImlibImage *im, progress_func *progress, char progress_granularity, char im
|
||||||
/* if immediate_load is 1, then dont delay image laoding as below, or */
|
/* if immediate_load is 1, then dont delay image laoding as below, or */
|
||||||
/* already data in this image - dont load it again */
|
/* already data in this image - dont load it again */
|
||||||
if (im->data)
|
if (im->data)
|
||||||
return 0;
|
return 0;
|
||||||
fd = open(im->file, O_RDONLY);
|
fd = open(im->file, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return 0;
|
return 0;
|
||||||
gif = DGifOpenFileHandle(fd);
|
gif = DGifOpenFileHandle(fd);
|
||||||
if (!gif)
|
if (!gif)
|
||||||
return 0;
|
return 0;
|
||||||
do {
|
do {
|
||||||
if (DGifGetRecordType(gif, &rec) == GIF_ERROR) {
|
if (DGifGetRecordType(gif, &rec) == GIF_ERROR) {
|
||||||
PrintGifError();
|
PrintGifError();
|
||||||
|
@ -118,13 +118,13 @@ load(ImlibImage *im, progress_func *progress, char progress_granularity, char im
|
||||||
/* set the format string member to the lower-case full extension */
|
/* set the format string member to the lower-case full extension */
|
||||||
/* name for the format - so example names would be: */
|
/* name for the format - so example names would be: */
|
||||||
/* "png", "jpeg", "tiff", "ppm", "pgm", "pbm", "gif", "xpm" ... */
|
/* "png", "jpeg", "tiff", "ppm", "pgm", "pbm", "gif", "xpm" ... */
|
||||||
if (!im->loader)
|
im->w = w;
|
||||||
im->format = strdup("gif");
|
im->h = h;
|
||||||
|
if (!im->format)
|
||||||
|
im->format = strdup("gif");
|
||||||
if (im->loader || immediate_load || progress) {
|
if (im->loader || immediate_load || progress) {
|
||||||
bg = gif->SBackGroundColor;
|
bg = gif->SBackGroundColor;
|
||||||
cmap = (gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap);
|
cmap = (gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap);
|
||||||
im->w = w;
|
|
||||||
im->h = h;
|
|
||||||
im->data = (DATA32 *) malloc(sizeof(DATA32) * w * h);
|
im->data = (DATA32 *) malloc(sizeof(DATA32) * w * h);
|
||||||
if (!im->data) {
|
if (!im->data) {
|
||||||
DGifCloseFile(gif);
|
DGifCloseFile(gif);
|
||||||
|
|
|
@ -98,6 +98,7 @@ int imlib_get_cache_size(void);
|
||||||
void imlib_set_cache_size(int bytes);
|
void imlib_set_cache_size(int bytes);
|
||||||
int imlib_get_color_usage(void);
|
int imlib_get_color_usage(void);
|
||||||
void imlib_set_color_usage(int max);
|
void imlib_set_color_usage(int max);
|
||||||
|
void imlib_flush_loaders(void);
|
||||||
int imlib_get_visual_depth(Display *display, Visual *visual);
|
int imlib_get_visual_depth(Display *display, Visual *visual);
|
||||||
Visual *imlib_get_best_visual(Display *display, int screen, int *depth_return);
|
Visual *imlib_get_best_visual(Display *display, int screen, int *depth_return);
|
||||||
|
|
||||||
|
|
|
@ -208,6 +208,13 @@ imlib_set_color_usage(int max)
|
||||||
_max_colors = max;
|
_max_colors = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
imlib_flush_loaders(void)
|
||||||
|
{
|
||||||
|
__imlib_RemoveAllLoaders();
|
||||||
|
LTDL_Exit();
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
imlib_get_visual_depth(Display *display, Visual *visual)
|
imlib_get_visual_depth(Display *display, Visual *visual)
|
||||||
{
|
{
|
||||||
|
|
14
src/image.c
14
src/image.c
|
@ -490,13 +490,14 @@ __imlib_CleanupImagePixmapCache(void)
|
||||||
|
|
||||||
#define LOADERS_UNINITIALISED -4444
|
#define LOADERS_UNINITIALISED -4444
|
||||||
|
|
||||||
|
static int errors = LOADERS_UNINITIALISED;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
LTDL_Init(void)
|
LTDL_Init(void)
|
||||||
{
|
{
|
||||||
static int errors = LOADERS_UNINITIALISED;
|
|
||||||
|
|
||||||
/* Do this only once! */
|
/* Do this only once! */
|
||||||
if ((errors = LOADERS_UNINITIALISED))
|
|
||||||
|
if ((errors == LOADERS_UNINITIALISED))
|
||||||
{
|
{
|
||||||
errors = lt_dlinit();
|
errors = lt_dlinit();
|
||||||
|
|
||||||
|
@ -514,6 +515,13 @@ LTDL_Init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LTDL_Exit(void)
|
||||||
|
{
|
||||||
|
errors = LOADERS_UNINITIALISED;
|
||||||
|
lt_dlexit();
|
||||||
|
}
|
||||||
|
|
||||||
/* try dlopen()ing the file if we succeed finish filling out the malloced */
|
/* try dlopen()ing the file if we succeed finish filling out the malloced */
|
||||||
/* loader struct and return it */
|
/* loader struct and return it */
|
||||||
ImlibLoader *
|
ImlibLoader *
|
||||||
|
|
Loading…
Reference in New Issue