Revert "Elimnate some warnings #702"

This reverts commit 31125ca5ac.
This commit is contained in:
Bodmer
2020-08-05 23:13:59 +01:00
parent 31125ca5ac
commit cfcb9c6632
2 changed files with 33 additions and 33 deletions

View File

@@ -33,8 +33,8 @@ TFT_eSprite::TFT_eSprite(TFT_eSPI *tft)
_xptr = 0; // pushColor coordinate _xptr = 0; // pushColor coordinate
_yptr = 0; _yptr = 0;
_xPivot = 0; _xpivot = 0;
_yPivot = 0; _ypivot = 0;
_colorMap = nullptr; _colorMap = nullptr;
@@ -69,8 +69,8 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
_sh = h; _sh = h;
_scolor = TFT_BLACK; _scolor = TFT_BLACK;
_xPivot = w/2; _xpivot = w/2;
_yPivot = h/2; _ypivot = h/2;
_img8 = (uint8_t*) callocSprite(w, h, frames); _img8 = (uint8_t*) callocSprite(w, h, frames);
_img8_1 = _img8; _img8_1 = _img8;
@@ -397,8 +397,8 @@ void TFT_eSprite::deleteSprite(void)
***************************************************************************************/ ***************************************************************************************/
void TFT_eSprite::setPivot(int16_t x, int16_t y) void TFT_eSprite::setPivot(int16_t x, int16_t y)
{ {
_xPivot = x; _xpivot = x;
_yPivot = y; _ypivot = y;
} }
@@ -408,7 +408,7 @@ void TFT_eSprite::setPivot(int16_t x, int16_t y)
***************************************************************************************/ ***************************************************************************************/
int16_t TFT_eSprite::getPivotX(void) int16_t TFT_eSprite::getPivotX(void)
{ {
return _xPivot; return _xpivot;
} }
@@ -418,7 +418,7 @@ int16_t TFT_eSprite::getPivotX(void)
***************************************************************************************/ ***************************************************************************************/
int16_t TFT_eSprite::getPivotY(void) int16_t TFT_eSprite::getPivotY(void)
{ {
return _yPivot; return _ypivot;
} }
@@ -442,8 +442,8 @@ bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp)
uint16_t sline_buffer[max_x - min_x + 1]; uint16_t sline_buffer[max_x - min_x + 1];
int32_t xt = min_x - _tft->_xPivot; int32_t xt = min_x - _tft->_xpivot;
int32_t yt = min_y - _tft->_yPivot; int32_t yt = min_y - _tft->_ypivot;
uint32_t xe = _dwidth << FP_SCALE; uint32_t xe = _dwidth << FP_SCALE;
uint32_t ye = _dheight << FP_SCALE; uint32_t ye = _dheight << FP_SCALE;
uint32_t tpcolor = transp; // convert to unsigned uint32_t tpcolor = transp; // convert to unsigned
@@ -454,8 +454,8 @@ bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp)
// Scan destination bounding box and fetch transformed pixels from source Sprite // Scan destination bounding box and fetch transformed pixels from source Sprite
for (int32_t y = min_y; y <= max_y; y++, yt++) { for (int32_t y = min_y; y <= max_y; y++, yt++) {
int32_t x = min_x; int32_t x = min_x;
uint32_t xs = (_cosra * xt - (_sinra * yt - (_xPivot << FP_SCALE)) + (1 << (FP_SCALE - 1))); uint32_t xs = (_cosra * xt - (_sinra * yt - (_xpivot << FP_SCALE)) + (1 << (FP_SCALE - 1)));
uint32_t ys = (_sinra * xt + (_cosra * yt + (_yPivot << FP_SCALE)) + (1 << (FP_SCALE - 1))); uint32_t ys = (_sinra * xt + (_cosra * yt + (_ypivot << FP_SCALE)) + (1 << (FP_SCALE - 1)));
while ((xs >= xe || ys >= ye) && x < max_x) { x++; xs += _cosra; ys += _sinra; } while ((xs >= xe || ys >= ye) && x < max_x) { x++; xs += _cosra; ys += _sinra; }
if (x == max_x) continue; if (x == max_x) continue;
@@ -513,8 +513,8 @@ bool TFT_eSprite::pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp)
uint16_t sline_buffer[max_x - min_x + 1]; uint16_t sline_buffer[max_x - min_x + 1];
int32_t xt = min_x - spr->_xPivot; int32_t xt = min_x - spr->_xpivot;
int32_t yt = min_y - spr->_yPivot; int32_t yt = min_y - spr->_ypivot;
uint32_t xe = _dwidth << FP_SCALE; uint32_t xe = _dwidth << FP_SCALE;
uint32_t ye = _dheight << FP_SCALE; uint32_t ye = _dheight << FP_SCALE;
uint32_t tpcolor = transp>>8 | transp<<8; // convert to unsigned swapped bytes uint32_t tpcolor = transp>>8 | transp<<8; // convert to unsigned swapped bytes
@@ -525,8 +525,8 @@ bool TFT_eSprite::pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp)
// Scan destination bounding box and fetch transformed pixels from source Sprite // Scan destination bounding box and fetch transformed pixels from source Sprite
for (int32_t y = min_y; y <= max_y; y++, yt++) { for (int32_t y = min_y; y <= max_y; y++, yt++) {
int32_t x = min_x; int32_t x = min_x;
uint32_t xs = (_cosra * xt - (_sinra * yt - (_xPivot << FP_SCALE)) + (1 << (FP_SCALE - 1))); uint32_t xs = (_cosra * xt - (_sinra * yt - (_xpivot << FP_SCALE)) + (1 << (FP_SCALE - 1)));
uint32_t ys = (_sinra * xt + (_cosra * yt + (_yPivot << FP_SCALE)) + (1 << (FP_SCALE - 1))); uint32_t ys = (_sinra * xt + (_cosra * yt + (_ypivot << FP_SCALE)) + (1 << (FP_SCALE - 1)));
while ((xs >= xe || ys >= ye) && x < max_x) { x++; xs += _cosra; ys += _sinra; } while ((xs >= xe || ys >= ye) && x < max_x) { x++; xs += _cosra; ys += _sinra; }
if (x == max_x) continue; if (x == max_x) continue;
@@ -563,13 +563,13 @@ bool TFT_eSprite::getRotatedBounds(int16_t angle, int16_t *min_x, int16_t *min_y
int16_t *max_x, int16_t *max_y) int16_t *max_x, int16_t *max_y)
{ {
// Get the bounding box of this rotated source Sprite relative to Sprite pivot // Get the bounding box of this rotated source Sprite relative to Sprite pivot
getRotatedBounds(angle, width(), height(), _xPivot, _yPivot, min_x, min_y, max_x, max_y); getRotatedBounds(angle, width(), height(), _xpivot, _ypivot, min_x, min_y, max_x, max_y);
// Move bounding box so source Sprite pivot coincides with TFT pivot // Move bounding box so source Sprite pivot coincides with TFT pivot
*min_x += _tft->_xPivot; *min_x += _tft->_xpivot;
*max_x += _tft->_xPivot; *max_x += _tft->_xpivot;
*min_y += _tft->_yPivot; *min_y += _tft->_ypivot;
*max_y += _tft->_yPivot; *max_y += _tft->_ypivot;
// Return if bounding box is outside of TFT area // Return if bounding box is outside of TFT area
if (*min_x > _tft->width()) return false; if (*min_x > _tft->width()) return false;
@@ -595,13 +595,13 @@ bool TFT_eSprite::getRotatedBounds(TFT_eSprite *spr, int16_t angle, int16_t *min
int16_t *max_x, int16_t *max_y) int16_t *max_x, int16_t *max_y)
{ {
// Get the bounding box of this rotated source Sprite relative to Sprite pivot // Get the bounding box of this rotated source Sprite relative to Sprite pivot
getRotatedBounds(angle, width(), height(), _xPivot, _yPivot, min_x, min_y, max_x, max_y); getRotatedBounds(angle, width(), height(), _xpivot, _ypivot, min_x, min_y, max_x, max_y);
// Move bounding box so source Sprite pivot coincides with destination Sprite pivot // Move bounding box so source Sprite pivot coincides with destination Sprite pivot
*min_x += spr->_xPivot; *min_x += spr->_xpivot;
*max_x += spr->_xPivot; *max_x += spr->_xpivot;
*min_y += spr->_yPivot; *min_y += spr->_ypivot;
*max_y += spr->_yPivot; *max_y += spr->_ypivot;
// Test only to show bounding box // Test only to show bounding box
// spr->fillSprite(TFT_BLACK); // spr->fillSprite(TFT_BLACK);

View File

@@ -9,7 +9,7 @@ class TFT_eSprite : public TFT_eSPI {
public: public:
explicit TFT_eSprite(TFT_eSPI *tft); TFT_eSprite(TFT_eSPI *tft);
~TFT_eSprite(void); ~TFT_eSprite(void);
// Create a sprite of width x height pixels, return a pointer to the RAM area // Create a sprite of width x height pixels, return a pointer to the RAM area
@@ -167,15 +167,15 @@ class TFT_eSprite : public TFT_eSPI {
uint8_t _bpp; // bits per pixel (1, 8 or 16) uint8_t _bpp; // bits per pixel (1, 8 or 16)
uint16_t *_img; // pointer to 16 bit sprite uint16_t *_img; // pointer to 16 bit sprite
uint8_t *_img8; // pointer to 8 bit sprite frame 1 or frame 2 uint8_t *_img8; // pointer to 8 bit sprite
uint8_t *_img4; // pointer to 4 bit sprite (uses color map) uint8_t *_img4; // pointer to 4 bit sprite (uses color map)
uint8_t *_img8_1; // pointer to frame 1 uint8_t *_img8_1; // pointer to frame 1
uint8_t *_img8_2; // pointer to frame 2 uint8_t *_img8_2; // pointer to frame 2
uint16_t *_colorMap; // color map: 16 entries, used with 4 bit color map. uint16_t *_colorMap; // color map: 16 entries, used with 4 bit color map.
int16_t _xPivot; // x pivot point coordinate int16_t _xpivot; // x pivot point coordinate
int16_t _yPivot; // y pivot point coordinate int16_t _ypivot; // y pivot point coordinate
int32_t _sinra; int32_t _sinra;
int32_t _cosra; int32_t _cosra;