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:
Mira Grudzinska 2021-06-22 11:35:22 +02:00 committed by Hermet Park
parent 5bbe713ca5
commit a0f28d0db4

View file

@ -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;