mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2024-09-20 01:26:24 -04:00
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:
parent
f8e9621bad
commit
c341c18f7a
@ -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 w, int16_t h, uint16_t color) {
|
||||||
|
|
||||||
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
||||||
uint8_t byte = 0;
|
uint8_t b = 0;
|
||||||
|
|
||||||
startWrite();
|
startWrite();
|
||||||
for (int16_t j = 0; j < h; j++, y++) {
|
for (int16_t j = 0; j < h; j++, y++) {
|
||||||
for (int16_t i = 0; i < w; i++) {
|
for (int16_t i = 0; i < w; i++) {
|
||||||
if (i & 7)
|
if (i & 7)
|
||||||
byte <<= 1;
|
b <<= 1;
|
||||||
else
|
else
|
||||||
byte = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
|
b = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
|
||||||
if (byte & 0x80)
|
if (b & 0x80)
|
||||||
writePixel(x + i, y, color);
|
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) {
|
uint16_t bg) {
|
||||||
|
|
||||||
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
||||||
uint8_t byte = 0;
|
uint8_t b = 0;
|
||||||
|
|
||||||
startWrite();
|
startWrite();
|
||||||
for (int16_t j = 0; j < h; j++, y++) {
|
for (int16_t j = 0; j < h; j++, y++) {
|
||||||
for (int16_t i = 0; i < w; i++) {
|
for (int16_t i = 0; i < w; i++) {
|
||||||
if (i & 7)
|
if (i & 7)
|
||||||
byte <<= 1;
|
b <<= 1;
|
||||||
else
|
else
|
||||||
byte = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
|
b = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
|
||||||
writePixel(x + i, y, (byte & 0x80) ? color : bg);
|
writePixel(x + i, y, (b & 0x80) ? color : bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endWrite();
|
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 h, uint16_t color) {
|
||||||
|
|
||||||
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
||||||
uint8_t byte = 0;
|
uint8_t b = 0;
|
||||||
|
|
||||||
startWrite();
|
startWrite();
|
||||||
for (int16_t j = 0; j < h; j++, y++) {
|
for (int16_t j = 0; j < h; j++, y++) {
|
||||||
for (int16_t i = 0; i < w; i++) {
|
for (int16_t i = 0; i < w; i++) {
|
||||||
if (i & 7)
|
if (i & 7)
|
||||||
byte <<= 1;
|
b <<= 1;
|
||||||
else
|
else
|
||||||
byte = bitmap[j * byteWidth + i / 8];
|
b = bitmap[j * byteWidth + i / 8];
|
||||||
if (byte & 0x80)
|
if (b & 0x80)
|
||||||
writePixel(x + i, y, color);
|
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 h, uint16_t color, uint16_t bg) {
|
||||||
|
|
||||||
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
||||||
uint8_t byte = 0;
|
uint8_t b = 0;
|
||||||
|
|
||||||
startWrite();
|
startWrite();
|
||||||
for (int16_t j = 0; j < h; j++, y++) {
|
for (int16_t j = 0; j < h; j++, y++) {
|
||||||
for (int16_t i = 0; i < w; i++) {
|
for (int16_t i = 0; i < w; i++) {
|
||||||
if (i & 7)
|
if (i & 7)
|
||||||
byte <<= 1;
|
b <<= 1;
|
||||||
else
|
else
|
||||||
byte = bitmap[j * byteWidth + i / 8];
|
b = bitmap[j * byteWidth + i / 8];
|
||||||
writePixel(x + i, y, (byte & 0x80) ? color : bg);
|
writePixel(x + i, y, (b & 0x80) ? color : bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endWrite();
|
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 w, int16_t h, uint16_t color) {
|
||||||
|
|
||||||
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte
|
||||||
uint8_t byte = 0;
|
uint8_t b = 0;
|
||||||
|
|
||||||
startWrite();
|
startWrite();
|
||||||
for (int16_t j = 0; j < h; j++, y++) {
|
for (int16_t j = 0; j < h; j++, y++) {
|
||||||
for (int16_t i = 0; i < w; i++) {
|
for (int16_t i = 0; i < w; i++) {
|
||||||
if (i & 7)
|
if (i & 7)
|
||||||
byte >>= 1;
|
b >>= 1;
|
||||||
else
|
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
|
// Nearly identical to drawBitmap(), only the bit order
|
||||||
// is reversed here (left-to-right = LSB to MSB):
|
// is reversed here (left-to-right = LSB to MSB):
|
||||||
if (byte & 0x01)
|
if (b & 0x01)
|
||||||
writePixel(x + i, y, color);
|
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,
|
const uint8_t mask[], int16_t w,
|
||||||
int16_t h) {
|
int16_t h) {
|
||||||
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
|
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
|
||||||
uint8_t byte = 0;
|
uint8_t b = 0;
|
||||||
startWrite();
|
startWrite();
|
||||||
for (int16_t j = 0; j < h; j++, y++) {
|
for (int16_t j = 0; j < h; j++, y++) {
|
||||||
for (int16_t i = 0; i < w; i++) {
|
for (int16_t i = 0; i < w; i++) {
|
||||||
if (i & 7)
|
if (i & 7)
|
||||||
byte <<= 1;
|
b <<= 1;
|
||||||
else
|
else
|
||||||
byte = pgm_read_byte(&mask[j * bw + i / 8]);
|
b = pgm_read_byte(&mask[j * bw + i / 8]);
|
||||||
if (byte & 0x80) {
|
if (b & 0x80) {
|
||||||
writePixel(x + i, y, (uint8_t)pgm_read_byte(&bitmap[j * w + i]));
|
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,
|
void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y, uint8_t *bitmap,
|
||||||
uint8_t *mask, int16_t w, int16_t h) {
|
uint8_t *mask, int16_t w, int16_t h) {
|
||||||
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
|
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
|
||||||
uint8_t byte = 0;
|
uint8_t b = 0;
|
||||||
startWrite();
|
startWrite();
|
||||||
for (int16_t j = 0; j < h; j++, y++) {
|
for (int16_t j = 0; j < h; j++, y++) {
|
||||||
for (int16_t i = 0; i < w; i++) {
|
for (int16_t i = 0; i < w; i++) {
|
||||||
if (i & 7)
|
if (i & 7)
|
||||||
byte <<= 1;
|
b <<= 1;
|
||||||
else
|
else
|
||||||
byte = mask[j * bw + i / 8];
|
b = mask[j * bw + i / 8];
|
||||||
if (byte & 0x80) {
|
if (b & 0x80) {
|
||||||
writePixel(x + i, y, bitmap[j * w + i]);
|
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[],
|
void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[],
|
||||||
const uint8_t mask[], int16_t w, int16_t h) {
|
const uint8_t mask[], int16_t w, int16_t h) {
|
||||||
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
|
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
|
||||||
uint8_t byte = 0;
|
uint8_t b = 0;
|
||||||
startWrite();
|
startWrite();
|
||||||
for (int16_t j = 0; j < h; j++, y++) {
|
for (int16_t j = 0; j < h; j++, y++) {
|
||||||
for (int16_t i = 0; i < w; i++) {
|
for (int16_t i = 0; i < w; i++) {
|
||||||
if (i & 7)
|
if (i & 7)
|
||||||
byte <<= 1;
|
b <<= 1;
|
||||||
else
|
else
|
||||||
byte = pgm_read_byte(&mask[j * bw + i / 8]);
|
b = pgm_read_byte(&mask[j * bw + i / 8]);
|
||||||
if (byte & 0x80) {
|
if (b & 0x80) {
|
||||||
writePixel(x + i, y, pgm_read_word(&bitmap[j * w + i]));
|
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,
|
void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap,
|
||||||
uint8_t *mask, int16_t w, int16_t h) {
|
uint8_t *mask, int16_t w, int16_t h) {
|
||||||
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
|
int16_t bw = (w + 7) / 8; // Bitmask scanline pad = whole byte
|
||||||
uint8_t byte = 0;
|
uint8_t b = 0;
|
||||||
startWrite();
|
startWrite();
|
||||||
for (int16_t j = 0; j < h; j++, y++) {
|
for (int16_t j = 0; j < h; j++, y++) {
|
||||||
for (int16_t i = 0; i < w; i++) {
|
for (int16_t i = 0; i < w; i++) {
|
||||||
if (i & 7)
|
if (i & 7)
|
||||||
byte <<= 1;
|
b <<= 1;
|
||||||
else
|
else
|
||||||
byte = mask[j * bw + i / 8];
|
b = mask[j * bw + i / 8];
|
||||||
if (byte & 0x80) {
|
if (b & 0x80) {
|
||||||
writePixel(x + i, y, bitmap[j * w + i]);
|
writePixel(x + i, y, bitmap[j * w + i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user