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 http://www.libpng.org/pub/png/libpng-manual.txt

   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: https://phab.enlightenment.org/D9580
This commit is contained in:
Shinwoo Kim 2019-08-16 16:54:50 +09:00 committed by Hermet Park
parent 289cd1f3d4
commit f5aa672853
1 changed files with 8 additions and 1 deletions

View File

@ -212,7 +212,14 @@ _evas_image_load_file_internal_head_png(Evas_Loader_Internal *loader,
prop->info.w = (int) epi->w32;
prop->info.h = (int) epi->h32;
}
if (png_get_valid(epi->png_ptr, epi->info_ptr, PNG_INFO_tRNS)) epi->hasa = 1;
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);
epi->hasa = 1;
}
switch (epi->color_type)
{
case PNG_COLOR_TYPE_RGB_ALPHA: