diff options
Diffstat (limited to 'src/Components')
-rw-r--r-- | src/Components/Gfx/Gfx.cpp | 14 | ||||
-rw-r--r-- | src/Components/Gfx/Gfx.h | 4 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/Components/Gfx/Gfx.cpp b/src/Components/Gfx/Gfx.cpp index ed323bc0..3c5dbfb7 100644 --- a/src/Components/Gfx/Gfx.cpp +++ b/src/Components/Gfx/Gfx.cpp @@ -43,6 +43,20 @@ void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t col WaitTransfertFinished(); } +void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b) { + state.remainingIterations = h; + state.currentIteration = 0; + state.busy = true; + state.action = Action::FillRectangle; + state.color = 0x00; + state.taskToNotify = xTaskGetCurrentTaskHandle(); + + lcd.BeginDrawBuffer(x, y, w, h); + lcd.NextDrawBuffer(reinterpret_cast<const uint8_t *>(b), width * 2); + + WaitTransfertFinished(); +} + void Gfx::DrawString(uint8_t x, uint8_t y, uint16_t color, const char *text, const FONT_INFO *p_font, bool wrap) { if (y > (height - p_font->height)) { // Not enough space to write even single char. diff --git a/src/Components/Gfx/Gfx.h b/src/Components/Gfx/Gfx.h index 6d1d02fd..091f06f5 100644 --- a/src/Components/Gfx/Gfx.h +++ b/src/Components/Gfx/Gfx.h @@ -19,6 +19,7 @@ namespace Pinetime { void DrawString(uint8_t x, uint8_t y, uint16_t color, const char* text, const FONT_INFO *p_font, bool wrap); void DrawChar(const FONT_INFO *font, uint8_t c, uint8_t *x, uint8_t y, uint16_t color); void FillRectangle(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint16_t color); + void FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b); void SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines); void SetScrollStartLine(uint16_t line); @@ -26,6 +27,8 @@ namespace Pinetime { void Sleep(); void Wakeup(); bool GetNextBuffer(uint8_t **buffer, size_t &size) override; + void pixel_draw(uint8_t x, uint8_t y, uint16_t color); + private: static constexpr uint8_t width = 240; @@ -49,7 +52,6 @@ namespace Pinetime { uint16_t buffer[width]; // 1 line buffer Drivers::St7789& lcd; - void pixel_draw(uint8_t x, uint8_t y, uint16_t color); void SetBackgroundColor(uint16_t color); void WaitTransfertFinished() const; void NotifyEndOfTransfert(TaskHandle_t task); |