evas: fix png regression issue

Accidentally commit "382c580 evas: add support for .9.png file to PNG loader."
adding the 9 patch feature with small code refactoring missed a line calling
eina_file_map_all taking EINA_FILE_SEQUENTIAL for data decoding.

You can see the previous change adding the line from the following commit.

   e60baa0 evas: change mapping policy to be less agressive into loading file
           in memory.

This is a response to the request of @cedric on D9580

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9614
This commit is contained in:
Shinwoo Kim 2019-08-19 08:38:44 +00:00 committed by Cedric BAIL
parent 409c42e46b
commit 2a0eeba4e5
1 changed files with 7 additions and 4 deletions

View File

@ -116,7 +116,7 @@ static Eina_Bool
_evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader,
Evas_Image_Property *prop,
Evas_PNG_Info *epi,
int *error, Eina_Bool close_file)
int *error, Eina_Bool is_for_data)
{
Evas_Image_Load_Opts *opts = loader->opts;
Eina_File *f = loader->f;
@ -125,7 +125,10 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader,
*error = EVAS_LOAD_ERROR_NONE;
epi->hasa = 0;
epi->map = eina_file_map_all(f, EINA_FILE_RANDOM);
if (!is_for_data)
epi->map = eina_file_map_all(f, EINA_FILE_RANDOM);
else
epi->map = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
if (!epi->map)
{
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
@ -216,7 +219,7 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader,
if (png_get_valid(epi->png_ptr, epi->info_ptr, PNG_INFO_tRNS))
{
/* expand transparency entry -> alpha channel if present */
if (!close_file) png_set_tRNS_to_alpha(epi->png_ptr);
if (!is_for_data) png_set_tRNS_to_alpha(epi->png_ptr);
epi->hasa = 1;
}
@ -245,7 +248,7 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader,
r = EINA_TRUE;
if (!close_file) return r;
if (!is_for_data) return r;
close_file:
if (epi->png_ptr) png_destroy_read_struct(&epi->png_ptr,