From 2a0eeba4e5fdd0de0c46000fa783cb59f7d716e7 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Mon, 19 Aug 2019 08:38:44 +0000 Subject: [PATCH] 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 Differential Revision: https://phab.enlightenment.org/D9614 --- .../evas/image_loaders/png/evas_image_load_png.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 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 1eb8b12dc8..3af01a1a2d 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 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,