oleaut32: Calculate icon data if the picture is dirty, or there's no icon data.

This commit is contained in:
Mike McCormack 2006-08-14 14:07:30 +09:00 committed by Alexandre Julliard
parent cbfc35602e
commit eb9f46037c
1 changed files with 19 additions and 28 deletions

View File

@ -1826,31 +1826,21 @@ static HRESULT WINAPI OLEPictureImpl_Save(
unsigned int iDataSize;
ULONG dummy;
int iSerializeResult = 0;
OLEPictureImpl *This = impl_from_IPersistStream(iface);
TRACE("%p %p %d\n", This, pStm, fClearDirty);
switch (This->desc.picType) {
case PICTYPE_ICON:
if (This->bIsDirty) {
if (serializeIcon(This->desc.u.icon.hicon, &pIconData, &iDataSize)) {
if (This->loadtime_magic != 0xdeadbeef) {
DWORD header[2];
header[0] = This->loadtime_magic;
header[1] = iDataSize;
IStream_Write(pStm, header, 2 * sizeof(DWORD), &dummy);
if (This->bIsDirty || !This->data) {
if (!serializeIcon(This->desc.u.icon.hicon, &pIconData, &iDataSize)) {
ERR("(%p,%p,%d), serializeIcon() failed\n", This, pStm, fClearDirty);
hResult = E_FAIL;
break;
}
IStream_Write(pStm, pIconData, iDataSize, &dummy);
HeapFree(GetProcessHeap(), 0, This->data);
This->data = pIconData;
This->datalen = iDataSize;
hResult = S_OK;
} else {
FIXME("(%p,%p,%d), unable to serializeIcon()!\n",This,pStm,fClearDirty);
hResult = E_FAIL;
}
} else {
if (This->loadtime_magic != 0xdeadbeef) {
DWORD header[2];
@ -1859,8 +1849,9 @@ static HRESULT WINAPI OLEPictureImpl_Save(
IStream_Write(pStm, header, 2 * sizeof(DWORD), &dummy);
}
IStream_Write(pStm, This->data, This->datalen, &dummy);
HeapFree(GetProcessHeap(), 0, This->data);
hResult = S_OK;
}
break;
case PICTYPE_BITMAP:
if (This->bIsDirty) {