]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/bitmap.cpp
disabling close box
[wxWidgets.git] / src / mac / carbon / bitmap.cpp
index 2db229a90f5ccb5eada7aa7807ce5d2f5d6c24e4..05cc1a72e7d97974d50485b9075cd0f9bdb649e6 100644 (file)
@@ -802,7 +802,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
                 bit = x % 8 ;
                 mask = 1 << bit ;
 
-                if ( linestart[index] & mask )
+                if ( !(linestart[index] & mask ) )
                 {
                     *destination++ = 0xFF ;
                     *destination++ = 0 ;
@@ -1146,11 +1146,17 @@ wxImage wxBitmap::ConvertToImage() const
         for (int xx = 0; xx < width; xx++)
         {
             color = *((long*) source) ;
+#ifdef WORDS_BIGENDIAN
             a = ((color&0xFF000000) >> 24) ;
             r = ((color&0x00FF0000) >> 16) ;
             g = ((color&0x0000FF00) >> 8) ;
             b = (color&0x000000FF);
-
+#else
+            b = ((color&0xFF000000) >> 24) ;
+            g = ((color&0x00FF0000) >> 16) ;
+            r = ((color&0x0000FF00) >> 8) ;
+            a = (color&0x000000FF);
+#endif
             if ( hasMask )
             {
                 if ( *maskp++ == 0xFF )
@@ -1609,53 +1615,12 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
     data.m_height = GetHeight() ;
     data.m_stride = GetWidth() * 4 ;
 
-    return GetRawAccess() ;
+    return BeginRawAccess() ;
 }
 
 void wxBitmap::UngetRawData(wxPixelDataBase& dataBase)
 {
-    if ( !Ok() )
-        return;
-
-    // TODO: if we have some information about the API we should check
-    // this code looks strange...
-
-    if ( !M_BITMAPDATA->HasAlpha() )
-        return;
-
-    wxAlphaPixelData& data = (wxAlphaPixelData&)dataBase;
-    int w = data.GetWidth();
-    int h = data.GetHeight();
-
-    wxBitmap bmpMask( GetWidth(), GetHeight(), 32 );
-    wxAlphaPixelData dataMask( bmpMask, data.GetOrigin(), wxSize( w, h ) );
-    wxAlphaPixelData::Iterator pMask( dataMask ), p( data );
-
-    for ( int y = 0; y < h; y++ )
-    {
-        wxAlphaPixelData::Iterator rowStartMask = pMask;
-        wxAlphaPixelData::Iterator rowStart = p;
-
-        for ( int x = 0; x < w; x++ )
-        {
-            const wxAlphaPixelData::Iterator::ChannelType alpha = p.Alpha();
-
-            pMask.Red() = alpha;
-            pMask.Green() = alpha;
-            pMask.Blue() = alpha;
-
-            ++p;
-            ++pMask;
-        }
-
-        p = rowStart;
-        p.OffsetY( data, 1 );
-
-        pMask = rowStartMask;
-        pMask.OffsetY( dataMask, 1 );
-    }
-
-    SetMask( new wxMask( bmpMask ) );
+    EndRawAccess() ;
 }
 
 void wxBitmap::UseAlpha()