else // create a DDB
#endif
{
- if ( d == -1 )
- d = wxDisplayDepth();
-
- GetBitmapData()->m_depth = d;
#ifndef __WXMICROWIN__
if ( d > 0 )
p = rowStart;
p.OffsetY(data, 1);
}
+ }
- // if we're a DDB we need to convert DIB back to DDB now to make the
- // changes made via raw bitmap access effective
- if ( !GetBitmapData()->m_isDIB )
- {
- wxDIB *dib = GetBitmapData()->m_dib;
- GetBitmapData()->m_dib = NULL;
+ // if we're a DDB we need to convert DIB back to DDB now to make the
+ // changes made via raw bitmap access effective
+ if ( !GetBitmapData()->m_isDIB )
+ {
+ wxDIB *dib = GetBitmapData()->m_dib;
+ GetBitmapData()->m_dib = NULL;
- // TODO: convert
+ // TODO: convert
- delete dib;
- }
+ delete dib;
}
-#endif
+#endif // wxUSE_WXDIB
}
#endif // #ifdef wxHAVE_RAW_BITMAP
HPALETTE hPal, LPBITMAPINFO* lpDIBHeader)
{
unsigned long i, headerSize;
- LPBITMAPINFO lpDIBheader = NULL;
- LPPALETTEENTRY lpPe = NULL;
-
// Allocate space for a DIB header
headerSize = (sizeof(BITMAPINFOHEADER) + (256 * sizeof(PALETTEENTRY)));
- lpDIBheader = (BITMAPINFO *) malloc(headerSize);
- lpPe = (PALETTEENTRY *)((BYTE*)lpDIBheader + sizeof(BITMAPINFOHEADER));
+ LPBITMAPINFO lpDIBheader = (BITMAPINFO *) malloc(headerSize);
+ LPPALETTEENTRY lpPe = (PALETTEENTRY *)((BYTE*)lpDIBheader + sizeof(BITMAPINFOHEADER));
GetPaletteEntries(hPal, 0, 256, lpPe);
wxLogLastError(wxT("CreateBitmap"));
}
- ::SelectObject(hdcSrc, hbmpMask);
- ::SelectObject(hdcDst, hbmpInvMask);
+ HGDIOBJ srcTmp = ::SelectObject(hdcSrc, hbmpMask);
+ HGDIOBJ dstTmp = ::SelectObject(hdcDst, hbmpInvMask);
if ( !::BitBlt(hdcDst, 0, 0, w, h,
hdcSrc, 0, 0,
NOTSRCCOPY) )
wxLogLastError(wxT("BitBlt"));
}
+ // Deselect objects
+ SelectObject(hdcSrc,srcTmp);
+ SelectObject(hdcDst,dstTmp);
+
::DeleteDC(hdcSrc);
::DeleteDC(hdcDst);