Merge pull request #392 from waynepiekarski/master

Fix up errors caused by the code using same names defined elsewhere
This commit is contained in:
Paint Your Dragon
2022-06-28 15:42:20 -07:00
committed by GitHub
+37 -40
View File
@@ -718,16 +718,16 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
int16_t w, int16_t h, uint16_t color) {
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
uint8_t byte = 0;
uint8_t b = 0;
startWrite();
for (int16_t j = 0; j < h; j++, y++) {
for (int16_t i = 0; i < w; i++) {
if (i & 7)
byte <<= 1;
b <<= 1;
else
byte = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
if (byte & 0x80)
b = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
if (b & 0x80)
writePixel(x + i, y, color);
}
}
@@ -753,16 +753,16 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
uint16_t bg) {
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
uint8_t byte = 0;
uint8_t b = 0;
startWrite();
for (int16_t j = 0; j < h; j++, y++) {
for (int16_t i = 0; i < w; i++) {
if (i & 7)
byte <<= 1;
b <<= 1;
else
byte = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
writePixel(x + i, y, (byte & 0x80) ? color : bg);
b = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
writePixel(x + i, y, (b & 0x80) ? color : bg);
}
}
endWrite();
@@ -784,16 +784,16 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w,
int16_t h, uint16_t color) {
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
uint8_t byte = 0;
uint8_t b = 0;
startWrite();
for (int16_t j = 0; j < h; j++, y++) {
for (int16_t i = 0; i < w; i++) {
if (i & 7)
byte <<= 1;
b <<= 1;
else
byte = bitmap[j * byteWidth + i / 8];
if (byte & 0x80)
b = bitmap[j * byteWidth + i / 8];
if (b & 0x80)
writePixel(x + i, y, color);
}
}
@@ -818,16 +818,16 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w,
int16_t h, uint16_t color, uint16_t bg) {
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
uint8_t byte = 0;
uint8_t b = 0;
startWrite();
for (int16_t j = 0; j < h; j++, y++) {
for (int16_t i = 0; i < w; i++) {
if (i & 7)
byte <<= 1;
b <<= 1;
else
byte = bitmap[j * byteWidth + i / 8];
writePixel(x + i, y, (byte & 0x80) ? color : bg);
b = bitmap[j * byteWidth + i / 8];
writePixel(x + i, y, (b & 0x80) ? color : bg);
}
}
endWrite();
@@ -852,18 +852,18 @@ void Adafruit_GFX::drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
int16_t w, int16_t h, uint16_t color) {
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
uint8_t byte = 0;
uint8_t b = 0;
startWrite();
for (int16_t j = 0; j < h; j++, y++) {
for (int16_t i = 0; i < w; i++) {
if (i & 7)
byte >>= 1;
b >>= 1;
else
byte = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
b = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
// Nearly identical to drawBitmap(), only the bit order
// is reversed here (left-to-right = LSB to MSB):
if (byte & 0x01)
if (b & 0x01)
writePixel(x + i, y, color);
}
}
@@ -937,15 +937,15 @@ void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y,
const uint8_t mask[], int16_t w,
int16_t h) {
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
uint8_t byte = 0;
uint8_t b = 0;
startWrite();
for (int16_t j = 0; j < h; j++, y++) {
for (int16_t i = 0; i < w; i++) {
if (i & 7)
byte <<= 1;
b <<= 1;
else
byte = pgm_read_byte(&mask[j * bw + i / 8]);
if (byte & 0x80) {
b = pgm_read_byte(&mask[j * bw + i / 8]);
if (b & 0x80) {
writePixel(x + i, y, (uint8_t)pgm_read_byte(&bitmap[j * w + i]));
}
}
@@ -971,15 +971,15 @@ void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y,
void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap,
uint8_t *mask, int16_t w, int16_t h) {
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
uint8_t byte = 0;
uint8_t b = 0;
startWrite();
for (int16_t j = 0; j < h; j++, y++) {
for (int16_t i = 0; i < w; i++) {
if (i & 7)
byte <<= 1;
b <<= 1;
else
byte = mask[j * bw + i / 8];
if (byte & 0x80) {
b = mask[j * bw + i / 8];
if (b & 0x80) {
writePixel(x + i, y, bitmap[j * w + i]);
}
}
@@ -1048,15 +1048,15 @@ void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap,
void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[],
const uint8_t mask[], int16_t w, int16_t h) {
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
uint8_t byte = 0;
uint8_t b = 0;
startWrite();
for (int16_t j = 0; j < h; j++, y++) {
for (int16_t i = 0; i < w; i++) {
if (i & 7)
byte <<= 1;
b <<= 1;
else
byte = pgm_read_byte(&mask[j * bw + i / 8]);
if (byte & 0x80) {
b = pgm_read_byte(&mask[j * bw + i / 8]);
if (b & 0x80) {
writePixel(x + i, y, pgm_read_word(&bitmap[j * w + i]));
}
}
@@ -1081,15 +1081,15 @@ void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[],
void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap,
uint8_t *mask, int16_t w, int16_t h) {
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
uint8_t byte = 0;
uint8_t b = 0;
startWrite();
for (int16_t j = 0; j < h; j++, y++) {
for (int16_t i = 0; i < w; i++) {
if (i & 7)
byte <<= 1;
b <<= 1;
else
byte = mask[j * bw + i / 8];
if (byte & 0x80) {
b = mask[j * bw + i / 8];
if (b & 0x80) {
writePixel(x + i, y, bitmap[j * w + i]);
}
}
@@ -1867,8 +1867,7 @@ bool GFXcanvas1::getPixel(int16_t x, int16_t y) const {
bool GFXcanvas1::getRawPixel(int16_t x, int16_t y) const {
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
return 0;
if (this->getBuffer()) {
uint8_t *buffer = this->getBuffer();
if (buffer) {
uint8_t *ptr = &buffer[(x / 8) + y * ((WIDTH + 7) / 8)];
#ifdef __AVR__
@@ -2017,7 +2016,6 @@ void GFXcanvas1::drawFastRawVLine(int16_t x, int16_t y, int16_t h,
uint16_t color) {
// x & y already in raw (rotation 0) coordinates, no need to transform.
int16_t row_bytes = ((WIDTH + 7) / 8);
uint8_t *buffer = this->getBuffer();
uint8_t *ptr = &buffer[(x / 8) + y * row_bytes];
if (color > 0) {
@@ -2056,7 +2054,6 @@ void GFXcanvas1::drawFastRawHLine(int16_t x, int16_t y, int16_t w,
uint16_t color) {
// x & y already in raw (rotation 0) coordinates, no need to transform.
int16_t rowBytes = ((WIDTH + 7) / 8);
uint8_t *buffer = this->getBuffer();
uint8_t *ptr = &buffer[(x / 8) + y * rowBytes];
size_t remainingWidthBits = w;