circle & ellipse testing and bugfixing

This commit is contained in:
olikraus 2016-04-23 12:16:36 +02:00
parent 4c643a02f1
commit 53a37b7ce3
2 changed files with 7 additions and 3 deletions

View File

@ -301,7 +301,7 @@ void u8g2_DrawEllipse(u8g2_t *u8g2, u8g2_uint_t x0, u8g2_uint_t y0, u8g2_uint_t
/* check for bounding box */
#ifdef U8G2_WITH_INTERSECTION
{
if ( u8g2_IsIntersection(u8g2, x0-rx, y0-ry, x0-rx+1, y0-ry+1) == 0 )
if ( u8g2_IsIntersection(u8g2, x0-rx, y0-ry, x0+rx+1, y0+ry+1) == 0 )
return;
}
#endif /* U8G2_WITH_INTERSECTION */
@ -434,7 +434,7 @@ void u8g2_DrawFilledEllipse(u8g2_t *u8g2, u8g2_uint_t x0, u8g2_uint_t y0, u8g2_u
/* check for bounding box */
#ifdef U8G2_WITH_INTERSECTION
{
if ( u8g2_IsIntersection(u8g2, x0-rx, y0-ry, x0-rx+1, y0-ry+1) == 0 )
if ( u8g2_IsIntersection(u8g2, x0-rx, y0-ry, x0+rx+1, y0+ry+1) == 0 )
return;
}
#endif /* U8G2_WITH_INTERSECTION */

View File

@ -21,7 +21,11 @@ int main(void)
u8g2_FirstPage(&u8g2);
do
{
u8g2_DrawCircle(&u8g2, 11, 11, 5, U8G2_DRAW_ALL);
u8g2_DrawCircle(&u8g2, 7, 11, 5, U8G2_DRAW_ALL);
u8g2_DrawEllipse(&u8g2, 19, 11, 5, 5, U8G2_DRAW_ALL);
u8g2_DrawDisc(&u8g2, 7, 11+14, 5, U8G2_DRAW_ALL);
u8g2_DrawFilledEllipse(&u8g2, 19, 11+14, 5, 5, U8G2_DRAW_ALL);
u8g2_DrawEllipse(&u8g2, 60, 11+12, 17, 5, U8G2_DRAW_ALL);
u8g2_DrawStr(&u8g2, 30, 10, "Circle&Disk");
} while( u8g2_NextPage(&u8g2) );