1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +00:00

Add support for 4 pixels per plane

This commit is contained in:
karri 2022-12-29 19:28:16 +02:00
parent 817d129be8
commit e953c1aa08

View File

@ -230,109 +230,109 @@ static void ReadPlane (FILE* F, PCXHeader* P, unsigned char* L)
/* Write the data to the buffer */
switch (P->BPP) {
default:
for (i = 0; i < C; i++) {
for (i = 0; i < C; i++) {
if (WidthCounter > 0) {
*L = B;
*L = B;
L += 1;
WidthCounter -= 1;
}
Remaining -= 1;
}
}
break;
case 4:
for (i = 0; i < C; i++) {
for (i = 0; i < C; i++) {
if (WidthCounter > 0) {
*L = B >> 4;
*L = B >> 4;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = B & 15;
*L = B & 15;
L += 1;
WidthCounter -= 1;
}
Remaining -= 1;
}
}
break;
case 2:
for (i = 0; i < C; i++) {
for (i = 0; i < C; i++) {
if (WidthCounter > 0) {
*L = (B >> 6) & 3;
*L = (B >> 6) & 3;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = (B >> 4) & 3;
*L = (B >> 4) & 3;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = (B >> 2) & 3;
*L = (B >> 2) & 3;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = B & 3;
*L = B & 3;
L += 1;
WidthCounter -= 1;
}
Remaining -= 1;
}
}
break;
case 1:
for (i = 0; i < C; i++) {
for (i = 0; i < C; i++) {
if (WidthCounter > 0) {
*L = (B >> 7) & 1;
*L = (B >> 7) & 1;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = (B >> 6) & 1;
*L = (B >> 6) & 1;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = (B >> 5) & 1;
*L = (B >> 5) & 1;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = (B >> 4) & 1;
*L = (B >> 4) & 1;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = (B >> 3) & 1;
*L = (B >> 3) & 1;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = (B >> 2) & 1;
*L = (B >> 2) & 1;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = (B >> 1) & 1;
*L = (B >> 1) & 1;
L += 1;
WidthCounter -= 1;
}
if (WidthCounter > 0) {
*L = B & 1;
*L = B & 1;
L += 1;
WidthCounter -= 1;
}
Remaining -= 1;
}
}
break;
}
}
}
} else {
/* Just read one line */
if (P->BPP == 4) {
printf("Not implemented\n");
} else {
printf("Not implemented\n");
} else {
ReadData (F, L, P->Width);
}
}
}
}