Fixes -Wshadow "error: declaration of 'byte' shadows a global declaration"

Arduino.h defines "typedef uint8_t byte" that conflicts with this declaration
This commit is contained in:
Wayne Piekarski 2022-06-22 09:33:21 -07:00
parent f8e9621bad
commit c341c18f7a

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]);
}
}