summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-06 09:37:40 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-06 09:38:44 +0900
commit3842e87d3a2b07698d18cf41e078298c78eeda5b (patch)
treeb827eb0afd1d248bb163d555b7b505759fcb81ab /src/lib/evas/common
parent273238d725f857f4bdb6ba63d90a3f800f6bf046 (diff)
evas image skip header - more fixes for when images fail to load
this fixes some more issues i have found in using skip header like if the file doesn't exist etc. recent feature add so not a fix.
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_image_load.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/lib/evas/common/evas_image_load.c b/src/lib/evas/common/evas_image_load.c
index c1bfde7c9b..b27bae2c00 100644
--- a/src/lib/evas/common/evas_image_load.c
+++ b/src/lib/evas/common/evas_image_load.c
@@ -383,7 +383,7 @@ end:
383 383
384 ie->info.module = em; 384 ie->info.module = em;
385 ie->info.loader = em->functions; 385 ie->info.loader = em->functions;
386 evas_module_ref(ie->info.module); 386 if (em) evas_module_ref(em);
387 return ret; 387 return ret;
388} 388}
389 389
@@ -419,7 +419,11 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
419 CRI("This function shouldn't be called anymore!"); 419 CRI("This function shouldn't be called anymore!");
420#endif 420#endif
421 421
422 if (!ie->info.module) return EVAS_LOAD_ERROR_GENERIC; 422 if (!ie->info.module)
423 {
424 ie->load_failed = 1;
425 return EVAS_LOAD_ERROR_GENERIC;
426 }
423 427
424 evas_image_load_func = ie->info.loader; 428 evas_image_load_func = ie->info.loader;
425 evas_module_use(ie->info.module); 429 evas_module_use(ie->info.module);
@@ -431,20 +435,20 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
431 if (_evas_image_file_header(em, ie, &ret)) 435 if (_evas_image_file_header(em, ie, &ret))
432 { 436 {
433 em = NULL; 437 em = NULL;
434 for (i = 0; i < sizeof(loaders_name) / sizeof (char *); i++) 438 if (!ie->load_opts.skip_head)
435 { 439 {
436 em = evas_module_find_type(EVAS_MODULE_TYPE_IMAGE_LOADER, 440 for (i = 0; i < sizeof(loaders_name) / sizeof (char *); i++)
437 loaders_name[i]);
438 if (em)
439 { 441 {
440 if (!ie->load_opts.skip_head) 442 em = evas_module_find_type
443 (EVAS_MODULE_TYPE_IMAGE_LOADER, loaders_name[i]);
444 if (em)
441 { 445 {
442 if (!_evas_image_file_header(em, ie, &ret)) 446 if (!_evas_image_file_header(em, ie, &ret))
443 goto end; 447 goto end;
444 } 448 }
449 else DBG("could not find module '%s'", loaders_name[i]);
450 em = NULL;
445 } 451 }
446 else DBG("could not find module '%s'", loaders_name[i]);
447 em = NULL;
448 } 452 }
449 } 453 }
450end: 454end:
@@ -455,7 +459,11 @@ end:
455 ie->info.module = em; 459 ie->info.module = em;
456 } 460 }
457 } 461 }
458 if ((!ie->f) || (!ie->info.module)) return EVAS_LOAD_ERROR_DOES_NOT_EXIST; 462 if ((!ie->f) || (!ie->info.module))
463 {
464 ie->load_failed = 1;
465 return EVAS_LOAD_ERROR_DOES_NOT_EXIST;
466 }
459 467
460 if ((ie->file) && (stat(ie->file, &st) == 0)) 468 if ((ie->file) && (stat(ie->file, &st) == 0))
461 _timestamp_build(&(ie->tstamp), &st); 469 _timestamp_build(&(ie->tstamp), &st);
@@ -477,7 +485,11 @@ end:
477 property.borders.b = ie->borders.b; 485 property.borders.b = ie->borders.b;
478 486
479 pixels = evas_cache_image_pixels(ie); 487 pixels = evas_cache_image_pixels(ie);
480 if (!pixels) return EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; 488 if (!pixels)
489 {
490 ie->load_failed = 1;
491 return EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
492 }
481 493
482 evas_image_load_func->file_data(ie->loader_data, &property, pixels, &ret); 494 evas_image_load_func->file_data(ie->loader_data, &property, pixels, &ret);
483 495