From 1e67829ede21ac5df25b588bec01d32f1040718e Mon Sep 17 00:00:00 2001 From: Laurence Bank Date: Sat, 23 Nov 2024 18:46:01 +0000 Subject: [PATCH] Fix fillRoundRect --- examples/epd_panel_tester/epd_panel_tester.ino | 6 +++++- src/bb_ep_gfx.inl | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/epd_panel_tester/epd_panel_tester.ino b/examples/epd_panel_tester/epd_panel_tester.ino index 04fb87c..271047b 100644 --- a/examples/epd_panel_tester/epd_panel_tester.ino +++ b/examples/epd_panel_tester/epd_panel_tester.ino @@ -311,12 +311,16 @@ void FunctionTest(void) epd.setFont(FONT_16x16); epd.println("16x16 font"); epd.fillCircle(26, 80, 25, BBEP_BLACK); - epd.fillRect(60, 60, 40, 40, BBEP_RED); + epd.drawRect(60, 60, 40, 40, BBEP_RED); + epd.drawCircle(26, 134, 25, BBEP_RED); + epd.fillRoundRect(60, 114, 40, 40, 8, BBEP_BLACK); epd.writePlane(); epd.refresh(REFRESH_FULL, true); // display the white buffer and return epd.sleep(LIGHT_SLEEP); delay(5000); } // for iRot + oled.setCursor(0,24); + oled.print("Clear "); epd.fillScreen(BBEP_WHITE); epd.writePlane(); epd.refresh(REFRESH_FULL, true); diff --git a/src/bb_ep_gfx.inl b/src/bb_ep_gfx.inl index 5cc22be..75565d0 100644 --- a/src/bb_ep_gfx.inl +++ b/src/bb_ep_gfx.inl @@ -1703,9 +1703,8 @@ void bbepRectangle(BBEPDISP *pBBEP, int x1, int y1, int x2, int y2, uint8_t ucCo void bbepRoundRect(BBEPDISP *pBBEP, int x, int y, int w, int h, int r, uint8_t iColor, int bFilled) { if (bFilled) { - bbepRectangle(pBBEP, x+r, y, w-(2*r), r, iColor, 1); - bbepRectangle(pBBEP, x, y+r, w, h-(2*r), iColor, 1); - bbepRectangle(pBBEP, x+r, y+h-r, w-(2*r), r, iColor, 1); + bbepRectangle(pBBEP, x+r, y, x+w-1-r, y+h, iColor, 1); + bbepRectangle(pBBEP, x, y+r, x+w-1, y+h-r, iColor, 1); // draw four corners bbepEllipse(pBBEP, x+w-r-1, y+r, r, r, 1, iColor, 1); bbepEllipse(pBBEP, x+r, y+r, r, r, 2, iColor, 1);