PNGdec: Don't convert greys if mode=COPY.

patch-pngdec-palette-offset
Phil Howard 2024-03-28 15:35:05 +00:00
rodzic d34e692f51
commit a537672dd4
1 zmienionych plików z 9 dodań i 3 usunięć

Wyświetl plik

@ -190,20 +190,26 @@ mp_event_handle_nowait();
i &= 0xf; i &= 0xf;
if (x & 1) pixel++; if (x & 1) pixel++;
// Just copy the colour into the upper and lower nibble // Just copy the colour into the upper and lower nibble
i = (i << 4) | i; if(current_mode != MODE_COPY) {
i = (i << 4) | i;
}
} else if (pDraw->iBpp == 2) { // 2bpp } else if (pDraw->iBpp == 2) { // 2bpp
i = *pixel; i = *pixel;
i >>= 6 - ((x & 0b11) << 1); i >>= 6 - ((x & 0b11) << 1);
i &= 0x3; i &= 0x3;
if ((x & 0b11) == 0b11) pixel++; if ((x & 0b11) == 0b11) pixel++;
// Evenly spaced 4-colour palette // Evenly spaced 4-colour palette
i = (0xFFB86800 >> (i * 8)) & 0xFF; if(current_mode != MODE_COPY) {
i = (0xFFB86800 >> (i * 8)) & 0xFF;
}
} else { // 1bpp } else { // 1bpp
i = *pixel; i = *pixel;
i >>= 7 - (x & 0b111); i >>= 7 - (x & 0b111);
i &= 0b1; i &= 0b1;
if ((x & 0b111) == 0b111) pixel++; if ((x & 0b111) == 0b111) pixel++;
i = i ? 255 : 0; if(current_mode != MODE_COPY) {
i = i ? 255 : 0;
}
} }
if(x < target->source.x || x >= target->source.x + target->source.w) continue; if(x < target->source.x || x >= target->source.x + target->source.w) continue;