This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch vtorriqoi
in repository efl.
View the commit online.
commit 9375181c771317809472c60f5cd245a65e880dfc
Author: Vincent Torri <vto...@outlook.fr>
AuthorDate: Sun Sep 17 15:25:23 2023 +0200
use premultiplied colors on the EFL side
---
src/modules/evas/image_loaders/qoi/evas_image_load_qoi.c | 11 ++++++++++-
src/modules/evas/image_savers/qoi/evas_image_save_qoi.c | 6 +++---
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/modules/evas/image_loaders/qoi/evas_image_load_qoi.c b/src/modules/evas/image_loaders/qoi/evas_image_load_qoi.c
index 0cb0f24333..6f0d847429 100644
--- a/src/modules/evas/image_loaders/qoi/evas_image_load_qoi.c
+++ b/src/modules/evas/image_loaders/qoi/evas_image_load_qoi.c
@@ -262,7 +262,16 @@ evas_image_load_file_data_qoi_internal(Evas_Loader_Internal *loader EINA_UNUSED,
index[QOI_COLOR_HASH(px) % 64] = px;
}
- *iter = ((prop->alpha ? px.rgba.a : 255) << 24) | (px.rgba.r << 16) | (px.rgba.g << 8) | px.rgba.b;
+ if (prop->alpha)
+ *iter = (px.rgba.a << 24) |
+ (((px.rgba.r * px.rgba.a) / 255) << 16) |
+ (((px.rgba.g * px.rgba.a) / 255) << 8) |
+ (((px.rgba.b * px.rgba.a) / 255));
+ else
+ *iter = (255 << 24) |
+ (px.rgba.r << 16) |
+ (px.rgba.g << 8) |
+ (px.rgba.b);
}
*error = EVAS_LOAD_ERROR_NONE;
diff --git a/src/modules/evas/image_savers/qoi/evas_image_save_qoi.c b/src/modules/evas/image_savers/qoi/evas_image_save_qoi.c
index 0a31d8f621..3b5a5ae716 100644
--- a/src/modules/evas/image_savers/qoi/evas_image_save_qoi.c
+++ b/src/modules/evas/image_savers/qoi/evas_image_save_qoi.c
@@ -115,10 +115,10 @@ save_image_qoi(RGBA_Image *im, const char *file, int quality EINA_UNUSED)
iter = (unsigned char *)im->image.data;
for (px_pos = 0; px_pos < px_len; px_pos += channels, iter +=4)
{
- px.rgba.b = *(iter + 0);
- px.rgba.g = *(iter + 1);
- px.rgba.r = *(iter + 2);
px.rgba.a = *(iter + 3);
+ px.rgba.b = *(iter + 0) * 255 / px.rgba.a;
+ px.rgba.g = *(iter + 1) * 255 / px.rgba.a;
+ px.rgba.r = *(iter + 2) * 255 / px.rgba.a;
if (px.v == px_prev.v)
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.