]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 1310251 ] Fixed a pixel depth bug converting wxImageb to wxBitmap
authorJulian Smart <julian@anthemion.co.uk>
Thu, 24 Nov 2005 17:41:26 +0000 (17:41 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 24 Nov 2005 17:41:26 +0000 (17:41 +0000)
By Mike Fahl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36244 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/bitmap.cpp

index 8605d262748b212747a9f01e4c43035a31195368..fb6d081fb6c957e9be8f086eed18c700cfe3082c 100644 (file)
@@ -826,7 +826,8 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc)
     wxDIB dib(image);
     if ( !dib.IsOk() )
         return false;
-
+       if (depth == -1)
+               depth = dib.GetDepth(); // Get depth from image if none specified
 
     // store the bitmap parameters
     wxBitmapRefData *refData = new wxBitmapRefData;
@@ -849,14 +850,14 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc)
         hbitmap = dib.Detach();
 
         refData->m_isDIB = true;
-        refData->m_depth = dib.GetDepth();
+        refData->m_depth = depth;
     }
 #ifndef ALWAYS_USE_DIB
     else // we need to convert DIB to DDB
     {
         hbitmap = dib.CreateDDB((HDC)hdc);
 
-        refData->m_depth = depth == -1 ? dib.GetDepth() : depth;
+        refData->m_depth = depth;
     }
 #endif // !ALWAYS_USE_DIB