sw_engine: corrected the rle cell building

Properly build the cell cover value
when a new cell value is just overlapped.

This fixes certain weird visual artifacts at a corner case.

issue: https://github.com/thorvg/thorvg/issues/2929
This commit is contained in:
Hermet Park 2025-01-02 17:40:29 +09:00 committed by Hermet Park
parent 47524300bb
commit 2fb925a2d7

View file

@ -451,17 +451,17 @@ static bool _setCell(RleWorker& rw, SwPoint pos)
min_ex - 1 horizontal position. */
pos -= rw.cellMin;
if (pos.x > rw.cellMax.x) pos.x = rw.cellMax.x;
//exceptions
if (pos.x < 0) pos.x = -1;
else if (pos.x > rw.cellMax.x) pos.x = rw.cellMax.x;
//Are we moving to a different cell?
if (pos != rw.cellPos) {
//Record the current one if it is valid
if (!rw.invalid && !_recordCell(rw)) return false;
}
rw.area = 0;
rw.cover = 0;
rw.area = rw.cover = 0;
rw.cellPos = pos;
}
rw.invalid = ((unsigned)pos.y >= (unsigned)rw.cellYCnt || pos.x >= rw.cellXCnt);
return true;