X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/66e23ad2081689dad6e829b9667cdbc93ac45154..09e48f0b1917db7e455f28c2c9ed661d39e9ab65:/src/msw/bitmap.cpp?ds=sidebyside diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 79b21b8e87..c7dc1834fd 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -43,7 +43,10 @@ #include "wx/msw/private.h" #include "wx/log.h" +#if !defined(__WXMICROWIN__) #include "wx/msw/dib.h" +#endif + #include "wx/image.h" #include "wx/xpmdecod.h" @@ -112,6 +115,7 @@ void wxBitmap::Init() bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) { +#ifndef __WXMICROWIN__ // it may be either HICON or HCURSOR HICON hicon = (HICON)icon.GetHandle(); @@ -145,6 +149,9 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) #endif // WXWIN_COMPATIBILITY_2 return TRUE; +#else + return FALSE; +#endif } #endif // Win32 @@ -219,6 +226,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) { Init(); +#ifndef __WXMICROWIN__ wxBitmapRefData *refData = new wxBitmapRefData; m_refData = refData; @@ -279,6 +287,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) } SetHBITMAP((WXHBITMAP)hbmp); +#endif } // Create from XPM data @@ -294,9 +303,6 @@ bool wxBitmap::CreateFromXpm(const char **data) wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") ) *this = wxBitmap(img); - - if ( wxTheBitmapList ) wxTheBitmapList->AddBitmap(this); - return TRUE; #else return FALSE; @@ -326,6 +332,7 @@ wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type) bool wxBitmap::Create(int w, int h, int d) { +#ifndef __WXMICROWIN__ UnRef(); m_refData = new wxBitmapRefData; @@ -361,8 +368,10 @@ bool wxBitmap::Create(int w, int h, int d) #if WXWIN_COMPATIBILITY_2 GetBitmapData()->m_ok = hbmp != 0; #endif // WXWIN_COMPATIBILITY_2 - return Ok(); +#else + return FALSE; +#endif } // ---------------------------------------------------------------------------- @@ -373,6 +382,10 @@ bool wxBitmap::Create(int w, int h, int d) bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) { +#ifdef __WXMICROWIN__ + // TODO + return FALSE; +#else wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") ) m_refData = new wxBitmapRefData(); @@ -595,10 +608,15 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); return TRUE; +#endif } wxImage wxBitmap::ConvertToImage() const { +#ifdef __WXMICROWIN__ + // TODO + return wxImage(); +#else wxImage image; wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") ); @@ -723,6 +741,7 @@ wxImage wxBitmap::ConvertToImage() const free(lpBits); return image; +#endif } #endif // wxUSE_IMAGE @@ -802,6 +821,7 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const { +#ifndef __WXMICROWIN__ wxCHECK_MSG( Ok() && (rect.x >= 0) && (rect.y >= 0) && (rect.x+rect.width <= GetWidth()) && @@ -837,6 +857,9 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const DeleteDC(dcSrc); return ret; +#else + return wxBitmap(); +#endif } // ---------------------------------------------------------------------------- @@ -879,6 +902,9 @@ void wxBitmap::SetMask(wxMask *mask) // Contributed by Frederic Villeneuve wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const { +#ifdef __WXMICROWIN__ + return wxBitmap(); +#else wxMemoryDC memDC; wxBitmap tmpBitmap(GetWidth(), GetHeight(), dc.GetDepth()); HPALETTE hPal = (HPALETTE) NULL; @@ -923,6 +949,7 @@ wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const wxFreeDIB(lpDib); return tmpBitmap; +#endif } // ---------------------------------------------------------------------------- @@ -966,6 +993,7 @@ wxMask::~wxMask() // Create a mask from a mono bitmap (copies the bitmap). bool wxMask::Create(const wxBitmap& bitmap) { +#ifndef __WXMICROWIN__ wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, FALSE, _T("can't create mask from invalid or not monochrome bitmap") ); @@ -990,6 +1018,9 @@ bool wxMask::Create(const wxBitmap& bitmap) SelectObject(destDC, 0); DeleteDC(destDC); return TRUE; +#else + return FALSE; +#endif } // Create a mask from a bitmap and a palette index indicating @@ -1017,6 +1048,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) // the transparent area bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) { +#ifndef __WXMICROWIN__ wxCHECK_MSG( bitmap.Ok(), FALSE, _T("invalid bitmap in wxMask::Create") ); if ( m_maskBitmap ) @@ -1042,6 +1074,10 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) bool ok = TRUE; + // SelectObject() will fail + wxASSERT_MSG( !bitmap.GetSelectedInto(), + _T("bitmap can't be selected in another DC") ); + HGDIOBJ hbmpSrcOld = ::SelectObject(srcDC, GetHbitmapOf(bitmap)); if ( !hbmpSrcOld ) { @@ -1092,6 +1128,9 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) ::DeleteDC(destDC); return ok; +#else + return FALSE; +#endif } // ---------------------------------------------------------------------------- @@ -1158,6 +1197,7 @@ bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), // DIB functions // ---------------------------------------------------------------------------- +#ifndef __WXMICROWIN__ bool wxCreateDIB(long xSize, long ySize, long bitsPerPixel, HPALETTE hPal, LPBITMAPINFO* lpDIBHeader) { @@ -1205,6 +1245,7 @@ void wxFreeDIB(LPBITMAPINFO lpDIBHeader) { free(lpDIBHeader); } +#endif // ---------------------------------------------------------------------------- // other helper functions @@ -1212,6 +1253,7 @@ void wxFreeDIB(LPBITMAPINFO lpDIBHeader) extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) { +#ifndef __WXMICROWIN__ wxCHECK_MSG( hbmpMask, 0, _T("invalid bitmap in wxInvertMask") ); // get width/height from the bitmap if not given @@ -1249,4 +1291,7 @@ extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) ::DeleteDC(hdcDst); return hbmpInvMask; +#else + return 0; +#endif }