mirror of https://github.com/MLXXXp/Arduboy2.git
Minor source format changes for drawCompressed()
No code changes from previous commit.
This commit is contained in:
parent
6f6849a5bb
commit
d44b89e01f
|
@ -846,7 +846,9 @@ void Arduboy2Base::drawSlowXYBitmap
|
|||
}
|
||||
|
||||
|
||||
struct BitStreamReader {
|
||||
// Helper for drawCompressed()
|
||||
struct BitStreamReader
|
||||
{
|
||||
const uint8_t *source;
|
||||
uint16_t sourceIndex;
|
||||
uint8_t bitBuffer;
|
||||
|
@ -878,15 +880,12 @@ struct BitStreamReader {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
void Arduboy2Base::drawCompressed(int16_t sx, int16_t sy, const uint8_t *bitmap, uint8_t color)
|
||||
{
|
||||
// set up decompress state
|
||||
|
||||
BitStreamReader cs = BitStreamReader(bitmap);
|
||||
|
||||
// read header
|
||||
|
||||
int width = (int)cs.readBits(8) + 1;
|
||||
int height = (int)cs.readBits(8) + 1;
|
||||
uint8_t spanColour = (uint8_t)cs.readBits(1); // starting colour
|
||||
|
@ -896,7 +895,6 @@ void Arduboy2Base::drawCompressed(int16_t sx, int16_t sy, const uint8_t *bitmap,
|
|||
return;
|
||||
|
||||
// sy = sy - (frame * height);
|
||||
|
||||
int yOffset = abs(sy) % 8;
|
||||
int startRow = sy / 8;
|
||||
if (sy < 0) {
|
||||
|
@ -933,7 +931,8 @@ void Arduboy2Base::drawCompressed(int16_t sx, int16_t sy, const uint8_t *bitmap,
|
|||
int bRow = startRow + rowOffset;
|
||||
|
||||
//if (byte) // possible optimisation
|
||||
if ((bRow <= (HEIGHT / 8) - 1) && (bRow > -2) && (columnOffset + sx <= (WIDTH - 1)) && (columnOffset + sx >= 0))
|
||||
if ((bRow <= (HEIGHT / 8) - 1) && (bRow > -2) &&
|
||||
(columnOffset + sx <= (WIDTH - 1)) && (columnOffset + sx >= 0))
|
||||
{
|
||||
int16_t offset = (bRow * WIDTH) + sx + columnOffset;
|
||||
if (bRow >= 0)
|
||||
|
|
Loading…
Reference in New Issue