summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_image_load.c
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-05-02 17:17:42 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-05-06 19:02:04 +0900
commit7d83e4204677a4501e1c7ec3ad08a2ec0d625dbc (patch)
treece3c72a9a2c1dee302ff377c19d6170c31747292 /src/lib/evas/common/evas_image_load.c
parent6f802ab2340b95d9c6422b814bc71e5707ed9353 (diff)
evas: move evas cache API outside of the image data loader API.
Diffstat (limited to 'src/lib/evas/common/evas_image_load.c')
-rw-r--r--src/lib/evas/common/evas_image_load.c46
1 files changed, 43 insertions, 3 deletions
diff --git a/src/lib/evas/common/evas_image_load.c b/src/lib/evas/common/evas_image_load.c
index bc90940694..043525d4cc 100644
--- a/src/lib/evas/common/evas_image_load.c
+++ b/src/lib/evas/common/evas_image_load.c
@@ -326,7 +326,10 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie)
326EAPI int 326EAPI int
327evas_common_load_rgba_image_data_from_file(Image_Entry *ie) 327evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
328{ 328{
329 void *pixels;
330 Eina_File *f;
329 Evas_Image_Load_Func *evas_image_load_func = NULL; 331 Evas_Image_Load_Func *evas_image_load_func = NULL;
332 Evas_Image_Property property;
330 int ret = EVAS_LOAD_ERROR_NONE; 333 int ret = EVAS_LOAD_ERROR_NONE;
331 334
332 if ((ie->flags.loaded) && (!ie->animated.animated)) return EVAS_LOAD_ERROR_GENERIC; 335 if ((ie->flags.loaded) && (!ie->animated.animated)) return EVAS_LOAD_ERROR_GENERIC;
@@ -359,15 +362,52 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
359 362
360 evas_image_load_func = ie->info.loader; 363 evas_image_load_func = ie->info.loader;
361 evas_module_use((Evas_Module*) ie->info.module); 364 evas_module_use((Evas_Module*) ie->info.module);
362 if (!evas_image_load_func->file_data(ie, ie->file, ie->key, &ret)) 365
366 f = eina_file_open(ie->file, EINA_FALSE);
367 if (!f) return EVAS_LOAD_ERROR_DOES_NOT_EXIST;
368
369 memset(&property, 0, sizeof (Evas_Image_Property));
370 if (!(evas_image_load_func->file_head(f, ie->key, &property,
371 &ie->load_opts, &ie->animated,
372 &ret) &&
373 (ret == EVAS_LOAD_ERROR_NONE)))
374 goto on_error;
375
376 ie->w = property.w;
377 ie->h = property.h;
378 ie->scale = property.scale;
379 ie->flags.alpha = property.alpha;
380 if (ie->load_opts.orientation &&
381 ie->load_opts.degree != 0)
382 ie->flags.rotated = EINA_TRUE;
383
384 evas_cache_image_surface_alloc(ie, ie->w, ie->h);
385
386 pixels = evas_cache_image_pixels(ie);
387 if (!pixels)
363 { 388 {
364 return ret; 389 ret = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
390 goto on_error;
365 } 391 }
366 392
393 evas_image_load_func->file_data(f, ie->key,
394 &property,
395 &ie->load_opts,
396 &ie->animated,
397 pixels,
398 &ret);
399
400 ie->flags.alpha_sparse = property.alpha_sparse;
401
402 if (property.premul)
403 evas_common_image_premul(ie);
367// evas_module_unref((Evas_Module*) ie->info.module); 404// evas_module_unref((Evas_Module*) ie->info.module);
368// ie->info.module = NULL; 405// ie->info.module = NULL;
369 406
370 return EVAS_LOAD_ERROR_NONE; 407 on_error:
408 eina_file_close(f);
409
410 return ret;
371} 411}
372 412
373EAPI double 413EAPI double