.pio/libdeps/m5stack-core2/M5Core2/src/utility/Sprite.cpp
void TFT_eSprite::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
{
  if (!_created ) return;

  if ((x >= _iwidth) || (y >= _iheight)) return;
  
  if (x < 0) { w += x; x = 0; }
  if (y < 0) { h += y; y = 0; }

  if ((x + w) > _iwidth)  w = _iwidth  - x;
  if ((y + h) > _iheight) h = _iheight - y;

  if ((w < 1) || (h < 1)) return;

  int32_t yp = _iwidth * y + x;

  if (_bpp == 16)
  {
    color = (color >> 8) | (color << 8);
    uint32_t iw = w;
    int32_t ys = yp;
    if(h--)  {while (iw--) _img[yp++] = (uint16_t) color;}
    yp = ys;
    while (h--)
    {
      yp += _iwidth;
      memcpy( _img+yp, _img+ys, w<<1);
    }
  }
  else if (_bpp == 8)
  {
    color = (color & 0xE000)>>8 | (color & 0x0700)>>6 | (color & 0x0018)>>3;
    while (h--)
    {
      memset(_img8 + yp, (uint8_t)color, w);
      yp += _iwidth;
    }
  }
  else
  {
    while (h--)
    {
      int32_t ww = w;
      int32_t xx = x;
      while (ww--) drawPixel(xx++, y, color);
      y++;
    }
  }
}
/***************************************************************************************
** Function name:           fillRect
** Description:             draw a filled rectangle
*************************************************************************************x*/
Function name:           fillRect
Description:             draw a filled rectangle
x
Function name : fillRect Description : draw a filled rectangle x
void TFT_eSprite::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
{
  if (!_created ) return;
  if ((x >= _iwidth) || (y >= _iheight)) return;
  if (x < 0) { w += x; x = 0; }
  if (y < 0) { h += y; y = 0; }
  if ((x + w) > _iwidth)  w = _iwidth  - x;
  if ((y + h) > _iheight) h = _iheight - y;
  if ((w < 1) || (h < 1)) return;
  int32_t yp = _iwidth * y + x;
  if (_bpp == 16)
  {
    color = (color >> 8) | (color << 8);
    uint32_t iw = w;
    int32_t ys = yp;
    if(h--)  {while (iw--) _img[yp++] = (uint16_t) color;}
    yp = ys;
    while (h--)
    {
      yp += _iwidth;
      memcpy( _img+yp, _img+ys, w<<1);
    }
  }
  else if (_bpp == 8)
  {
    color = (color & 0xE000)>>8 | (color & 0x0700)>>6 | (color & 0x0018)>>3;
    while (h--)
    {
      memset(_img8 + yp, (uint8_t)color, w);
      yp += _iwidth;
    }
  }
  else
  {
    while (h--)
    {
      int32_t ww = w;
      int32_t xx = x;
      while (ww--) drawPixel(xx++, y, color);
      y++;
    }
  }
}
void TFT_eSprite :: fillRect ( int32_t x , int32_t y , int32_t w , int32_t h , uint32_t color ) { if ( ! _created ) return ; if ( ( x >= _iwidth ) || ( y >= _iheight ) ) return ; if ( x < 0 ) { w += x ; x = 0 ; } if ( y < 0 ) { h += y ; y = 0 ; } if ( ( x + w ) > _iwidth ) w = _iwidth - x ; if ( ( y + h ) > _iheight ) h = _iheight - y ; if ( ( w < 1 ) || ( h < 1 ) ) return ; int32_t yp = _iwidth * y + x ; if ( _bpp == 16 ) { color = ( color >> 8 ) | ( color << 8 ) ; uint32_t iw = w ; int32_t ys = yp ; if ( h -- ) { while ( iw -- ) _img [ yp ++ ] = ( uint16_t ) color ; } yp = ys ; while ( h -- ) { yp += _iwidth ; memcpy ( _img + yp , _img + ys , w << 1 ) ; } } else if ( _bpp == 8 ) { color = ( color & 0xE000 ) >> 8 | ( color & 0x0700 ) >> 6 | ( color & 0x0018 ) >> 3 ; while ( h -- ) { memset ( _img8 + yp , ( uint8_t ) color , w ) ; yp += _iwidth ; } } else { while ( h -- ) { int32_t ww = w ; int32_t xx = x ; while ( ww -- ) drawPixel ( xx ++ , y , color ) ; y ++ ; } } }
Function name:           fillRect
Description:             draw a filled rectangle
x
Function name : fillRect Description : draw a filled rectangle x