/* x,y Upper left position of the line len length of the line in pixel, len must not be 0 dir 0: horizontal line (left to right) 1: vertical line (top to bottom) */ static void u8g2_draw_hv_line(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir) { u8g2_uint_t a; if ( dir == 0 ) { if ( y < u8g2->buf_y0 ) return; if ( y >= u8g2->buf_y1 ) return; a = x; a += len; if ( u8g2_clip_intersection(&x, &a, u8g2->buf_x0, u8g2->buf_x1) == 0 ) return; len = a; len -= x; } else { if ( x < u8g2->buf_x0 ) return; if ( x >= u8g2->buf_x1 ) return; a = y; a += len; if ( u8g2_clip_intersection(&y, &a, u8g2->buf_y0, u8g2->buf_y1) == 0 ) return; len = a; len -= y; } u8g2_unsafe_draw_hv_line(u8g2, x, y, len, dir); }
/* x,y Upper left position of the line len length of the line in pixel, len must not be 0 dir 0: horizontal line (left to right) 1: vertical line (top to bottom) This function first adjusts the y position to the local buffer. Then it will clip the line and call u8g2_draw_low_level_hv_line() */ static void u8g2_draw_hv_line_2dir(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir) { u8g2_uint_t a; register u8g2_uint_t w, h; y -= u8g2->tile_curr_row*8; h = u8g2->pixel_buf_height; // this must be the real buffer height w = u8g2->pixel_buf_width; // this could be replaced by u8g2->u8x8.display_info->pixel_width if ( dir == 0 ) { if ( y >= h ) return; a = x; a += len; if ( u8g2_clip_intersection(&x, &a, w) == 0 ) return; len = a; len -= x; } else { if ( x >= w ) return; a = y; a += len; if ( u8g2_clip_intersection(&y, &a, h) == 0 ) return; len = a; len -= y; } u8g2->ll_hvline(u8g2, x, y, len, dir); //u8g2_draw_low_level_hv_line(u8g2, x, y, len, dir); }