]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/bitmap.cpp
correct bug with using uninitialized end variable (unused variable warnings are not...
[wxWidgets.git] / src / os2 / bitmap.cpp
index 8a599bea4d0b7d7b78d141ed3f14c949053a4846..6f9f968eb15b10a42afbdb162d7b21327a2fe48d 100644 (file)
@@ -27,6 +27,7 @@
     #include "wx/image.h"
 #endif
 
+#include "wx/os2/dc.h"
 #include "wx/os2/private.h"
 
 #include "wx/xpmdecod.h"
@@ -96,7 +97,7 @@ void wxBitmapRefData::Free()
 
 wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const
 {
-    return new wxBitmapRefData(*wx_static_cast(const wxBitmapRefData *, data));
+    return new wxBitmapRefData(*static_cast<const wxBitmapRefData *>(data));
 }
 
 // this function should be called from all wxBitmap ctors
@@ -275,22 +276,9 @@ wxBitmap::wxBitmap(
     SetHBITMAP((WXHBITMAP)hBmp);
 } // end of wxBitmap::wxBitmap
 
-wxBitmap::wxBitmap(
-  int                               nW
-, int                               nH
-, int                               nD
-)
-{
-    Init();
-    (void)Create( nW
-                 ,nH
-                 ,nD
-                );
-} // end of wxBitmap::wxBitmap
-
 wxBitmap::wxBitmap(
   const void*                       pData
-, long                              lType
+, wxBitmapType                      lType
 , int                               nWidth
 , int                               nHeight
 , int                               nDepth
@@ -308,12 +296,12 @@ wxBitmap::wxBitmap(
 
 wxBitmap::wxBitmap(
   int                               nId
-, long                              lType
+, wxBitmapType                      lType
 )
 {
     Init();
     LoadFile( nId
-             ,(int)lType
+             ,lType
             );
     SetId(nId);
 } // end of wxBitmap::wxBitmap
@@ -398,7 +386,7 @@ bool wxBitmap::Create(
     return Ok();
 } // end of wxBitmap::Create
 
-bool wxBitmap::LoadFile(const wxString& filename, long type)
+bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
 {
     UnRef();
 
@@ -428,7 +416,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type)
 
 bool wxBitmap::LoadFile(
   int                               nId
-, long                              lType
+, wxBitmapType                      lType
 )
 {
     UnRef();
@@ -456,7 +444,7 @@ bool wxBitmap::LoadFile(
 
 bool wxBitmap::Create(
   const void*                       pData
-, long                              lType
+, wxBitmapType                      lType
 , int                               nWidth
 , int                               nHeight
 , int                               nDepth
@@ -488,7 +476,7 @@ bool wxBitmap::Create(
 
 bool wxBitmap::SaveFile(
   const wxString&                   rFilename
-, int                               lType
+, wxBitmapType                      lType
 , const wxPalette*                  pPalette
 )
 {
@@ -928,9 +916,12 @@ wxImage wxBitmap::ConvertToImage() const
     //
     // May already be selected into a PS
     //
-    if ((pDC = GetSelectedInto()) != NULL)
+    pDC = GetSelectedInto();
+    const wxPMDCImpl *impl; 
+    if (pDC != NULL &&
+        (impl = wxDynamicCast( pDC->GetImpl(), wxPMDCImpl )) != NULL)
     {
-        hPSMem = pDC->GetHPS();
+        hPSMem = impl->GetHPS();
     }
     else
     {
@@ -1453,7 +1444,7 @@ bool wxMask::Create(
 
 bool wxBitmapHandler::Create( wxGDIImage* pImage,
                               const void* pData,
-                              long        WXUNUSED(lFlags),
+                              wxBitmapType lType,
                               int         nWidth,
                               int         nHeight,
                               int         nDepth)
@@ -1464,6 +1455,7 @@ bool wxBitmapHandler::Create( wxGDIImage* pImage,
 
     return(pBitmap ? Create( pBitmap
                             ,pData
+                            ,lType
                             ,nWidth
                             ,nHeight
                             ,nDepth
@@ -1473,7 +1465,7 @@ bool wxBitmapHandler::Create( wxGDIImage* pImage,
 bool wxBitmapHandler::Load(
   wxGDIImage*                       pImage
 , int                               nId
-, long                              lFlags
+, wxBitmapType                      lFlags
 , int                               nWidth
 , int                               nHeight
 )
@@ -1491,10 +1483,10 @@ bool wxBitmapHandler::Load(
 }
 
 bool wxBitmapHandler::Save(
-  wxGDIImage*                       pImage
+  const wxGDIImage*                 pImage
 , const wxString&                   rName
-, int                               lType
-)
+, wxBitmapType                      lType
+) const
 {
     wxBitmap*                       pBitmap = wxDynamicCast( pImage
                                                             ,wxBitmap
@@ -1509,7 +1501,7 @@ bool wxBitmapHandler::Save(
 bool wxBitmapHandler::Create(
   wxBitmap*                         WXUNUSED(pBitmap)
 , const void*                       WXUNUSED(pData)
-, long                              WXUNUSED(lType)
+, wxBitmapType                      WXUNUSED(lType)
 , int                               WXUNUSED(nWidth)
 , int                               WXUNUSED(nHeight)
 , int                               WXUNUSED(nDepth)
@@ -1521,7 +1513,7 @@ bool wxBitmapHandler::Create(
 bool wxBitmapHandler::LoadFile(
   wxBitmap*                         WXUNUSED(pBitmap)
 , int                               WXUNUSED(nId)
-, long                              WXUNUSED(lType)
+, wxBitmapType                      WXUNUSED(lType)
 , int                               WXUNUSED(nDesiredWidth)
 , int                               WXUNUSED(nDesiredHeight)
 )
@@ -1532,7 +1524,7 @@ bool wxBitmapHandler::LoadFile(
 bool wxBitmapHandler::LoadFile(
   wxBitmap*                         WXUNUSED(pBitmap)
 , const wxString&                   WXUNUSED(rName)
-, long                              WXUNUSED(lType)
+, wxBitmapType                      WXUNUSED(lType)
 , int                               WXUNUSED(nDesiredWidth)
 , int                               WXUNUSED(nDesiredHeight)
 )
@@ -1543,9 +1535,9 @@ bool wxBitmapHandler::LoadFile(
 bool wxBitmapHandler::SaveFile(
   wxBitmap*                         WXUNUSED(pBitmap)
 , const wxString&                   WXUNUSED(rName)
-, int                               WXUNUSED(nType)
+, wxBitmapType                      WXUNUSED(nType)
 , const wxPalette*                  WXUNUSED(pPalette)
-)
+) const
 {
     return false;
 }