X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/3a4d8a99f885909119362e3b9b9b587315d74ad7..d01a237960f2884d8b62686b587aa1f6175772d4:/drivers/displays/tft/controls/progressbar.c?ds=inline diff --git a/drivers/displays/tft/controls/progressbar.c b/drivers/displays/tft/controls/progressbar.c index 8a46d21..3c0c061 100644 --- a/drivers/displays/tft/controls/progressbar.c +++ b/drivers/displays/tft/controls/progressbar.c @@ -79,11 +79,8 @@ void progressbarRender(uint16_t x, uint16_t y, uint16_t width, uint16_t height, // Make sure we don't end up in negative territory with really small values if (progressEnd < x + 2) progressEnd = x+2; - // Calculate slightly brighter and darker colors for the border and gradient - brighter = colorsAlphaBlend(COLOR_WHITE, color, 50); - darker = colorsAlphaBlend(COLOR_BLACK, color, 35); - // Draw the outline and background gradient + // This needs to be square to avoid flickering with rapid updates :/ drawRectangle(x, y, x+width, y+height, theme.colorBorderDarker); drawRectangle(x+1, y+1, x+width-1, y+height-1, theme.colorFill); drawGradient(progressEnd+1, y+2, x+width-2, y+height-2, theme.colorFill, theme.colorBorder); @@ -91,6 +88,10 @@ void progressbarRender(uint16_t x, uint16_t y, uint16_t width, uint16_t height, // Draw the progress gradient if required if (progress) { + // Calculate slightly brighter and darker colors for the border and gradient + brighter = colorsAlphaBlend(COLOR_WHITE, color, 50); + darker = colorsAlphaBlend(COLOR_BLACK, color, 35); + // Draw border rectangle and gradient fill drawRectangle(x+2, y+2, progressEnd, y+height-2, darker); drawGradient(x+3, y+3, progressEnd-1, y+height-3, brighter, color); }