@@ -296,32 +296,32 @@ void DisplayDriver::BitBlt(
296296
297297 // only 18/24 bit is supported on SPI
298298 for (uint32_t y = srcY; y < srcY + height; y++)
299- for (uint32_t x = srcX; x < srcX + width; x++)
300- {
301- uint32_t i = y * Attributes.Width + x;
302-
303- uint32_t element = data[i / 2 ]; // Each uint32 stores 2 pixels
304- uint16_t color = (i % 2 == 0 ) ? (element & 0xFFFF ) : (element >> 16 );
299+ for (uint32_t x = srcX; x < srcX + width; x++)
300+ {
301+ uint32_t i = y * Attributes.Width + x;
305302
306- uint8_t b = color & 0x1F ;
307- uint8_t g = (color >> 5 ) & 0x3F ;
308- uint8_t r = (color >> 11 ) & 0x1F ;
303+ uint32_t element = data[i / 2 ]; // Each uint32 stores 2 pixels
304+ uint16_t color = (i % 2 == 0 ) ? (element & 0xFFFF ) : (element >> 16 );
309305
310- b = (b << 3 ) | (b >> 2 ) ;
311- g = (g << 2 ) | (g >> 4 ) ;
312- r = (r << 3 ) | (r >> 2 ) ;
306+ uint8_t b = color & 0x1F ;
307+ uint8_t g = (color >> 5 ) & 0x3F ;
308+ uint8_t r = (color >> 11 ) & 0x1F ;
313309
314- TransferBuffer[count++] = r ;
315- TransferBuffer[count++] = g ;
316- TransferBuffer[count++] = b ;
310+ b = (b << 3 ) | (b >> 2 ) ;
311+ g = (g << 2 ) | (g >> 4 ) ;
312+ r = (r << 3 ) | (r >> 2 ) ;
317313
318- // can't fit another 3 bytes
319- if (count + 3 > TransferBufferSize - 1 )
320- {
321- g_DisplayInterface.SendBytes (TransferBuffer, count);
322- count = 0 ;
314+ TransferBuffer[count++] = r;
315+ TransferBuffer[count++] = g;
316+ TransferBuffer[count++] = b;
317+
318+ // can't fit another 3 bytes
319+ if (count + 3 > TransferBufferSize - 1 )
320+ {
321+ g_DisplayInterface.SendBytes (TransferBuffer, count);
322+ count = 0 ;
323+ }
323324 }
324- }
325325 g_DisplayInterface.SendBytes (TransferBuffer, count);
326326 return ;
327327}
0 commit comments