Skip to content

Commit

Permalink
Code style fixes
Browse files Browse the repository at this point in the history
Automated fixes for code style.
  • Loading branch information
nfbot committed Jul 4, 2024
1 parent adac5aa commit 0bae92b
Showing 1 changed file with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,32 +296,32 @@ void DisplayDriver::BitBlt(

// only 18/24 bit is supported on SPI
for (uint32_t y = srcY; y < srcY + height; y++)
for (uint32_t x = srcX; x < srcX + width; x++)
{
uint32_t i = y * Attributes.Width + x;

uint32_t element = data[i / 2]; // Each uint32 stores 2 pixels
uint16_t color = (i % 2 == 0) ? (element & 0xFFFF) : (element >> 16);
for (uint32_t x = srcX; x < srcX + width; x++)
{
uint32_t i = y * Attributes.Width + x;

uint8_t b = color & 0x1F;
uint8_t g = (color >> 5) & 0x3F;
uint8_t r = (color >> 11) & 0x1F;
uint32_t element = data[i / 2]; // Each uint32 stores 2 pixels
uint16_t color = (i % 2 == 0) ? (element & 0xFFFF) : (element >> 16);

b = (b << 3) | (b >> 2);
g = (g << 2) | (g >> 4);
r = (r << 3) | (r >> 2);
uint8_t b = color & 0x1F;
uint8_t g = (color >> 5) & 0x3F;
uint8_t r = (color >> 11) & 0x1F;

TransferBuffer[count++] = r;
TransferBuffer[count++] = g;
TransferBuffer[count++] = b;
b = (b << 3) | (b >> 2);
g = (g << 2) | (g >> 4);
r = (r << 3) | (r >> 2);

// can't fit another 3 bytes
if (count + 3 > TransferBufferSize - 1)
{
g_DisplayInterface.SendBytes(TransferBuffer, count);
count = 0;
TransferBuffer[count++] = r;
TransferBuffer[count++] = g;
TransferBuffer[count++] = b;

// can't fit another 3 bytes
if (count + 3 > TransferBufferSize - 1)
{
g_DisplayInterface.SendBytes(TransferBuffer, count);
count = 0;
}
}
}
g_DisplayInterface.SendBytes(TransferBuffer, count);
return;
}
Expand Down

0 comments on commit 0bae92b

Please sign in to comment.