oleaut32: Fix IPicture::SelectPicture to not try to select a bitmap into two DCs at the same time.

This commit is contained in:
Alexandre Julliard 2011-12-16 16:29:12 +01:00
parent 430c8aa910
commit 1e0ab16069
1 changed files with 4 additions and 2 deletions

View File

@ -141,6 +141,7 @@ typedef struct OLEPictureImpl {
BOOL keepOrigFormat;
HDC hDCCur;
HBITMAP stock_bitmap;
/* Bitmap transparency mask */
HBITMAP hbmMask;
@ -219,6 +220,7 @@ static void OLEPictureImpl_SetBitmap(OLEPictureImpl *This)
This->himetricWidth = xpixels_to_himetric(bm.bmWidth, hdcRef);
This->himetricHeight = ypixels_to_himetric(bm.bmHeight, hdcRef);
This->stock_bitmap = GetCurrentObject( hdcRef, OBJ_BITMAP );
DeleteDC(hdcRef);
}
@ -769,10 +771,10 @@ static HRESULT WINAPI OLEPictureImpl_SelectPicture(IPicture *iface,
OLEPictureImpl *This = impl_from_IPicture(iface);
TRACE("(%p)->(%p, %p, %p)\n", This, hdcIn, phdcOut, phbmpOut);
if (This->desc.picType == PICTYPE_BITMAP) {
SelectObject(hdcIn,This->desc.u.bmp.hbitmap);
if (phdcOut)
*phdcOut = This->hDCCur;
if (This->hDCCur) SelectObject(This->hDCCur,This->stock_bitmap);
if (hdcIn) SelectObject(hdcIn,This->desc.u.bmp.hbitmap);
This->hDCCur = hdcIn;
if (phbmpOut)
*phbmpOut = HandleToUlong(This->desc.u.bmp.hbitmap);