mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
sw_engine: Correct the color conversion condition.
The color conversion is supposed to take into account the differences between straight alpha premultiplied color and pre-multiplied alpha color. The previous logic does not perfectly cover these conditions. The problem was occured in the thorvg viewer with a jpeg bgra format.
This commit is contained in:
parent
e8fd7e2b85
commit
5ecd3fb479
1 changed files with 2 additions and 2 deletions
|
@ -2024,11 +2024,11 @@ bool rasterConvertCS(Surface* surface, ColorSpace to)
|
||||||
//TOOD: Support SIMD accelerations
|
//TOOD: Support SIMD accelerations
|
||||||
auto from = surface->cs;
|
auto from = surface->cs;
|
||||||
|
|
||||||
if ((from == ColorSpace::ABGR8888 && to == ColorSpace::ARGB8888) || (from == ColorSpace::ABGR8888S && to == ColorSpace::ARGB8888S)) {
|
if (((from == ColorSpace::ABGR8888) || (from == ColorSpace::ABGR8888S)) && ((to == ColorSpace::ARGB8888) || (to == ColorSpace::ARGB8888S))) {
|
||||||
surface->cs = to;
|
surface->cs = to;
|
||||||
return cRasterABGRtoARGB(surface);
|
return cRasterABGRtoARGB(surface);
|
||||||
}
|
}
|
||||||
if ((from == ColorSpace::ARGB8888 && to == ColorSpace::ABGR8888) || (from == ColorSpace::ARGB8888S && to == ColorSpace::ABGR8888S)) {
|
if (((from == ColorSpace::ARGB8888) || (from == ColorSpace::ARGB8888S)) && ((to == ColorSpace::ABGR8888) || (to == ColorSpace::ABGR8888S))) {
|
||||||
surface->cs = to;
|
surface->cs = to;
|
||||||
return cRasterARGBtoABGR(surface);
|
return cRasterARGBtoABGR(surface);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue