path: root/src/modules/evas/image_loaders/png/evas_image_load_png.c
diff options
authorShinwoo Kim <>2019-08-16 16:54:50 +0900
committerHermet Park <>2019-08-16 16:55:12 +0900
commitf5aa672853d4fe70a60508e9abc796b0246915ba (patch)
tree3213c36bf6ce5c71d3d32c11e420d4842a580f01 /src/modules/evas/image_loaders/png/evas_image_load_png.c
parent289cd1f3d499f3f587bed2954dc5d878f75e0c68 (diff)
evas: fix png regression issue
Summary: The evas_image_load_file_data_png had called png_set_tRNS_to_alpha from following commit. 6988a38 evas: fix png loader to actually produce lower resolution content when asked. You could refer to following information regarding png_set_tRNS_to_alpha which is available on page The following code transforms grayscale images of less than 8 to 8 bits, changes paletted images to RGB, and adds a full alpha channel if there is transparency information in a tRNS chunk. This is most useful on grayscale images with bit depths of 2 or 4 or if there is a multiple-image viewing application that wishes to treat all images in the same way. if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr); if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr) Accidentally commit "382c580 evas: add support for .9.png file to PNG loader." adding a new feature with small code refactoring missed the line calling png_set_tRNS_to_alpha. So we got a rendering issue. It made around 75% size white rectangle using a grayscale and transparent image. I'd like to attach the image which has following type information for test purpose. $ identify -verbose ./grayscale_transparent.png | grep type -i Mime type: image/png Type: Bilevel png:IHDR.color-type-orig: 0 png:IHDR.color_type: 0 (Grayscale) Test Plan: This is the sample image file grayscale_transparent.png {F3748665} Reviewers: cedric, Hermet, jsuya Reviewed By: Hermet Subscribers: #reviewers, #committers Tags: #efl Differential Revision:
Diffstat (limited to '')
1 files changed, 8 insertions, 1 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 7b440d5089..1eb8b12dc8 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
@@ -212,7 +212,14 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader,
212 prop->info.w = (int) epi->w32; 212 prop->info.w = (int) epi->w32;
213 prop->info.h = (int) epi->h32; 213 prop->info.h = (int) epi->h32;
214 } 214 }
215 if (png_get_valid(epi->png_ptr, epi->info_ptr, PNG_INFO_tRNS)) epi->hasa = 1; 215
216 if (png_get_valid(epi->png_ptr, epi->info_ptr, PNG_INFO_tRNS))
217 {
218 /* expand transparency entry -> alpha channel if present */
219 if (!close_file) png_set_tRNS_to_alpha(epi->png_ptr);
220 epi->hasa = 1;
221 }
216 switch (epi->color_type) 223 switch (epi->color_type)
217 { 224 {