optimized color565to888()

remove expensive multiplication
This commit is contained in:
beta-tester 2023-08-08 23:01:54 +02:00 committed by GitHub
parent 3d7c2dfa4f
commit 0429850835
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -880,9 +880,12 @@ private:
*/ */
inline void MatrixPanel_I2S_DMA::color565to888(const uint16_t color, uint8_t &r, uint8_t &g, uint8_t &b) inline void MatrixPanel_I2S_DMA::color565to888(const uint16_t color, uint8_t &r, uint8_t &g, uint8_t &b)
{ {
r = ((((color >> 11) & 0x1F) * 527) + 23) >> 6; r = (color >> 8) & 0xf8;
g = ((((color >> 5) & 0x3F) * 259) + 33) >> 6; g = (color >> 3) & 0xfc;
b = (((color & 0x1F) * 527) + 23) >> 6; b = (color << 3) & 0xf8;
r |= r >> 5;
g |= g >> 6;
b |= b >> 5;
} }
inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, uint16_t color) // adafruit virtual void override inline void MatrixPanel_I2S_DMA::drawPixel(int16_t x, int16_t y, uint16_t color) // adafruit virtual void override