From ca1469d7bb40b85fe344fd0d0f606bc8ea669260 Mon Sep 17 00:00:00 2001 From: Taehyub Kim Date: Thu, 18 Jul 2019 10:49:25 +0900 Subject: [PATCH] restore colormap feature Change-Id: I0cdc79d874ebc1688795f03df6ff1753f237364b --- src/lib/evas/Evas_Loader.h | 12 ++++++++++++ src/modules/evas/image_loaders/png/evas_image_load_png.c | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/lib/evas/Evas_Loader.h b/src/lib/evas/Evas_Loader.h index 35e0e17..e77b455 100644 --- a/src/lib/evas/Evas_Loader.h +++ b/src/lib/evas/Evas_Loader.h @@ -148,6 +148,18 @@ struct _Evas_Image_Property Eina_Rectangle content; // need_data is set to True when to get accurate property, data need to be loaded Eina_Bool need_data; + + //TIZEN_ONLY(20190717): restore color map feature + struct + { + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned char alpha; + } palette[256]; + + int num_palette; + // }; typedef struct _Evas_Image_Load_Func Evas_Image_Load_Func; 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 45b6de3..f38c8ad 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 @@ -121,8 +121,11 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader, Evas_Image_Load_Opts *opts = loader->opts; Eina_File *f = loader->f; volatile Eina_Bool r = EINA_FALSE; + //TIZEN_ONLY(20190717): restore color map feature + int num_trans; png_colorp palette; png_bytep trans; + // *error = EVAS_LOAD_ERROR_NONE; @@ -227,9 +230,10 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader, case PNG_COLOR_TYPE_GRAY: if (!epi->hasa) prop->info.cspaces = cspace_grey; break; + //TIZEN_ONLY(20190717): restore color map feature case PNG_COLOR_TYPE_PALETTE: if (!opts->emile.can_load_colormap) break; - if (png_get_PLTE(png_ptr, info_ptr, &palette, &prop->num_palette) + if (png_get_PLTE(epi->png_ptr, epi->info_ptr, &palette, &prop->num_palette) != PNG_INFO_PLTE) { *error = EVAS_LOAD_ERROR_GENERIC; @@ -243,7 +247,7 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader, prop->palette[i].blue = palette[i].blue; prop->palette[i].alpha = 0xff; } - if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL) + if (png_get_tRNS(epi->png_ptr, epi->info_ptr, &trans, &num_trans, NULL) == PNG_INFO_tRNS) { for (i = 0; i < num_trans; i++) @@ -253,6 +257,7 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader, } break; + // } if (epi->hasa) prop->info.alpha = 1; -- 2.7.4