Naming and coding style convention, new linter tool. (#945)
* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
This commit is contained in:
@@ -41,8 +41,7 @@
|
||||
#define U8G2_ALWAYS_INLINE __inline__ __attribute__((always_inline))
|
||||
#else
|
||||
#define U8G2_ALWAYS_INLINE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(U8G2_WITH_INTERSECTION) || defined(U8G2_WITH_CLIP_WINDOW_SUPPORT)
|
||||
|
||||
@@ -58,7 +57,6 @@
|
||||
---1-1--- 1 b1 <= a2 && b2 >= a1
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
calculate the intersection between a0/a1 and v0/v1
|
||||
The intersection check returns one if the range of a0/a1 has an intersection with v0/v1.
|
||||
@@ -71,106 +69,85 @@
|
||||
assert( u8g2_is_intersection_decision_tree(7, 9, 4, 6) == 0 );
|
||||
*/
|
||||
|
||||
//static uint8_t U8G2_ALWAYS_INLINE u8g2_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1)
|
||||
static uint8_t u8g2_is_intersection_decision_tree(u8g2_uint_t a0, u8g2_uint_t a1, u8g2_uint_t v0, u8g2_uint_t v1)
|
||||
{
|
||||
if ( v0 <= a1 )
|
||||
{
|
||||
if ( v1 >= a0 )
|
||||
{
|
||||
return 1;
|
||||
//static uint8_t U8G2_ALWAYS_INLINE u8g2_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1)
|
||||
static uint8_t u8g2_is_intersection_decision_tree(
|
||||
u8g2_uint_t a0,
|
||||
u8g2_uint_t a1,
|
||||
u8g2_uint_t v0,
|
||||
u8g2_uint_t v1) {
|
||||
if(v0 <= a1) {
|
||||
if(v1 >= a0) {
|
||||
return 1;
|
||||
} else {
|
||||
if(v0 > v1) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(v1 >= a0) {
|
||||
if(v0 > v1) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( v0 > v1 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( v1 >= a0 )
|
||||
{
|
||||
if ( v0 > v1 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* OLD_VERSION_WITH_SYMETRIC_BOUNDARIES */
|
||||
|
||||
#endif /* OLD_VERSION_WITH_SYMETRIC_BOUNDARIES */
|
||||
|
||||
/*
|
||||
version with asymetric boundaries.
|
||||
a1 and v1 are excluded
|
||||
v0 == v1 is not support end return 1
|
||||
*/
|
||||
uint8_t u8g2_is_intersection_decision_tree(u8g2_uint_t a0, u8g2_uint_t a1, u8g2_uint_t v0, u8g2_uint_t v1)
|
||||
{
|
||||
if ( v0 < a1 ) // v0 <= a1
|
||||
{
|
||||
if ( v1 > a0 ) // v1 >= a0
|
||||
uint8_t u8g2_is_intersection_decision_tree(
|
||||
u8g2_uint_t a0,
|
||||
u8g2_uint_t a1,
|
||||
u8g2_uint_t v0,
|
||||
u8g2_uint_t v1) {
|
||||
if(v0 < a1) // v0 <= a1
|
||||
{
|
||||
return 1;
|
||||
if(v1 > a0) // v1 >= a0
|
||||
{
|
||||
return 1;
|
||||
} else {
|
||||
if(v0 > v1) // v0 > v1
|
||||
{
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(v1 > a0) // v1 >= a0
|
||||
{
|
||||
if(v0 > v1) // v0 > v1
|
||||
{
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( v0 > v1 ) // v0 > v1
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( v1 > a0 ) // v1 >= a0
|
||||
{
|
||||
if ( v0 > v1 ) // v0 > v1
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* upper limits are not included (asymetric boundaries) */
|
||||
uint8_t u8g2_IsIntersection(u8g2_t *u8g2, u8g2_uint_t x0, u8g2_uint_t y0, u8g2_uint_t x1, u8g2_uint_t y1)
|
||||
{
|
||||
if ( u8g2_is_intersection_decision_tree(u8g2->user_y0, u8g2->user_y1, y0, y1) == 0 )
|
||||
return 0;
|
||||
|
||||
return u8g2_is_intersection_decision_tree(u8g2->user_x0, u8g2->user_x1, x0, x1);
|
||||
uint8_t u8g2_IsIntersection(
|
||||
u8g2_t* u8g2,
|
||||
u8g2_uint_t x0,
|
||||
u8g2_uint_t y0,
|
||||
u8g2_uint_t x1,
|
||||
u8g2_uint_t y1) {
|
||||
if(u8g2_is_intersection_decision_tree(u8g2->user_y0, u8g2->user_y1, y0, y1) == 0) return 0;
|
||||
|
||||
return u8g2_is_intersection_decision_tree(u8g2->user_x0, u8g2->user_x1, x0, x1);
|
||||
}
|
||||
|
||||
|
||||
#endif /* U8G2_WITH_INTERSECTION */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user