|
|
|
|
@ -116,16 +116,15 @@ static BYTE *CaptureEnc(BYTE *src, BYTE *dst, int width)
|
|
|
|
|
static bool CapturePix(const CelOutputBuffer &buf, std::ofstream *out) |
|
|
|
|
{ |
|
|
|
|
int width = buf.w(); |
|
|
|
|
BYTE *pBuffer = (BYTE *)DiabloAllocPtr(2 * width); |
|
|
|
|
auto pBuffer = std::make_unique<BYTE[]>(2 * width); |
|
|
|
|
BYTE *pixels = buf.begin(); |
|
|
|
|
for (int height = buf.h(); height > 0; height--) { |
|
|
|
|
const BYTE *pBufferEnd = CaptureEnc(pixels, pBuffer, width); |
|
|
|
|
const BYTE *pBufferEnd = CaptureEnc(pixels, pBuffer.get(), width); |
|
|
|
|
pixels += buf.pitch(); |
|
|
|
|
out->write(reinterpret_cast<const char *>(pBuffer), pBufferEnd - pBuffer); |
|
|
|
|
out->write(reinterpret_cast<const char *>(pBuffer.get()), pBufferEnd - pBuffer.get()); |
|
|
|
|
if (out->fail()) |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
mem_free_dbg(pBuffer); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|