Commit 28598cca authored by Alexandre Julliard's avatar Alexandre Julliard

Revert "oleaut32: Implement a better stub for IPicture::SaveAsFile."

This reverts commit 212dd9c2. It's causing test failures in gdiplus. This will need to be redone properly after 1.8.
parent 7f06cd4c
......@@ -834,6 +834,19 @@ static HRESULT WINAPI OLEPictureImpl_PictureChanged(IPicture *iface)
}
/************************************************************************
* OLEPictureImpl_SaveAsFile
*/
static HRESULT WINAPI OLEPictureImpl_SaveAsFile(IPicture *iface,
IStream *pstream,
BOOL SaveMemCopy,
LONG *pcbSize)
{
OLEPictureImpl *This = impl_from_IPicture(iface);
FIXME("(%p)->(%p, %d, %p), hacked stub.\n", This, pstream, SaveMemCopy, pcbSize);
return IStream_Write(pstream,This->data,This->datalen,(ULONG*)pcbSize);
}
/************************************************************************
* OLEPictureImpl_get_Attributes
*/
static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface,
......@@ -1846,85 +1859,6 @@ static HRESULT WINAPI OLEPictureImpl_GetSizeMax(
return E_NOTIMPL;
}
/************************************************************************
* OLEPictureImpl_SaveAsFile
*/
static HRESULT WINAPI OLEPictureImpl_SaveAsFile(IPicture *iface,
IStream *stream, BOOL mem_copy, LONG *size)
{
OLEPictureImpl *This = impl_from_IPicture(iface);
void *data;
unsigned data_size;
ULONG written;
HRESULT hr;
FIXME("(%p)->(%p,%d,%p): semi-stub\n", This, stream, mem_copy, size);
switch (This->desc.picType)
{
case PICTYPE_NONE:
return S_OK;
case PICTYPE_ICON:
if (!mem_copy) return E_FAIL;
if (This->bIsDirty || !This->data)
{
if (!serializeIcon(This->desc.u.icon.hicon, &data, &data_size))
return E_FAIL;
HeapFree(GetProcessHeap(), 0, This->data);
This->data = data;
This->datalen = data_size;
}
hr = IStream_Write(stream, This->data, This->datalen, &written);
if (hr == S_OK && size) *size = written;
return hr;
case PICTYPE_BITMAP:
if (!mem_copy) return E_FAIL;
if (This->bIsDirty || !This->data)
{
switch (This->keepOrigFormat ? This->loadtime_format : BITMAP_FORMAT_BMP)
{
case BITMAP_FORMAT_BMP:
if (!serializeBMP(This->desc.u.bmp.hbitmap, &data, &data_size))
return E_FAIL;
break;
case BITMAP_FORMAT_JPEG:
FIXME("BITMAP_FORMAT_JPEG is not implemented\n");
return E_NOTIMPL;
case BITMAP_FORMAT_GIF:
FIXME("BITMAP_FORMAT_GIF is not implemented\n");
return E_NOTIMPL;
case BITMAP_FORMAT_PNG:
FIXME("BITMAP_FORMAT_PNG is not implemented\n");
return E_NOTIMPL;
default:
FIXME("PICTYPE_BITMAP/%#x is not implemented\n", This->loadtime_format);
return E_NOTIMPL;
}
HeapFree(GetProcessHeap(), 0, This->data);
This->data = data;
This->datalen = data_size;
}
hr = IStream_Write(stream, This->data, This->datalen, &written);
if (hr == S_OK && size) *size = written;
return hr;
case PICTYPE_METAFILE:
FIXME("PICTYPE_METAFILE is not implemented\n");
return E_NOTIMPL;
case PICTYPE_ENHMETAFILE:
FIXME("ENHMETAFILE is not implemented\n");
return E_NOTIMPL;
default:
FIXME("%#x is not implemented\n", This->desc.picType);
break;
}
return E_NOTIMPL;
}
/************************************************************************
* IDispatch
......
......@@ -1079,14 +1079,18 @@ static void test_load_save_bmp(void)
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size);
ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
todo_wine
ok(size == 66, "expected 66, got %d\n", size);
mem = GlobalLock(hmem);
todo_wine
ok(!memcmp(&mem[0], "BM", 2), "got wrong bmp header %04x\n", mem[0]);
GlobalUnlock(hmem);
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size);
todo_wine
ok(hr == E_FAIL, "expected E_FAIL, got %#x\n", hr);
todo_wine
ok(size == -1, "expected -1, got %d\n", size);
offset.QuadPart = 0;
......@@ -1153,12 +1157,15 @@ static void test_load_save_icon(void)
todo_wine
ok(size == 766, "expected 766, got %d\n", size);
mem = GlobalLock(hmem);
todo_wine
ok(mem[0] == 0x00010000, "got wrong icon header %04x\n", mem[0]);
GlobalUnlock(hmem);
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size);
todo_wine
ok(hr == E_FAIL, "expected E_FAIL, got %#x\n", hr);
todo_wine
ok(size == -1, "expected -1, got %d\n", size);
offset.QuadPart = 0;
......@@ -1224,11 +1231,13 @@ static void test_load_save_empty_picture(void)
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size);
ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
todo_wine
ok(size == -1, "expected -1, got %d\n", size);
size = -1;
hr = IPicture_SaveAsFile(pic, dst_stream, FALSE, &size);
ok(hr == S_OK, "IPicture_SaveasFile error %#x\n", hr);
todo_wine
ok(size == -1, "expected -1, got %d\n", size);
hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_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