blur bugfix
turns out that fastLED 3.6.0 has an explicit uint32_t operator that returns RGBA, however 3.5.0 does not have this and the conversion returned only the "red" component".
This commit is contained in:
parent
ebb4628e66
commit
5ef7cd7bdd
@ -340,7 +340,7 @@ void Segment::blurRow(uint16_t row, fract8 blur_amount) {
|
|||||||
CRGB carryover = CRGB::Black;
|
CRGB carryover = CRGB::Black;
|
||||||
for (uint_fast16_t x = 0; x < cols; x++) {
|
for (uint_fast16_t x = 0; x < cols; x++) {
|
||||||
CRGB cur = getPixelColorXY(x, row);
|
CRGB cur = getPixelColorXY(x, row);
|
||||||
uint32_t before = uint32_t(cur); // remember color before blur
|
CRGB before = cur; // remember color before blur
|
||||||
CRGB part = cur;
|
CRGB part = cur;
|
||||||
part.nscale8(seep);
|
part.nscale8(seep);
|
||||||
cur.nscale8(keep);
|
cur.nscale8(keep);
|
||||||
@ -349,7 +349,7 @@ void Segment::blurRow(uint16_t row, fract8 blur_amount) {
|
|||||||
CRGB prev = CRGB(getPixelColorXY(x-1, row)) + part;
|
CRGB prev = CRGB(getPixelColorXY(x-1, row)) + part;
|
||||||
setPixelColorXY(x-1, row, prev);
|
setPixelColorXY(x-1, row, prev);
|
||||||
}
|
}
|
||||||
if (before != uint32_t(cur)) // optimization: only set pixel if color has changed
|
if (before != cur) // optimization: only set pixel if color has changed
|
||||||
setPixelColorXY(x, row, cur);
|
setPixelColorXY(x, row, cur);
|
||||||
carryover = part;
|
carryover = part;
|
||||||
}
|
}
|
||||||
@ -369,7 +369,7 @@ void Segment::blurCol(uint16_t col, fract8 blur_amount) {
|
|||||||
for (uint_fast16_t y = 0; y < rows; y++) {
|
for (uint_fast16_t y = 0; y < rows; y++) {
|
||||||
CRGB cur = getPixelColorXY(col, y);
|
CRGB cur = getPixelColorXY(col, y);
|
||||||
CRGB part = cur;
|
CRGB part = cur;
|
||||||
uint32_t before = uint32_t(cur); // remember color before blur
|
CRGB before = cur; // remember color before blur
|
||||||
part.nscale8(seep);
|
part.nscale8(seep);
|
||||||
cur.nscale8(keep);
|
cur.nscale8(keep);
|
||||||
cur += carryover;
|
cur += carryover;
|
||||||
@ -377,7 +377,7 @@ void Segment::blurCol(uint16_t col, fract8 blur_amount) {
|
|||||||
CRGB prev = CRGB(getPixelColorXY(col, y-1)) + part;
|
CRGB prev = CRGB(getPixelColorXY(col, y-1)) + part;
|
||||||
setPixelColorXY(col, y-1, prev);
|
setPixelColorXY(col, y-1, prev);
|
||||||
}
|
}
|
||||||
if (before != uint32_t(cur)) // optimization: only set pixel if color has changed
|
if (before != cur) // optimization: only set pixel if color has changed
|
||||||
setPixelColorXY(col, y, cur);
|
setPixelColorXY(col, y, cur);
|
||||||
carryover = part;
|
carryover = part;
|
||||||
}
|
}
|
||||||
|
@ -911,7 +911,7 @@ void Segment::blur(uint8_t blur_amount)
|
|||||||
{
|
{
|
||||||
CRGB cur = CRGB(getPixelColor(i));
|
CRGB cur = CRGB(getPixelColor(i));
|
||||||
CRGB part = cur;
|
CRGB part = cur;
|
||||||
uint32_t before = uint32_t(cur); // remember color before blur
|
CRGB before = cur; // remember color before blur
|
||||||
part.nscale8(seep);
|
part.nscale8(seep);
|
||||||
cur.nscale8(keep);
|
cur.nscale8(keep);
|
||||||
cur += carryover;
|
cur += carryover;
|
||||||
@ -922,7 +922,7 @@ void Segment::blur(uint8_t blur_amount)
|
|||||||
uint8_t b = B(c);
|
uint8_t b = B(c);
|
||||||
setPixelColor((uint16_t)(i-1), qadd8(r, part.red), qadd8(g, part.green), qadd8(b, part.blue));
|
setPixelColor((uint16_t)(i-1), qadd8(r, part.red), qadd8(g, part.green), qadd8(b, part.blue));
|
||||||
}
|
}
|
||||||
if (before != uint32_t(cur)) // optimization: only set pixel if color has changed
|
if (before != cur) // optimization: only set pixel if color has changed
|
||||||
setPixelColor((uint16_t)i,cur.red, cur.green, cur.blue);
|
setPixelColor((uint16_t)i,cur.red, cur.green, cur.blue);
|
||||||
carryover = part;
|
carryover = part;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user