Skip to content

Commit

Permalink
evas - png loader - work around libpng arm bug where rgb > a on decode
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rastermann committed May 4, 2022
1 parent 9490cf8 commit 7743b17
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/modules/evas/image_loaders/png/evas_image_load_png.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7743b17

Please sign in to comment.