FastLED 3.9.15
Loading...
Searching...
No Matches

◆ advance()

void fl::detail::ScaledPixelIteratorBrightness::advance ( )
inlineprivate

Advance to next brightness value (or mark as end)

Definition at line 455 of file pixel_iterator.h.

455 {
456 if (!mPixels) {
457 mHasValue = false;
458 return;
459 }
460
461 if (mPixels->has(1)) {
462 #if FASTLED_HD_COLOR_MIXING
463 u8 r, g, b, brightness;
464 mPixels->loadRGBScaleAndBrightness(&r, &g, &b, &brightness);
466 #else
467 // Fallback: compute brightness from max RGB component
468 u8 r, g, b;
469 mPixels->loadAndScaleRGB(&r, &g, &b);
470 // Use sequential comparisons to avoid nested fl::max (helps AVR register allocation)
471 u8 max_rg = (r > g) ? r : g;
472 mCurrent = (max_rg > b) ? max_rg : b;
473 #endif
474 mPixels->stepDithering();
475 mPixels->advanceData();
476 mHasValue = true;
477 } else {
478 mHasValue = false;
479 }
480}
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
bool mHasValue
true if current value is valid
u8 mCurrent
Current brightness value (cached)
PixelIterator * mPixels
Underlying PixelIterator.
unsigned char u8
Definition stdint.h:131

References brightness, FL_NOEXCEPT, mCurrent, mHasValue, and mPixels.