From 05766d4bfecddc4e4cd4d468c945ee142a5c163d Mon Sep 17 00:00:00 2001 From: karri Date: Thu, 29 Dec 2022 19:40:00 +0200 Subject: [PATCH] Add support for 4 pixels per plane --- src/sp65/pcx.c | 54 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/sp65/pcx.c b/src/sp65/pcx.c index 4beda045c..519f3bd58 100644 --- a/src/sp65/pcx.c +++ b/src/sp65/pcx.c @@ -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; } + 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); - } + } } }