X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..99d800190a04a2deaf769017a5fae04a4ae50378:/src/msw/bitmap.cpp diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index f0c834bb24..adb8e3f5ba 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -67,6 +67,7 @@ class WXDLLEXPORT wxBitmapRefData : public wxGDIImageRefData { public: wxBitmapRefData(); + wxBitmapRefData(const wxBitmapRefData& data); virtual ~wxBitmapRefData() { Free(); } virtual void Free(); @@ -120,7 +121,9 @@ private: // optional mask for transparent drawing wxMask *m_bitmapMask; - DECLARE_NO_COPY_CLASS(wxBitmapRefData) + + // not implemented + wxBitmapRefData& operator=(const wxBitmapRefData&); }; // ---------------------------------------------------------------------------- @@ -197,7 +200,24 @@ wxBitmapRefData::wxBitmapRefData() #endif m_isDIB = - m_hasAlpha = FALSE; + m_hasAlpha = false; +} + +wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data) + : wxGDIImageRefData(data) +{ +#ifdef __WXDEBUG__ + m_selectedInto = NULL; +#endif + + // can't copy the mask as the other bitmap destroys it + m_bitmapMask = NULL; + + wxASSERT_MSG( !data.m_isDIB, + _T("can't copy bitmap locked for raw access!") ); + m_isDIB = false; + + m_hasAlpha = data.m_hasAlpha; } void wxBitmapRefData::Free() @@ -236,6 +256,32 @@ wxGDIImageRefData *wxBitmap::CreateData() const return new wxBitmapRefData; } +wxObjectRefData *wxBitmap::CloneRefData(const wxObjectRefData *dataOrig) const +{ + const wxBitmapRefData * + data = wx_static_cast(const wxBitmapRefData *, dataOrig); + if ( !data ) + return NULL; + + wxBitmap *self = wx_const_cast(wxBitmap *, this); + +#if wxUSE_WXDIB + // copy the other bitmap + if ( data->m_hBitmap ) + { + wxDIB dib((HBITMAP)(data->m_hBitmap)); + self->CopyFromDIB(dib); + } + else +#endif // wxUSE_WXDIB + { + // don't copy the bitmap data, but do copy the size, depth, ... + self->m_refData = new wxBitmapRefData(*data); + } + + return m_refData; +} + #ifdef __WIN32__ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) @@ -249,7 +295,7 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) { wxLogLastError(wxT("GetIconInfo")); - return FALSE; + return false; } wxBitmapRefData *refData = new wxBitmapRefData; @@ -272,9 +318,10 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) // delete the old one now as we don't need it any more ::DeleteObject(iconInfo.hbmMask); - return TRUE; + return true; #else - return FALSE; + wxUnusedVar(icon); + return false; #endif } @@ -285,7 +332,7 @@ bool wxBitmap::CopyFromCursor(const wxCursor& cursor) UnRef(); if ( !cursor.Ok() ) - return FALSE; + return false; return CopyFromIconOrCursor(cursor); } @@ -295,7 +342,7 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon) UnRef(); if ( !icon.Ok() ) - return FALSE; + return false; return CopyFromIconOrCursor(icon); } @@ -304,12 +351,12 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon) bool wxBitmap::CopyFromDIB(const wxDIB& dib) { - wxCHECK_MSG( dib.IsOk(), FALSE, _T("invalid DIB in CopyFromDIB") ); + wxCHECK_MSG( dib.IsOk(), false, _T("invalid DIB in CopyFromDIB") ); #ifdef SOMETIMES_USE_DIB HBITMAP hbitmap = dib.CreateDDB(); if ( !hbitmap ) - return FALSE; + return false; #else // ALWAYS_USE_DIB HBITMAP hbitmap = ((wxDIB &)dib).Detach(); // const_cast #endif // SOMETIMES_USE_DIB/ALWAYS_USE_DIB @@ -335,7 +382,7 @@ bool wxBitmap::CopyFromDIB(const wxDIB& dib) delete palette; #endif // wxUSE_PALETTE - return TRUE; + return true; } #endif // NEVER_USE_DIB @@ -379,7 +426,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) for ( int bits = 0; bits < 8; bits++) { reversed <<= 1; - reversed |= (val & 0x01); + reversed |= (unsigned char)(val & 0x01); val >>= 1; } *dst++ = reversed; @@ -411,25 +458,22 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) } // Create from XPM data -#if wxUSE_IMAGE && wxUSE_XPM bool wxBitmap::CreateFromXpm(const char **data) -#else -bool wxBitmap::CreateFromXpm(const char **WXUNUSED(data)) -#endif { #if wxUSE_IMAGE && wxUSE_XPM Init(); - wxCHECK_MSG( data != NULL, FALSE, wxT("invalid bitmap data") ) + wxCHECK_MSG( data != NULL, false, wxT("invalid bitmap data") ) wxXPMDecoder decoder; wxImage img = decoder.ReadData(data); - wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") ) + wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") ) *this = wxBitmap(img); - return TRUE; + return true; #else - return FALSE; + wxUnusedVar(data); + return false; #endif } @@ -468,7 +512,7 @@ bool wxBitmap::Create(int width, int height, int depth) bool wxBitmap::Create(int width, int height, const wxDC& dc) { - wxCHECK_MSG( dc.Ok(), FALSE, _T("invalid HDC in wxBitmap::Create()") ); + wxCHECK_MSG( dc.Ok(), false, _T("invalid HDC in wxBitmap::Create()") ); return DoCreate(width, height, -1, dc.GetHDC()); } @@ -495,12 +539,12 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) wxDIB dib(w, h, d); if ( !dib.IsOk() ) - return FALSE; + return false; // don't delete the DIB section in dib object dtor hbmp = dib.Detach(); - GetBitmapData()->m_isDIB = TRUE; + GetBitmapData()->m_isDIB = true; GetBitmapData()->m_depth = d; } else // create a DDB @@ -575,7 +619,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, const wxDC& dc) if (hBitmap == NULL) { ::ReleaseDC(NULL, hScreenDC); - return FALSE; + return false; } HDC hMemDC = ::CreateCompatibleDC(hScreenDC); @@ -601,7 +645,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, const wxDC& dc) if (!hMaskBitmap) { - hasMask = FALSE; + hasMask = false; } else { @@ -612,7 +656,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, const wxDC& dc) hOldMaskBitmap = ::SelectObject( hMaskDC, hMaskBitmap); } #else - hasMask = FALSE; + hasMask = false; #endif } @@ -659,7 +703,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, const wxDC& dc) SetPalette(image.GetPalette()); #endif // wxUSE_PALETTE - return TRUE; + return true; } wxImage wxBitmap::ConvertToImage() const @@ -740,7 +784,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth) bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc) { - wxCHECK_MSG( dc.Ok(), FALSE, + wxCHECK_MSG( dc.Ok(), false, _T("invalid HDC in wxBitmap::CreateFromImage()") ); return CreateFromImage(image, -1, dc.GetHDC()); @@ -748,7 +792,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc) bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) { - wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") ); + wxCHECK_MSG( image.Ok(), false, wxT("invalid image") ); UnRef(); @@ -758,7 +802,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) wxDIB dib(image); if ( !dib.IsOk() ) - return FALSE; + return false; // store the bitmap parameters @@ -781,7 +825,7 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) // don't delete the DIB section in dib object dtor hbitmap = dib.Detach(); - refData->m_isDIB = TRUE; + refData->m_isDIB = true; refData->m_depth = dib.GetDepth(); } #ifndef ALWAYS_USE_DIB @@ -799,16 +843,50 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) // finally also set the mask if we have one if ( image.HasMask() ) { - SetMask(new wxMask(*this, wxColour(image.GetMaskRed(), - image.GetMaskGreen(), - image.GetMaskBlue()))); + const size_t len = 2*((w+15)/16); + BYTE *src = image.GetData(); + BYTE *data = new BYTE[h*len]; + memset(data, 0, h*len); + BYTE r = image.GetMaskRed(), + g = image.GetMaskGreen(), + b = image.GetMaskBlue(); + BYTE *dst = data; + for ( int y = 0; y < h; y++, dst += len ) + { + BYTE *dstLine = dst; + BYTE mask = 0x80; + for ( int x = 0; x < w; x++, src += 3 ) + { + if (src[0] != r || src[1] != g || src[2] != b) + *dstLine |= mask; + + if ( (mask >>= 1) == 0 ) + { + dstLine++; + mask = 0x80; + } + } + } + + hbitmap = ::CreateBitmap(w, h, 1, 1, data); + if ( !hbitmap ) + { + wxLogLastError(_T("CreateBitmap(mask)")); + } + else + { + SetMask(new wxMask((WXHBITMAP)hbitmap)); + } + + delete data; } - return TRUE; + return true; } wxImage wxBitmap::ConvertToImage() const { + // convert DDB to DIB wxDIB dib(*this); if ( !dib.IsOk() ) @@ -816,122 +894,75 @@ wxImage wxBitmap::ConvertToImage() const return wxNullImage; } + // and then DIB to our wxImage wxImage image = dib.ConvertToImage(); if ( !image.Ok() ) { return wxNullImage; } - // set mask - - // TODO: WinCE mask-copying support and use wxDIB -#ifndef __WXWINCE__ - - if( GetMask() && GetMask()->GetMaskBitmap() ) + // now do the same for the mask, if we have any + HBITMAP hbmpMask = GetMask() ? (HBITMAP) GetMask()->GetMaskBitmap() : NULL; + if ( hbmpMask ) { - static const int MASK_RED = 1; - static const int MASK_GREEN = 2; - static const int MASK_BLUE = 3; - static const int MASK_BLUE_REPLACEMENT = 2; - - HBITMAP hbitmap = (HBITMAP) GetMask()->GetMaskBitmap(); - int width = GetWidth(); - int height = GetHeight(); - - int bytesPerLine = width*3; - int sizeDWORD = sizeof( DWORD ); - int lineBoundary = bytesPerLine % sizeDWORD; - int padding = 0; - if( lineBoundary > 0 ) + wxDIB dibMask(hbmpMask); + if ( dibMask.IsOk() ) { - padding = sizeDWORD - lineBoundary; - bytesPerLine += padding; - } - - // create a DIB header - int headersize = sizeof(BITMAPINFOHEADER); - BITMAPINFO *lpDIBh = (BITMAPINFO *) malloc( headersize ); - if( !lpDIBh ) - { - wxFAIL_MSG( wxT("could not allocate data for DIB header") ); - //free( data ); - return wxNullImage; - } - - // Fill in the DIB header - lpDIBh->bmiHeader.biSize = headersize; - lpDIBh->bmiHeader.biWidth = width; - lpDIBh->bmiHeader.biHeight = -height; - lpDIBh->bmiHeader.biSizeImage = bytesPerLine * height; - lpDIBh->bmiHeader.biPlanes = 1; - lpDIBh->bmiHeader.biBitCount = 24; - lpDIBh->bmiHeader.biCompression = BI_RGB; - lpDIBh->bmiHeader.biClrUsed = 0; - // These seem not really needed for our purpose here. - lpDIBh->bmiHeader.biClrImportant = 0; - lpDIBh->bmiHeader.biXPelsPerMeter = 0; - lpDIBh->bmiHeader.biYPelsPerMeter = 0; - - // memory DC created, color set, data copied, and memory DC deleted - - // memory for DIB data - unsigned char *lpBits - = (unsigned char *) malloc( lpDIBh->bmiHeader.biSizeImage ); - if( !lpBits ) - { - wxFAIL_MSG( wxT("could not allocate data for DIB") ); - free( lpDIBh ); - return wxNullImage; - } - - - HDC hdc = ::GetDC(NULL); - - HDC memdc = ::CreateCompatibleDC( hdc ); - ::SetTextColor( memdc, RGB( 0, 0, 0 ) ); - ::SetBkColor( memdc, RGB( 255, 255, 255 ) ); - ::GetDIBits( memdc, hbitmap, 0, height, lpBits, lpDIBh, DIB_RGB_COLORS ); - ::DeleteDC( memdc ); - unsigned char *ptdata = image.GetData();//data; - unsigned char *ptbits = lpBits; - int i, j; - for( i=0; i> 3; + const int maskBytesPerLine = wxDIB::GetLineSize(w, bpp); + unsigned char *data = image.GetData(); + + // remember that DIBs are stored in bottom to top order + unsigned char * + maskLineStart = dibMask.GetData() + ((h - 1) * maskBytesPerLine); + + for ( int y = 0; y < h; y++, maskLineStart -= maskBytesPerLine ) { - // is this pixel transparent? - if ( *ptbits != 0 ) + // traverse one mask DIB line + unsigned char *mask = maskLineStart; + for ( int x = 0; x < w; x++, mask += maskBytesPerPixel ) { - if ( (ptdata[0] == MASK_RED) && - (ptdata[1] == MASK_GREEN) && - (ptdata[2] == MASK_BLUE) ) + // should this pixel be transparent? + if ( *mask ) { - // we have to fudge the colour a bit to prevent this - // pixel from appearing transparent - ptdata[2] = MASK_BLUE_REPLACEMENT; + // no, check that it isn't transparent by accident + if ( (data[0] == MASK_RED) && + (data[1] == MASK_GREEN) && + (data[2] == MASK_BLUE) ) + { + // we have to fudge the colour a bit to prevent + // this pixel from appearing transparent + data[2] = MASK_BLUE_REPLACEMENT; + } + + data += 3; + } + else // yes, transparent pixel + { + *data++ = MASK_RED; + *data++ = MASK_GREEN; + *data++ = MASK_BLUE; } - ptdata += 3; - } - else // masked pixel - { - *(ptdata++) = MASK_RED; - *(ptdata++) = MASK_GREEN; - *(ptdata++) = MASK_BLUE; } - ptbits += 3; } - ptbits += padding; - } - - image.SetMaskColour( MASK_RED, MASK_GREEN, MASK_BLUE ); - image.SetMask( true ); - // free allocated resources - ::ReleaseDC(NULL, hdc); - free(lpDIBh); - free(lpBits); + image.SetMaskColour(MASK_RED, MASK_GREEN, MASK_BLUE); + } } -#endif // __WXWINCE__ return image; } @@ -964,12 +995,12 @@ bool wxBitmap::LoadFile(const wxString& filename, long type) { *this = wxBitmap(image); - return TRUE; + return true; } } #endif // wxUSE_IMAGE - return FALSE; + return false; } bool wxBitmap::Create(void *data, long type, int width, int height, int depth) @@ -982,7 +1013,7 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth) { wxLogDebug(wxT("Failed to create bitmap: no bitmap handler for type %ld defined."), type); - return FALSE; + return false; } m_refData = new wxBitmapRefData; @@ -1012,7 +1043,7 @@ bool wxBitmap::SaveFile(const wxString& filename, } #endif // wxUSE_IMAGE - return FALSE; + return false; } // ---------------------------------------------------------------------------- @@ -1027,11 +1058,13 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const (rect.y+rect.height <= GetHeight()), wxNullBitmap, wxT("Invalid bitmap or bitmap region") ); - wxBitmap ret( rect.width, rect.height ); + wxBitmap ret( rect.width, rect.height, GetDepth() ); wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") ); #ifndef __WXMICROWIN__ - // TODO: copy alpha channel data if any + // handle alpha channel, if any + if (HasAlpha()) + ret.UseAlpha(); // copy bitmap data MemoryHDC dcSrc, @@ -1092,6 +1125,15 @@ wxMask *wxBitmap::GetMask() const return GetBitmapData() ? GetBitmapData()->GetMask() : (wxMask *) NULL; } +wxBitmap wxBitmap::GetMaskBitmap() const +{ + wxBitmap bmp; + wxMask *mask = GetMask(); + if ( mask ) + bmp.SetHBITMAP(mask->GetMaskBitmap()); + return bmp; +} + #ifdef __WXDEBUG__ wxDC *wxBitmap::GetSelectedInto() const @@ -1139,7 +1181,7 @@ void wxBitmap::SetSelectedInto(wxDC *dc) void wxBitmap::SetPalette(const wxPalette& palette) { - EnsureHasData(); + AllocExclusive(); GetBitmapData()->m_bitmapPalette = palette; } @@ -1148,7 +1190,7 @@ void wxBitmap::SetPalette(const wxPalette& palette) void wxBitmap::SetMask(wxMask *mask) { - EnsureHasData(); + AllocExclusive(); GetBitmapData()->SetMask(mask); } @@ -1225,7 +1267,11 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) data.m_height = h; // remember that DIBs are stored in top to bottom order! - const LONG bytesPerRow = ds.dsBm.bmWidthBytes; + // (We can't just use ds.dsBm.bmWidthBytes here, because it isn't always a + // multiple of 2, as required by the documentation. So we use the official + // formula, which we already use elsewhere.) + const LONG bytesPerRow = + wxDIB::GetLineSize(ds.dsBm.bmWidth, ds.dsBm.bmBitsPixel); data.m_stride = -bytesPerRow; char *bits = (char *)ds.dsBm.bmBits; @@ -1246,12 +1292,7 @@ void wxBitmap::UngetRawData(wxPixelDataBase& dataBase) if ( !Ok() ) return; - // the cast is ugly but we can't do without it and without making this - // function template (and hence inline) unfortunately - typedef wxPixelData PixelData; - PixelData& data = (PixelData &)dataBase; - - if ( !data ) + if ( !&dataBase ) { // invalid data, don't crash -- but don't assert neither as we're // called automatically from wxPixelDataBase dtor and so there is no @@ -1259,36 +1300,6 @@ void wxBitmap::UngetRawData(wxPixelDataBase& dataBase) return; } - if ( GetBitmapData()->m_hasAlpha ) - { - // AlphaBlend() wants to have premultiplied source alpha but - // wxRawBitmap API uses normal, not premultiplied, colours, so adjust - // them here now - PixelData::Iterator p(data); - - const int w = data.GetWidth(); - const int h = data.GetHeight(); - - for ( int y = 0; y < h; y++ ) - { - PixelData::Iterator rowStart = p; - - for ( int x = 0; x < w; x++ ) - { - const unsigned alpha = p.Alpha(); - - p.Red() = (p.Red() * alpha + 127) / 255; - p.Blue() = (p.Blue() * alpha + 127) / 255; - p.Green() = (p.Green() * alpha + 127) / 255; - - ++p; - } - - p = rowStart; - p.OffsetY(data, 1); - } - } - // if we're a DDB we need to convert DIB back to DDB now to make the // changes made via raw bitmap access effective if ( !GetBitmapData()->m_isDIB ) @@ -1346,7 +1357,7 @@ wxMask::~wxMask() bool wxMask::Create(const wxBitmap& bitmap) { #ifndef __WXMICROWIN__ - wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, FALSE, + wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, false, _T("can't create mask from invalid or not monochrome bitmap") ); if ( m_maskBitmap ) @@ -1369,9 +1380,10 @@ bool wxMask::Create(const wxBitmap& bitmap) DeleteDC(srcDC); SelectObject(destDC, 0); DeleteDC(destDC); - return TRUE; + return true; #else - return FALSE; + wxUnusedVar(bitmap); + return false; #endif } @@ -1397,7 +1409,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) } #endif // wxUSE_PALETTE - return FALSE; + return false; } // Create a mask from a bitmap and a colour indicating @@ -1405,7 +1417,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) { #ifndef __WXMICROWIN__ - wxCHECK_MSG( bitmap.Ok(), FALSE, _T("invalid bitmap in wxMask::Create") ); + wxCHECK_MSG( bitmap.Ok(), false, _T("invalid bitmap in wxMask::Create") ); if ( m_maskBitmap ) { @@ -1428,7 +1440,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) wxLogLastError(wxT("CreateCompatibleDC")); } - bool ok = TRUE; + bool ok = true; // SelectObject() will fail wxASSERT_MSG( !bitmap.GetSelectedInto(), @@ -1439,7 +1451,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) { wxLogLastError(wxT("SelectObject")); - ok = FALSE; + ok = false; } HGDIOBJ hbmpDstOld = ::SelectObject(destDC, (HBITMAP)m_maskBitmap); @@ -1447,7 +1459,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) { wxLogLastError(wxT("SelectObject")); - ok = FALSE; + ok = false; } if ( ok ) @@ -1466,7 +1478,9 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) return ok; #else // __WXMICROWIN__ - return FALSE; + wxUnusedVar(bitmap); + wxUnusedVar(colour); + return false; #endif // __WXMICROWIN__/!__WXMICROWIN__ } @@ -1481,7 +1495,7 @@ bool wxBitmapHandler::Create(wxGDIImage *image, { wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - return bitmap ? Create(bitmap, data, flags, width, height, depth) : FALSE; + return bitmap ? Create(bitmap, data, flags, width, height, depth) : false; } bool wxBitmapHandler::Load(wxGDIImage *image, @@ -1491,7 +1505,7 @@ bool wxBitmapHandler::Load(wxGDIImage *image, { wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - return bitmap ? LoadFile(bitmap, name, flags, width, height) : FALSE; + return bitmap ? LoadFile(bitmap, name, flags, width, height) : false; } bool wxBitmapHandler::Save(wxGDIImage *image, @@ -1500,7 +1514,7 @@ bool wxBitmapHandler::Save(wxGDIImage *image, { wxBitmap *bitmap = wxDynamicCast(image, wxBitmap); - return bitmap ? SaveFile(bitmap, name, type) : FALSE; + return bitmap ? SaveFile(bitmap, name, type) : false; } bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), @@ -1510,7 +1524,7 @@ bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), int WXUNUSED(height), int WXUNUSED(depth)) { - return FALSE; + return false; } bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), @@ -1519,7 +1533,7 @@ bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { - return FALSE; + return false; } bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), @@ -1527,7 +1541,7 @@ bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), int WXUNUSED(type), const wxPalette *WXUNUSED(palette)) { - return FALSE; + return false; } // ---------------------------------------------------------------------------- @@ -1572,7 +1586,7 @@ bool wxCreateDIB(long xSize, long ySize, long bitsPerPixel, *lpDIBHeader = lpDIBheader; - return TRUE; + return true; } void wxFreeDIB(LPBITMAPINFO lpDIBHeader) @@ -1649,12 +1663,12 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, HICON wxBitmapToHICON(const wxBitmap& bmp) { - return wxBitmapToIconOrCursor(bmp, TRUE, 0, 0); + return wxBitmapToIconOrCursor(bmp, true, 0, 0); } HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY) { - return (HCURSOR)wxBitmapToIconOrCursor(bmp, FALSE, hotSpotX, hotSpotY); + return (HCURSOR)wxBitmapToIconOrCursor(bmp, false, hotSpotX, hotSpotY); } HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) @@ -1696,7 +1710,7 @@ HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) // Deselect objects SelectObject(hdcSrc,srcTmp); SelectObject(hdcDst,dstTmp); - + ::DeleteDC(hdcSrc); ::DeleteDC(hdcDst);