MCPcopy Create free account
hub / github.com/diasurgical/devilution / CaptureEnc

Function CaptureEnc

Source/capture.cpp:46–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46static BYTE *CaptureEnc(BYTE *src, BYTE *dst, int width)
47{
48 int rleLength;
49
50 do {
51 BYTE rlePixel = *src;
52 *src++;
53 rleLength = 1;
54
55 width--;
56
57 while (rlePixel == *src) {
58 if (rleLength >= 63)
59 break;
60 if (!width)
61 break;
62 rleLength++;
63
64 width--;
65 src++;
66 }
67
68 if (rleLength > 1 || rlePixel > 0xBF) {
69 *dst = rleLength | 0xC0;
70 *dst++;
71 }
72
73 *dst = rlePixel;
74 *dst++;
75 } while (width);
76
77 return dst;
78}
79
80static bool CapturePix(WORD width, WORD height, WORD stride, BYTE *pixels, std::ofstream *out)
81{

Callers 1

CapturePixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected