X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c96c8649e6edeccbcd6aa40fdfa4da2e6ab5b59..4a2d030adfa836f6ada1830c9057170d053bcc64:/src/msw/imaglist.cpp?ds=inline diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index 087d6dddba..928a9f6b74 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: // Created: 04/01/98 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -159,7 +158,7 @@ int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask) #endif // wxUSE_WXDIB && wxUSE_IMAGE hbmp = GetHbitmapOf(bitmap); - HBITMAP hbmpMask = GetMaskForImage(bitmap, mask); + AutoHBITMAP hbmpMask(GetMaskForImage(bitmap, mask)); int index = ImageList_Add(GetHImageList(), hbmp, hbmpMask); if ( index == -1 ) @@ -167,8 +166,6 @@ int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask) wxLogError(_("Couldn't add an image to the image list.")); } - ::DeleteObject(hbmpMask); - return index; } @@ -237,17 +234,15 @@ bool wxImageList::Replace(int index, #endif // wxUSE_WXDIB && wxUSE_IMAGE hbmp = GetHbitmapOf(bitmap); - HBITMAP hbmpMask = GetMaskForImage(bitmap, mask); + AutoHBITMAP hbmpMask(GetMaskForImage(bitmap, mask)); - bool ok = ImageList_Replace(GetHImageList(), index, hbmp, hbmpMask) != 0; - if ( !ok ) + if ( !ImageList_Replace(GetHImageList(), index, hbmp, hbmpMask) ) { wxLogLastError(wxT("ImageList_Replace()")); + return false; } - ::DeleteObject(hbmpMask); - - return ok; + return true; } // Replaces a bitmap and mask from an icon. @@ -303,7 +298,7 @@ bool wxImageList::Draw(int index, if ( solidBackground ) { const wxBrush& brush = dc.GetBackground(); - if ( brush.Ok() ) + if ( brush.IsOk() ) { clr = wxColourToRGB(brush.GetColour()); } @@ -403,7 +398,7 @@ static HBITMAP GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask) wxMask *pMask; bool deleteMask = false; - if ( mask.Ok() ) + if ( mask.IsOk() ) { hbmpMask = GetHbitmapOf(mask); pMask = NULL;