123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- #include "u8g.h"
- #ifdef __GNUC__
- #define U8G_ALWAYS_INLINE __inline__ __attribute__((always_inline))
- #else
- #define U8G_ALWAYS_INLINE
- #endif
- #ifdef OLD_CODE_WHICH_IS_TOO_SLOW
- static uint8_t u8g_is_intersection_boolean(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1)
- {
- uint8_t c1, c2, c3, tmp;
- c1 = v0 <= a1;
- c2 = v1 >= a0;
- c3 = v0 > v1;
-
- tmp = c1;
- c1 &= c2;
- c2 &= c3;
- c3 &= tmp;
- c1 |= c2;
- c1 |= c3;
- return c1 & 1;
- }
- #endif
- #define U8G_IS_INTERSECTION_MACRO(a0,a1,v0,v1) ((uint8_t)( (v0) <= (a1) ) ? ( ( (v1) >= (a0) ) ? ( 1 ) : ( (v0) > (v1) ) ) : ( ( (v1) >= (a0) ) ? ( (v0) > (v1) ) : ( 0 ) ))
- static uint8_t U8G_ALWAYS_INLINE u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_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;
- }
- }
- }
- uint8_t u8g_IsBBXIntersection(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, u8g_uint_t h)
- {
- register u8g_uint_t tmp;
- tmp = y;
- tmp += h;
- tmp--;
- if ( u8g_is_intersection_decision_tree(u8g->current_page.y0, u8g->current_page.y1, y, tmp) == 0 )
- return 0;
-
- tmp = x;
- tmp += w;
- tmp--;
- return u8g_is_intersection_decision_tree(u8g->current_page.x0, u8g->current_page.x1, x, tmp);
- }
|