Commit 8a54803c authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

windowscodecs: Implement DdsEncoder_CreateNewFrame on top of DdsEncoder_Dds_CreateNewFrame.

parent bd609f5e
...@@ -2043,39 +2043,10 @@ static HRESULT WINAPI DdsEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -2043,39 +2043,10 @@ static HRESULT WINAPI DdsEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
IWICBitmapFrameEncode **frameEncode, IPropertyBag2 **encoderOptions) IWICBitmapFrameEncode **frameEncode, IPropertyBag2 **encoderOptions)
{ {
DdsEncoder *This = impl_from_IWICBitmapEncoder(iface); DdsEncoder *This = impl_from_IWICBitmapEncoder(iface);
DdsFrameEncode *result;
HRESULT hr;
TRACE("(%p,%p,%p)\n", iface, frameEncode, encoderOptions); TRACE("(%p,%p,%p)\n", iface, frameEncode, encoderOptions);
EnterCriticalSection(&This->lock); return IWICDdsEncoder_CreateNewFrame(&This->IWICDdsEncoder_iface, frameEncode, NULL, NULL, NULL);
if (!This->stream)
{
hr = WINCODEC_ERR_WRONGSTATE;
goto end;
}
result = HeapAlloc(GetProcessHeap(), 0, sizeof(*result));
if (!result)
{
hr = E_OUTOFMEMORY;
goto end;
}
result->IWICBitmapFrameEncode_iface.lpVtbl = &DdsFrameEncode_Vtbl;
result->ref = 1;
result->parent = This;
result->initialized = FALSE;
result->frame_created = FALSE;
IWICBitmapEncoder_AddRef(iface);
*frameEncode = &result->IWICBitmapFrameEncode_iface;
hr = S_OK;
end:
LeaveCriticalSection(&This->lock);
return hr;
} }
static HRESULT WINAPI DdsEncoder_Commit(IWICBitmapEncoder *iface) static HRESULT WINAPI DdsEncoder_Commit(IWICBitmapEncoder *iface)
......
...@@ -1431,15 +1431,11 @@ static void test_dds_encoder_create_frame(void) ...@@ -1431,15 +1431,11 @@ static void test_dds_encoder_create_frame(void)
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame0, NULL); hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame0, NULL);
ok(hr == S_OK, "CreateNewFrame failed, hr %#x\n", hr); ok(hr == S_OK, "CreateNewFrame failed, hr %#x\n", hr);
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame1, NULL); hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame1, NULL);
todo_wine
ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#x\n", hr); ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#x\n", hr);
if (hr == S_OK) IWICBitmapFrameEncode_Release(frame1);
IWICBitmapFrameEncode_Release(frame0); IWICBitmapFrameEncode_Release(frame0);
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame1, NULL); hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame1, NULL);
todo_wine
ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#x\n", hr); ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#x\n", hr);
if (hr == S_OK) IWICBitmapFrameEncode_Release(frame1);
release_encoder(encoder, dds_encoder, stream); release_encoder(encoder, dds_encoder, stream);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment