GFX: Add gfx_clearRows() implementation

replace/2339ff9bda06721f48a766ba7af1553fb83baf6f
Federico Amedeo Izzo 2020-11-29 08:43:58 +01:00
rodzic 5f669d1c18
commit 42ccc3ac28
2 zmienionych plików z 22 dodań i 1 usunięć

Wyświetl plik

@ -147,7 +147,18 @@ void gfx_render();
bool gfx_renderingInProgress();
/**
* Makes the screen black.
* Clears a portion of the screen content
* This results in a black screen on color displays
* And a white screen on B/W displays
* @param startRow: first row of the framebuffer section to be cleared
* @param endRow: last row of the framebuffer section to be cleared
*/
void gfx_clearRows(uint8_t startRow, uint8_t endRow);
/**
* Clears the content of the screen
* This results in a black screen on color displays
* And a white screen on B/W displays
*/
void gfx_clearScreen();

Wyświetl plik

@ -85,6 +85,16 @@ rgb565_t _true2highColor(color_t true_color)
return high_color;
}
void gfx_clearRows(uint8_t startRow, uint8_t endRow)
{
if(!initialized) return;
if(endRow < startRow) return;
uint16_t start = startRow * SCREEN_WIDTH * sizeof(rgb565_t);
uint16_t height = endRow - startRow * SCREEN_WIDTH * sizeof(rgb565_t);
// Set the specified rows to 0x00 = make the screen black
memset(buf + start, 0x00, height);
}
void gfx_clearScreen()
{
if(!initialized) return;