evas: use SEQUENTIAL for decoding png file

Summary:
There was a mistake caused by "2a0eeba evas: fix png regression issue".

The flag is_for_data was close_file before this commit.
_evas_image_load_file_internal_head_png closes file if it is called only for
header. So the close_file does not mean is_for_data.

This patch is changing is_for_data to is_for_head, and make
_evas_image_load_file_internal_head_png use EINA_FILE_SEQUENTIAL
for data decoding.

Reviewers: Hermet, jsuya, herb, raster

Reviewed By: raster

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11783
This commit is contained in:
Shinwoo Kim 2020-05-07 08:56:40 +01:00 committed by Hermet Park
parent 882e4cd50f
commit 5f159ae624
1 changed files with 6 additions and 6 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 is_for_data)
int *error, Eina_Bool is_for_head)
{
Evas_Image_Load_Opts *opts = loader->opts;
Eina_File *f = loader->f;
@ -125,10 +125,10 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader,
*error = EVAS_LOAD_ERROR_NONE;
epi->hasa = 0;
if (!is_for_data)
epi->map = eina_file_map_all(f, EINA_FILE_RANDOM);
else
if (!is_for_head)
epi->map = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
else
epi->map = eina_file_map_all(f, EINA_FILE_RANDOM);
if (!epi->map)
{
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
@ -219,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 (!is_for_data) png_set_tRNS_to_alpha(epi->png_ptr);
if (!is_for_head) png_set_tRNS_to_alpha(epi->png_ptr);
epi->hasa = 1;
}
@ -248,7 +248,7 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader,
r = EINA_TRUE;
if (!is_for_data) return r;
if (!is_for_head) return r;
close_file:
if (epi->png_ptr) png_destroy_read_struct(&epi->png_ptr,