useMask = FALSE;
}
}
-
if ( useMask )
{
#ifdef __WIN32__
{
HDC cdc = GetHdc();
HDC hdcMem = ::CreateCompatibleDC(GetHdc());
- ::SelectObject(hdcMem, GetHbitmapOf(bmp));
-
+ HGDIOBJ hOldBitmap = ::SelectObject(hdcMem, GetHbitmapOf(bmp));
#if wxUSE_PALETTE
wxPalette *pal = bmp.GetPalette();
if ( pal && ::GetDeviceCaps(cdc,BITSPIXEL) <= 8 )
::SelectPalette(hdcMem, oldPal, FALSE);
#endif // wxUSE_PALETTE
+ ::SelectObject(hdcMem, hOldBitmap);
::DeleteDC(hdcMem);
}
}
#if wxUSE_PALETTE
- wxPalette *pal = bmp.GetPalette();
- if ( pal && ::GetDeviceCaps(cdc,BITSPIXEL) <= 8 )
- {
- oldPal = ::SelectPalette(memdc, GetHpaletteOf(pal), FALSE);
- ::RealizePalette(memdc);
- }
+ wxPalette *pal = bmp.GetPalette();
+ if ( pal && ::GetDeviceCaps(cdc,BITSPIXEL) <= 8 )
+ {
+ oldPal = ::SelectPalette(memdc, GetHpaletteOf(pal), FALSE);
+ ::RealizePalette(memdc);
+ }
#endif // wxUSE_PALETTE
- ::SelectObject( memdc, hbitmap );
+ HGDIOBJ hOldBitmap = ::SelectObject( memdc, hbitmap );
::BitBlt( cdc, x, y, width, height, memdc, 0, 0, SRCCOPY);
#if wxUSE_PALETTE
::SelectPalette(memdc, oldPal, FALSE);
#endif // wxUSE_PALETTE
+ ::SelectObject( memdc, hOldBitmap );
::DeleteDC( memdc );
::SetTextColor(GetHdc(), old_textground);
if ( stipple && stipple->Ok() )
{
#ifdef __WIN32__
- ::SetBrushOrgEx(GetHdc(),
+ ::SetBrushOrgEx(GetHdc(),
m_deviceOriginX % stipple->GetWidth(),
m_deviceOriginY % stipple->GetHeight(),
NULL); // don't need previous brush origin
#else
- ::SetBrushOrg(GetHdc(),
+ ::SetBrushOrg(GetHdc(),
m_deviceOriginX % stipple->GetWidth(),
m_deviceOriginY % stipple->GetHeight());
#endif
// SetBackgroundColour now only refers to text background
// and m_backgroundMode is used there
-
-/*
- if (m_backgroundMode == wxTRANSPARENT)
- ::SetBkMode(GetHdc(), TRANSPARENT);
- else
- ::SetBkMode(GetHdc(), OPAQUE);
- Last change: AC 29 Jan 101 8:54 pm
-*/
}
void wxDC::SetLogicalFunction(int function)
#ifdef __WXMICROWIN__
if (!GetHDC())
{
- if (x) *x = 0;
- if (y) *y = 0;
- if (descent) *descent = 0;
- if (externalLeading) *externalLeading = 0;
- return;
+ if (x) *x = 0;
+ if (y) *y = 0;
+ if (descent) *descent = 0;
+ if (externalLeading) *externalLeading = 0;
+ return;
}
-#endif
+#endif // __WXMICROWIN__
HFONT hfontOld;
if ( font )
dc_buffer = ::CreateCompatibleDC(GetHdc());
buffer_bmap = ::CreateCompatibleBitmap(GetHdc(), width, height);
#endif // wxUSE_DC_CACHEING/!wxUSE_DC_CACHEING
- ::SelectObject(dc_mask, (HBITMAP) mask->GetMaskBitmap());
- ::SelectObject(dc_buffer, buffer_bmap);
+ HGDIOBJ hOldMaskBitmap = ::SelectObject(dc_mask, (HBITMAP) mask->GetMaskBitmap());
+ HGDIOBJ hOldBufferBitmap = ::SelectObject(dc_buffer, buffer_bmap);
// copy dest to buffer
if ( !::BitBlt(dc_buffer, 0, 0, (int)width, (int)height,
}
// tidy up temporary DCs and bitmap
- ::SelectObject(dc_mask, 0);
- ::SelectObject(dc_buffer, 0);
+ ::SelectObject(dc_mask, hOldMaskBitmap);
+ ::SelectObject(dc_buffer, hOldBufferBitmap);
#if !wxUSE_DC_CACHEING
{