Skip to content

Commit 6c93250

Browse files
authored
small improvement
addPixelColorXY() is actually the same code as color_add()
1 parent d0f0185 commit 6c93250

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

wled00/FX_2Dfcn.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ void IRAM_ATTR_YN Segment::setPixelColorXY(int x, int y, uint32_t col) //WLEDMM:
231231
}
232232

233233
#if 0 // this is a dangerous optimization
234-
if ((i < UINT_MAX) && sameColor && (ledsrgb[i] == CRGB(col)) && (_globalLeds == nullptr)) return; // WLEDMM looks like nothing to do (but we don't trust globalleds)
234+
if ((i < UINT_MAX) && sameColor && (call > 0) && (ledsrgb[i] == CRGB(col)) && (_globalLeds == nullptr)) return; // WLEDMM looks like nothing to do (but we don't trust globalleds)
235235
#endif
236236

237237
if (reverse ) x = virtualWidth() - x - 1;
@@ -348,19 +348,7 @@ void IRAM_ATTR_YN Segment::addPixelColorXY(int x, int y, uint32_t color, bool fa
348348
if (!isActive()) return; // not active
349349
if (x >= virtualWidth() || y >= virtualHeight() || x<0 || y<0) return; // if pixel would fall out of virtual segment just exit
350350
uint32_t col = getPixelColorXY(x,y);
351-
uint8_t r = R(col);
352-
uint8_t g = G(col);
353-
uint8_t b = B(col);
354-
uint8_t w = W(col);
355-
if (fast) {
356-
r = qadd8(r, R(color));
357-
g = qadd8(g, G(color));
358-
b = qadd8(b, B(color));
359-
w = qadd8(w, W(color));
360-
col = RGBW32(r,g,b,w);
361-
} else {
362-
col = color_add(col, color);
363-
}
351+
col = color_add(col, color, fast);
364352
setPixelColorXY(x, y, col);
365353
}
366354

0 commit comments

Comments
 (0)