mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
sw_engine fill: fixing gradient calculations for 'repeat' spread value
There was a call to the ctable element from outside its boundaries, because the check was misplaced.
This commit is contained in:
parent
5bbe713ca5
commit
a0f28d0db4
1 changed files with 2 additions and 2 deletions
|
@ -171,8 +171,8 @@ static inline uint32_t _clamp(const SwFill* fill, int32_t pos)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FillSpread::Repeat: {
|
case FillSpread::Repeat: {
|
||||||
if (pos < 0) pos = GRADIENT_STOP_SIZE + pos;
|
|
||||||
pos = pos % GRADIENT_STOP_SIZE;
|
pos = pos % GRADIENT_STOP_SIZE;
|
||||||
|
if (pos < 0) pos = GRADIENT_STOP_SIZE + pos;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FillSpread::Reflect: {
|
case FillSpread::Reflect: {
|
||||||
|
@ -217,7 +217,7 @@ void fillFetchRadial(const SwFill* fill, uint32_t* dst, uint32_t y, uint32_t x,
|
||||||
auto detDelta = (rxryPlus + 1.0f) * inva;
|
auto detDelta = (rxryPlus + 1.0f) * inva;
|
||||||
auto detDelta2 = 2.0f * inva;
|
auto detDelta2 = 2.0f * inva;
|
||||||
|
|
||||||
for (uint32_t i = 0 ; i < len ; ++i) {
|
for (uint32_t i = 0 ; i < len ; ++i) {
|
||||||
*dst = _pixel(fill, sqrt(det));
|
*dst = _pixel(fill, sqrt(det));
|
||||||
++dst;
|
++dst;
|
||||||
det += detDelta;
|
det += detDelta;
|
||||||
|
|
Loading…
Add table
Reference in a new issue