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

Function CapturePix

Source/capture.cpp:80–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80static bool CapturePix(WORD width, WORD height, WORD stride, BYTE *pixels, std::ofstream *out)
81{
82 int writeSize;
83 DWORD lpNumBytes;
84 BYTE *pBuffer, *pBufferEnd;
85
86 pBuffer = (BYTE *)DiabloAllocPtr(2 * width);
87 while (height--) {
88 pBufferEnd = CaptureEnc(pixels, pBuffer, width);
89 pixels += stride;
90 writeSize = pBufferEnd - pBuffer;
91 out->write(reinterpret_cast<const char *>(pBuffer), writeSize);
92 if (out->fail()) return false;
93 }
94 mem_free_dbg(pBuffer);
95 return true;
96}
97
98/**
99 * Returns a pointer because in GCC < 5 ofstream itself is not moveable due to a bug.

Callers 1

CaptureScreenFunction · 0.85

Calls 4

DiabloAllocPtrFunction · 0.85
CaptureEncFunction · 0.85
mem_free_dbgFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected