mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
Enable RLE coding for PCX output
Pulled from DarkPlaces's lmp2pcx tool, which I have just been made aware of.
This commit is contained in:
parent
e819ea3b7f
commit
af8c1e4cc2
1 changed files with 12 additions and 7 deletions
|
@ -177,15 +177,20 @@ EncodePCX (byte * data, int width, int height,
|
||||||
data += rowbytes * (height - 1);
|
data += rowbytes * (height - 1);
|
||||||
|
|
||||||
for (i = 0; i < height; i++) {
|
for (i = 0; i < height; i++) {
|
||||||
for (j = 0; j < width; j++) {
|
// from darkplaces lmp2pcx
|
||||||
if ((*data & 0xc0) != 0xc0)
|
for (dataend = data + width; data < dataend; /* empty */) {
|
||||||
*pack++ = *data++;
|
for (pix = *data++, run = 0xC1;
|
||||||
else {
|
data < dataend && run < 0xFF && *data == pix;
|
||||||
*pack++ = 0xc1;
|
data++, run++)
|
||||||
*pack++ = *data++;
|
/* empty */;
|
||||||
}
|
if (run > 0xC1 || pix >= 0xC0)
|
||||||
|
*pack++ = run;
|
||||||
|
*pack++ = pix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (width & 1)
|
||||||
|
*pack++ = 0;
|
||||||
|
|
||||||
data += rowbytes - width;
|
data += rowbytes - width;
|
||||||
if (flip)
|
if (flip)
|
||||||
data -= rowbytes * 2;
|
data -= rowbytes * 2;
|
||||||
|
|
Loading…
Reference in a new issue