evas: now move eina_file also out of the frame_duration API.
This commit is contained in:
parent
7d83e42046
commit
6929386895
|
@ -420,7 +420,19 @@ evas_common_load_rgba_image_frame_duration_from_file(Image_Entry *ie, const int
|
||||||
evas_image_load_func = ie->info.loader;
|
evas_image_load_func = ie->info.loader;
|
||||||
evas_module_use((Evas_Module*) ie->info.module);
|
evas_module_use((Evas_Module*) ie->info.module);
|
||||||
if (evas_image_load_func->frame_duration)
|
if (evas_image_load_func->frame_duration)
|
||||||
return evas_image_load_func->frame_duration(ie, ie->file, start, frame_num);
|
{
|
||||||
|
Eina_File *f;
|
||||||
|
double r;
|
||||||
|
|
||||||
|
f = eina_file_open(ie->file, EINA_FALSE);
|
||||||
|
if (!f) return -1;
|
||||||
|
|
||||||
|
r = evas_image_load_func->frame_duration(f, &ie->animated, start, frame_num);
|
||||||
|
|
||||||
|
eina_file_close(f);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -914,7 +914,9 @@ struct _Evas_Image_Load_Func
|
||||||
Evas_Image_Animated *animated,
|
Evas_Image_Animated *animated,
|
||||||
void *pixels,
|
void *pixels,
|
||||||
int *error);
|
int *error);
|
||||||
double (*frame_duration) (Image_Entry *ie, const char *file, const int start, const int frame_num);
|
double (*frame_duration) (Eina_File *f,
|
||||||
|
Evas_Image_Animated *animated,
|
||||||
|
int start, int frame_num);
|
||||||
Eina_Bool do_region;
|
Eina_Bool do_region;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ struct _Gif_Frame
|
||||||
int bg_val;
|
int bg_val;
|
||||||
};
|
};
|
||||||
|
|
||||||
static double evas_image_load_frame_duration_gif(Image_Entry *ie, const char *file, int start_frame, int frame_num) ;
|
|
||||||
static Eina_Bool evas_image_load_specific_frame(Eina_File *f, const Evas_Image_Load_Opts *opts, Evas_Image_Property *prop, Evas_Image_Animated *animated, int frame_index, int *error);
|
static Eina_Bool evas_image_load_specific_frame(Eina_File *f, const Evas_Image_Load_Opts *opts, Evas_Image_Property *prop, Evas_Image_Animated *animated, int frame_index, int *error);
|
||||||
|
|
||||||
#define byte2_to_int(a,b) (((b)<<8)|(a))
|
#define byte2_to_int(a,b) (((b)<<8)|(a))
|
||||||
|
@ -969,10 +968,10 @@ evas_image_load_file_data_gif(Eina_File *f, const char *key EINA_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
static double
|
static double
|
||||||
evas_image_load_frame_duration_gif(Image_Entry *ie, const char *file, const int start_frame, const int frame_num)
|
evas_image_load_frame_duration_gif(Eina_File *f, Evas_Image_Animated *animated,
|
||||||
|
int start_frame, int frame_num)
|
||||||
{
|
{
|
||||||
Evas_GIF_Info egi;
|
Evas_GIF_Info egi;
|
||||||
Eina_File *f;
|
|
||||||
GifFileType *gif = NULL;
|
GifFileType *gif = NULL;
|
||||||
GifRecordType rec;
|
GifRecordType rec;
|
||||||
int current_frame = 1;
|
int current_frame = 1;
|
||||||
|
@ -980,15 +979,12 @@ evas_image_load_frame_duration_gif(Image_Entry *ie, const char *file, const int
|
||||||
double duration = -1;
|
double duration = -1;
|
||||||
int frame_count = 0;
|
int frame_count = 0;
|
||||||
|
|
||||||
frame_count = ie->animated.frame_count;
|
frame_count = animated->frame_count;
|
||||||
|
|
||||||
if (!ie->animated.animated) return -1;
|
if (!animated->animated) return -1;
|
||||||
if ((start_frame + frame_num) > frame_count) return -1;
|
if ((start_frame + frame_num) > frame_count) return -1;
|
||||||
if (frame_num < 0) return -1;
|
if (frame_num < 0) return -1;
|
||||||
|
|
||||||
f = eina_file_open(file, EINA_FALSE);
|
|
||||||
if (!f) return -1;
|
|
||||||
|
|
||||||
egi.map = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
|
egi.map = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
|
||||||
if (!egi.map) goto on_error;
|
if (!egi.map) goto on_error;
|
||||||
egi.length = eina_file_size_get(f);
|
egi.length = eina_file_size_get(f);
|
||||||
|
@ -1058,7 +1054,6 @@ evas_image_load_frame_duration_gif(Image_Entry *ie, const char *file, const int
|
||||||
on_error:
|
on_error:
|
||||||
if (gif) DGifCloseFile(gif);
|
if (gif) DGifCloseFile(gif);
|
||||||
if (egi.map) eina_file_map_free(f, egi.map);
|
if (egi.map) eina_file_map_free(f, egi.map);
|
||||||
eina_file_close(f);
|
|
||||||
return duration;
|
return duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue