]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
Don't use "Cancel" button in the about dialog of the listctrl sample.
[wxWidgets.git] / src / common / image.cpp
index a3a5f0ada6377f4dbd84b89afec7ba1a5d85dd24..66caa0817407120ca1f428cfc2bbf756c31d11b9 100644 (file)
@@ -2254,7 +2254,7 @@ static wxImage LoadImageFromResource(const wxString &name, wxBitmapType type)
 
     if ( type == wxBITMAP_TYPE_BMP_RESOURCE )
     {
-        hBitmap = ::LoadBitmap(wxGetInstance(), name.t_str());
+        hBitmap.Init( ::LoadBitmap(wxGetInstance(), name.t_str()) );
 
         if ( !hBitmap )
         {
@@ -2278,8 +2278,8 @@ static wxImage LoadImageFromResource(const wxString &name, wxBitmapType type)
                 return wxImage();
             }
 
-            hBitmap = info.hbmColor;
-            hMask   = info.hbmMask;
+            hBitmap.Init(info.hbmColor);
+            hMask.Init(info.hbmMask);
         }
     }
     else if ( type == wxBITMAP_TYPE_CUR_RESOURCE )
@@ -2306,7 +2306,10 @@ static wxImage LoadImageFromResource(const wxString &name, wxBitmapType type)
         image.SetMaskColour(0xc0, 0xc0, 0xc0);
     }
 
-    image.InitAlpha();
+    // We could have already loaded alpha from the resources, but if not,
+    // initialize it now using the mask.
+    if ( !image.HasAlpha() )
+        image.InitAlpha();
 
     return image;
 }
@@ -2877,10 +2880,6 @@ wxImage::HSVValue wxImage::RGBtoHSV(const RGBValue& rgb)
             case BLUE:
                 hue = 4.0 + (red - green) / deltaRGB;
                 break;
-
-            default:
-                wxFAIL_MSG(wxT("hue not specified"));
-                break;
         }
 
         hue /= 6.0;