File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
src/nanoFramework.Graphics/Graphics/Displays Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -289,15 +289,17 @@ void DisplayDriver::BitBlt(
289289
290290 g_DisplayInterface.SendCommand (1 , Memory_Write);
291291
292- uint32_t numPixels = width * height;
293292 uint32_t count = 0 ;
294293
295294 CLR_UINT8 *TransferBuffer = Attributes.TransferBuffer ;
296295 CLR_UINT32 TransferBufferSize = Attributes.TransferBufferSize ;
297296
298297 // only 18/24 bit is supported on SPI
299- for (uint32_t i = 0 ; i < numPixels; i++)
298+ for (uint32_t y = srcY; y < srcY + height; y++)
299+ for (uint32_t x = srcX; x < srcX + width; x++)
300300 {
301+ uint32_t i = y * Attributes.Width + x;
302+
301303 uint32_t element = data[i / 2 ]; // Each uint32 stores 2 pixels
302304 uint16_t color = (i % 2 == 0 ) ? (element & 0xFFFF ) : (element >> 16 );
303305
@@ -309,9 +311,9 @@ void DisplayDriver::BitBlt(
309311 g = (g << 2 ) | (g >> 4 );
310312 r = (r << 3 ) | (r >> 2 );
311313
312- TransferBuffer[count++] = b;
313- TransferBuffer[count++] = g;
314314 TransferBuffer[count++] = r;
315+ TransferBuffer[count++] = g;
316+ TransferBuffer[count++] = b;
315317
316318 // can't fit another 3 bytes
317319 if (count + 3 > TransferBufferSize - 1 )
You can’t perform that action at this time.
0 commit comments