DrawFrame: Draw corners just once, fixes XOR mode.
This commit is contained in:
parent
21f5a74dff
commit
0324a95051
|
@ -57,8 +57,6 @@ void u8g2_DrawBox(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g
|
||||||
/*
|
/*
|
||||||
draw a frame (empty box)
|
draw a frame (empty box)
|
||||||
restriction: does not work for w = 0 or h = 0
|
restriction: does not work for w = 0 or h = 0
|
||||||
ToDo:
|
|
||||||
pixel in the corners are drawn twice. This could be optimized.
|
|
||||||
*/
|
*/
|
||||||
void u8g2_DrawFrame(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h)
|
void u8g2_DrawFrame(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h)
|
||||||
{
|
{
|
||||||
|
@ -70,13 +68,18 @@ void u8g2_DrawFrame(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u
|
||||||
#endif /* U8G2_WITH_INTERSECTION */
|
#endif /* U8G2_WITH_INTERSECTION */
|
||||||
|
|
||||||
u8g2_DrawHVLine(u8g2, x, y, w, 0);
|
u8g2_DrawHVLine(u8g2, x, y, w, 0);
|
||||||
u8g2_DrawHVLine(u8g2, x, y, h, 1);
|
if (h >= 2) {
|
||||||
x+=w;
|
h-=2;
|
||||||
x--;
|
y++;
|
||||||
u8g2_DrawHVLine(u8g2, x, y, h, 1);
|
if (h > 0) {
|
||||||
y+=h;
|
u8g2_DrawHVLine(u8g2, x, y, h, 1);
|
||||||
y--;
|
x+=w;
|
||||||
u8g2_DrawHVLine(u8g2, xtmp, y, w, 0);
|
x--;
|
||||||
|
u8g2_DrawHVLine(u8g2, x, y, h, 1);
|
||||||
|
y+=h;
|
||||||
|
}
|
||||||
|
u8g2_DrawHVLine(u8g2, xtmp, y, w, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue