| 78 | } |
| 79 | |
| 80 | static 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. |
no test coverage detected