4 bpp Sprite bug fix

OR has precedence over AND so brackets needed.
Remove unused varaible.
This commit is contained in:
Bodmer
2020-02-01 01:43:16 +00:00
parent 8209c00316
commit c8530d7ae4
4 changed files with 5 additions and 6 deletions
+2 -3
View File
@@ -831,7 +831,6 @@ uint8_t TFT_eSprite::readPixelValue(int32_t x, int32_t y)
if (_bpp == 4)
{
uint16_t color;
if ((x & 0x01) == 0)
return ((_img4[((x+y*_iwidth)>>1)] & 0xF0) >> 4) & 0x0F; // even index = bits 7 .. 4
else
@@ -1639,14 +1638,14 @@ void TFT_eSprite::drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color)
{
uint8_t c = (uint8_t) (color & 0xF) << 4;
while (h--) {
_img4[(x + _iwidth * y)>>1] = (uint8_t) (c | _img4[(x + _iwidth * y)>>1] & 0x0F);
_img4[(x + _iwidth * y)>>1] = (uint8_t) (c | (_img4[(x + _iwidth * y)>>1] & 0x0F));
y++;
}
}
else {
uint8_t c = (uint8_t)color & 0xF;
while (h--) {
_img4[(x - 1 + _iwidth * y)>>1] = (uint8_t) (c | _img4[(x - 1 + _iwidth * y)>>1] & 0xF0); // x is odd; new color goes into the low bits.
_img4[(x - 1 + _iwidth * y)>>1] = (uint8_t) (c | (_img4[(x - 1 + _iwidth * y)>>1] & 0xF0)); // x is odd; new color goes into the low bits.
y++;
}
}