Vincent Povirk madewokherd@gmail.com wrote:
hr = IWICBitmap_Lock(bitmap, NULL, WICBitmapLockWrite, &lock);
if (SUCCEEDED(hr))
{
UINT buffersize;
BYTE *buffer;
hr = IWICBitmapLock_GetDataPointer(lock, &buffersize, &buffer);
memcpy(buffer, pbBuffer, uiHeight * cbStride);
IWICBitmapLock_Release(lock);
}
It's better to actually check return value of IWICBitmapLock_GetDataPointer before memecpy(), or if that's not supposed to fail drop 'hr' assignment.
My approach to pass buffer directly to BitmapImpl_Create looks much simpler than fiddling with IWICBitmap_Lock IMHO.