From c8b3138e739f8740eac06e59b3a20127528a5253 Mon Sep 17 00:00:00 2001 From: michaelp Date: Tue, 5 May 1998 22:39:19 +0000 Subject: [PATCH] when selecting a bitmap into a drawing surface, we now reselect the bitmap that used to be there when we're done. git-svn-id: svn://10.0.0.236/trunk@1164 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/windows/nsImageWin.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mozilla/gfx/src/windows/nsImageWin.cpp b/mozilla/gfx/src/windows/nsImageWin.cpp index 106ffcda2e6..9b826c38a01 100644 --- a/mozilla/gfx/src/windows/nsImageWin.cpp +++ b/mozilla/gfx/src/windows/nsImageWin.cpp @@ -162,11 +162,14 @@ PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurfa if (NULL != srcdc) { - SelectObject(srcdc, mHBitmap); + HBITMAP oldbits = ::SelectObject(srcdc, mHBitmap); if (!::StretchBlt(the_hdc, aDX, aDY, aDWidth, aDHeight, srcdc, aSX, aSY, aSWidth, aSHeight, SRCCOPY)) error = ::GetLastError(); + + if (nsnull != oldbits) + ::SelectObject(srcdc, oldbits); } NS_RELEASE(dx); @@ -203,13 +206,16 @@ PRBool nsImageWin :: Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurfa if (NULL != srcdc) { - SelectObject(srcdc, mHBitmap); + HBITMAP oldbits = ::SelectObject(srcdc, mHBitmap); //if((aWidth == mBHead->biWidth) && (aHeight == mBHead->biHeight)) //BitBlt(the_hdc,aX,aY,aWidth,aHeight,mOptimizeDC,0,0,SRCCOPY); if (!::StretchBlt(the_hdc, aX, aY, aWidth, aHeight, srcdc, 0, 0, mBHead->biWidth, mBHead->biHeight, SRCCOPY)) error = ::GetLastError(); + + if (nsnull != oldbits) + ::SelectObject(srcdc, oldbits); } NS_RELEASE(dx);