[3/4] windowscodecs: Implement CreateBitmapFromMemory.

Dmitry Timoshkov dmitry at baikal.ru
Wed Jan 2 23:42:27 CST 2013


Vincent Povirk <madewokherd at 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.

-- 
Dmitry.



More information about the wine-devel mailing list