+// Windows CE doesn't have GetDIBits() so use an alternative implementation
+// for it
+//
+// in fact I'm not sure if GetDIBits() is really much better than using
+// BitBlt() like this -- it should be faster but I didn't do any tests, if
+// anybody has time to do them and by chance finds that GetDIBits() is not
+// much faster than BitBlt(), we could always use the Win CE version here
+#ifdef __WXWINCE__
+
+bool wxDIB::CopyFromDDB(HBITMAP hbmp)
+{
+ MemoryHDC hdcSrc;
+ if ( !hdcSrc )
+ return false;
+
+ SelectInHDC selectSrc(hdcSrc, hbmp);
+ if ( !selectSrc )
+ return false;
+
+ MemoryHDC hdcDst;
+ if ( !hdcDst )
+ return false;
+
+ SelectInHDC selectDst(hdcDst, m_handle);
+ if ( !selectDst )
+ return false;
+
+
+ if ( !::BitBlt(
+ hdcDst,
+ 0, 0, m_width, m_height,
+ hdcSrc,
+ 0, 0,
+ SRCCOPY
+ ) )
+ {
+ wxLogLastError(_T("BitBlt(DDB -> DIB)"));
+
+ return false;
+ }
+
+ return true;
+}
+
+#else // !__WXWINCE__
+
+bool wxDIB::CopyFromDDB(HBITMAP hbmp)
+{
+ DIBSECTION ds;
+ if ( !GetDIBSection(m_handle, &ds) )
+ {
+ // we're sure that our handle is a DIB section, so this should work
+ wxFAIL_MSG( _T("GetObject(DIBSECTION) unexpectedly failed") );
+
+ return false;
+ }
+
+ if ( !::GetDIBits
+ (
+ ScreenHDC(), // the DC to use
+ hbmp, // the source DDB
+ 0, // first scan line
+ m_height, // number of lines to copy
+ ds.dsBm.bmBits, // pointer to the buffer
+ (BITMAPINFO *)&ds.dsBmih, // bitmap header
+ DIB_RGB_COLORS // and not DIB_PAL_COLORS
+ ) )
+ {
+ wxLogLastError(wxT("GetDIBits()"));
+
+ return false;