.pio/libdeps/m5stack-core2/M5Core2/src/utility/Sprite.cpp
void TFT_eSprite::drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color)
{
  if (!_created ) return;

  boolean steep = abs(y1 - y0) > abs(x1 - x0);
  if (steep) {
    swap_coord(x0, y0);
    swap_coord(x1, y1);
  }

  if (x0 > x1) {
    swap_coord(x0, x1);
    swap_coord(y0, y1);
  }

  int32_t dx = x1 - x0, dy = abs(y1 - y0);;

  int32_t err = dx >> 1, ystep = -1, xs = x0, dlen = 0;

  if (y0 < y1) ystep = 1;

  // Split into steep and not steep for FastH/V separation
  if (steep) {
    for (; x0 <= x1; x0++) {
      dlen++;
      err -= dy;
      if (err < 0) {
        err += dx;
        if (dlen == 1) drawPixel(y0, xs, color);
        else drawFastVLine(y0, xs, dlen, color);
        dlen = 0; y0 += ystep; xs = x0 + 1;
      }
    }
    if (dlen) drawFastVLine(y0, xs, dlen, color);
  }
  else
  {
    for (; x0 <= x1; x0++) {
      dlen++;
      err -= dy;
      if (err < 0) {
        err += dx;
        if (dlen == 1) drawPixel(xs, y0, color);
        else drawFastHLine(xs, y0, dlen, color);
        dlen = 0; y0 += ystep; xs = x0 + 1;
      }
    }
    if (dlen) drawFastHLine(xs, y0, dlen, color);
  }
}
/***************************************************************************************
** Function name:           drawLine
** Description:             draw a line between 2 arbitrary points
*************************************************************************************x*/
Function name:           drawLine
Description:             draw a line between 2 arbitrary points
x
Function name : drawLine Description : draw a line between 2 arbitrary points x
void TFT_eSprite::drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color)
{
  if (!_created ) return;
  boolean steep = abs(y1 - y0) > abs(x1 - x0);
  if (steep) {
    swap_coord(x0, y0);
    swap_coord(x1, y1);
  }
  if (x0 > x1) {
    swap_coord(x0, x1);
    swap_coord(y0, y1);
  }
  int32_t dx = x1 - x0, dy = abs(y1 - y0);;
  int32_t err = dx >> 1, ystep = -1, xs = x0, dlen = 0;
  if (y0 < y1) ystep = 1;
  if (steep) {
    for (; x0 <= x1; x0++) {
      dlen++;
      err -= dy;
      if (err < 0) {
        err += dx;
        if (dlen == 1) drawPixel(y0, xs, color);
        else drawFastVLine(y0, xs, dlen, color);
        dlen = 0; y0 += ystep; xs = x0 + 1;
      }
    }
    if (dlen) drawFastVLine(y0, xs, dlen, color);
  }
  else
  {
    for (; x0 <= x1; x0++) {
      dlen++;
      err -= dy;
      if (err < 0) {
        err += dx;
        if (dlen == 1) drawPixel(xs, y0, color);
        else drawFastHLine(xs, y0, dlen, color);
        dlen = 0; y0 += ystep; xs = x0 + 1;
      }
    }
    if (dlen) drawFastHLine(xs, y0, dlen, color);
  }
}
void TFT_eSprite :: drawLine ( int32_t x0 , int32_t y0 , int32_t x1 , int32_t y1 , uint32_t color ) { if ( ! _created ) return ; boolean steep = abs ( y1 - y0 ) > abs ( x1 - x0 ) ; if ( steep ) { swap_coord ( x0 , y0 ) ; swap_coord ( x1 , y1 ) ; } if ( x0 > x1 ) { swap_coord ( x0 , x1 ) ; swap_coord ( y0 , y1 ) ; } int32_t dx = x1 - x0 , dy = abs ( y1 - y0 ) ; ; int32_t err = dx >> 1 , ystep = -1 , xs = x0 , dlen = 0 ; if ( y0 < y1 ) ystep = 1 ; if ( steep ) { for ( ; x0 <= x1 ; x0 ++ ) { dlen ++ ; err -= dy ; if ( err < 0 ) { err += dx ; if ( dlen == 1 ) drawPixel ( y0 , xs , color ) ; else drawFastVLine ( y0 , xs , dlen , color ) ; dlen = 0 ; y0 += ystep ; xs = x0 + 1 ; } } if ( dlen ) drawFastVLine ( y0 , xs , dlen , color ) ; } else { for ( ; x0 <= x1 ; x0 ++ ) { dlen ++ ; err -= dy ; if ( err < 0 ) { err += dx ; if ( dlen == 1 ) drawPixel ( xs , y0 , color ) ; else drawFastHLine ( xs , y0 , dlen , color ) ; dlen = 0 ; y0 += ystep ; xs = x0 + 1 ; } } if ( dlen ) drawFastHLine ( xs , y0 , dlen , color ) ; } }
Function name:           drawLine
Description:             draw a line between 2 arbitrary points
x
Function name : drawLine Description : draw a line between 2 arbitrary points x
// Split into steep and not steep for FastH/V separation