raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7743b17dbaf310ce1b1e0753adc772ca56769fc2

commit 7743b17dbaf310ce1b1e0753adc772ca56769fc2
Author: Carsten Haitzler <[email protected]>
Date:   Wed May 4 18:12:24 2022 +0100

    evas - png loader - work around libpng arm bug where rgb > a on decode
    
    on arm when a is 0 ... per pixel rgb can be > 0 which violates premul
    rgb leading to junk rendering. this now is worked around in the png
    loader and forces rgb to 0 when a is 0 per pixel.
    
    @fix
---
 .../evas/image_loaders/png/evas_image_load_png.c   | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

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 9e5073cc5b..7180e0ce22 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
@@ -596,6 +596,17 @@ evas_image_load_file_head_with_data_png(void *loader_data,
      }
    free(pixels2);
 
+   if ((epi.hasa) && (pack_offset == sizeof(DATA32)))
+     {
+        DATA32 *dst_ptr = (DATA32 *) surface;
+        int total = w * h;
+
+        for (i = 0; i < total; i++)
+          {
+             if (A_VAL(dst_ptr) == 0) *dst_ptr = 0;
+             dst_ptr++;
+          }
+     }
    prop->info.premul = EINA_TRUE;
 
    *error = EVAS_LOAD_ERROR_NONE;
@@ -882,6 +893,17 @@ evas_image_load_file_data_png(void *loader_data,
           }
      }
 
+   if ((epi.hasa) && (pack_offset == sizeof(DATA32)))
+     {
+        DATA32 *dst_ptr = (DATA32 *) surface;
+        int total = w * h;
+
+        for (i = 0; i < total; i++)
+          {
+             if (A_VAL(dst_ptr) == 0) *dst_ptr = 0;
+             dst_ptr++;
+          }
+     }
    prop->info.premul = EINA_TRUE;
 
    *error = EVAS_LOAD_ERROR_NONE;

-- 


Reply via email to