From 5f159ae624bbe4211c50e1122756c341c437656a Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Thu, 7 May 2020 08:56:40 +0100 Subject: [PATCH] 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 --- .../evas/image_loaders/png/evas_image_load_png.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/evas/image_loaders/png/evas_image_load_png.c b/src/modules/evas/image_loaders/png/evas_image_load_png.c index 5b8d33f8d3..686cc2966c 100644 --- a/src/modules/evas/image_loaders/png/evas_image_load_png.c +++ b/src/modules/evas/image_loaders/png/evas_image_load_png.c @@ -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,