windowscodecs: More complete implementation of DdsFrameDecode_CopyPixels().
Signed-off-by: Ziqing Hui <zhui@codeweavers.com> Signed-off-by: Esme Povirk <esme@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1b4318b14c
commit
3f082762f8
|
@ -607,21 +607,20 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
|
|||
if (!prc) {
|
||||
if (cbStride < frame_stride) return E_INVALIDARG;
|
||||
if (cbBufferSize < frame_size) return WINCODEC_ERR_INSUFFICIENTBUFFER;
|
||||
return S_OK;
|
||||
} else {
|
||||
x = prc->X;
|
||||
y = prc->Y;
|
||||
width = prc->Width;
|
||||
height = prc->Height;
|
||||
if (x < 0 || y < 0 || width <= 0 || height <= 0 ||
|
||||
x + width > This->info.width ||
|
||||
y + height > This->info.height) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
if (cbStride < width * bpp / 8) return E_INVALIDARG;
|
||||
if (cbBufferSize < cbStride * height) return WINCODEC_ERR_INSUFFICIENTBUFFER;
|
||||
}
|
||||
|
||||
x = prc->X;
|
||||
y = prc->Y;
|
||||
width = prc->Width;
|
||||
height = prc->Height;
|
||||
if (x < 0 || y < 0 || width <= 0 || height <= 0 ||
|
||||
x + width > This->info.width ||
|
||||
y + height > This->info.height) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
if (cbStride < width * bpp / 8) return E_INVALIDARG;
|
||||
if (cbBufferSize < cbStride * height) return WINCODEC_ERR_INSUFFICIENTBUFFER;
|
||||
|
||||
EnterCriticalSection(&This->lock);
|
||||
|
||||
if (!This->pixel_data) {
|
||||
|
@ -632,6 +631,9 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
|
|||
}
|
||||
}
|
||||
|
||||
hr = copy_pixels(bpp, This->pixel_data, This->info.width, This->info.height, frame_stride,
|
||||
prc, cbStride, cbBufferSize, pbBuffer);
|
||||
|
||||
end:
|
||||
LeaveCriticalSection(&This->lock);
|
||||
|
||||
|
|
Loading…
Reference in New Issue