Skip to content

Commit cb53b65

Browse files
Fix label shadows drawing out of bounds
Shadows would be drawn out of bounds and wrap to opposite edge of screen
1 parent 8f26864 commit cb53b65

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tobkit/source/widget.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ ITCM_CODE
171171
void Widget::drawBox(u8 tx, u8 ty, u8 tw, u8 th, u16 col)
172172
{
173173
uint_fast8_t i,j;
174+
//Are we about to draw out of bounds?
175+
if(tx+tw>255) {
176+
u8 tempResult;
177+
tempResult = (tx + tw) - 255;
178+
tw = tw-tempResult;
179+
}
174180
for(i=0;i<tw;++i) {
175181
drawPixel(i+tx, ty, col);
176182
drawPixel(i+tx, ty+th-1, col);

0 commit comments

Comments
 (0)