forked from enlightenment/efl
use premultiplied colors on the EFL side
This commit is contained in:
parent
8576ac9128
commit
4b443e752f
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue