mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
waveshare: fix multiple issues in BMP RGB handling
This commit is contained in:
parent
aa756aa493
commit
b4aebd140a
1 changed files with 5 additions and 3 deletions
|
@ -195,14 +195,14 @@ static int read_bmp_rgb(const uint8_t *bmp, const size_t bmpsize, uint8_t **blac
|
||||||
for (X = 0; X < pbmpheader->BMP_Width; X++) { // lines
|
for (X = 0; X < pbmpheader->BMP_Width; X++) { // lines
|
||||||
B = bmp[offset++];
|
B = bmp[offset++];
|
||||||
G = bmp[offset++];
|
G = bmp[offset++];
|
||||||
G = bmp[offset++];
|
R = bmp[offset++];
|
||||||
if (R < 30 && G < 30 && B < 30) {
|
if (R < 128 && G < 128 && B < 128) {
|
||||||
Black_data = Black_data | (1);
|
Black_data = Black_data | (1);
|
||||||
} else if (R > 190 && G < 90 && B < 90) {
|
} else if (R > 190 && G < 90 && B < 90) {
|
||||||
Red_data = Red_data | (1);
|
Red_data = Red_data | (1);
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
if (count >= 8) {
|
if ((count >= 8) || (X == pbmpheader->BMP_Width - 1)) {
|
||||||
(*black)[X / 8 + (pbmpheader->BMP_Height - Y - 1) * Image_Width_Byte] = ~Black_data;
|
(*black)[X / 8 + (pbmpheader->BMP_Height - Y - 1) * Image_Width_Byte] = ~Black_data;
|
||||||
(*red)[X / 8 + (pbmpheader->BMP_Height - Y - 1) * Image_Width_Byte] = ~Red_data;
|
(*red)[X / 8 + (pbmpheader->BMP_Height - Y - 1) * Image_Width_Byte] = ~Red_data;
|
||||||
count = 0;
|
count = 0;
|
||||||
|
@ -212,6 +212,8 @@ static int read_bmp_rgb(const uint8_t *bmp, const size_t bmpsize, uint8_t **blac
|
||||||
Black_data = Black_data << 1;
|
Black_data = Black_data << 1;
|
||||||
Red_data = Red_data << 1;
|
Red_data = Red_data << 1;
|
||||||
}
|
}
|
||||||
|
// Skip BMP line padding
|
||||||
|
offset+=(((pbmpheader->BMP_Width*3/4)+1)*4)-pbmpheader->BMP_Width*3;
|
||||||
}
|
}
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue