X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/637b7e4f3a0fd1c6bdfc21d28e37bcf760e3b364..68c957045a3919d9ac241a1e775c233bb6d1a793:/src/mac/classic/bitmap.cpp diff --git a/src/mac/classic/bitmap.cpp b/src/mac/classic/bitmap.cpp index e51b3ca7b6..0605fc9175 100644 --- a/src/mac/classic/bitmap.cpp +++ b/src/mac/classic/bitmap.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bitmap.cpp +// Name: src/mac/classic/bitmap.cpp // Purpose: wxBitmap // Author: Stefan Csomor // Modified by: @@ -9,12 +9,20 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif #include "wx/bitmap.h" -#include "wx/icon.h" -#include "wx/log.h" -#include "wx/image.h" + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/icon.h" + #include "wx/image.h" +#endif + #include "wx/xpmdecod.h" #include "wx/rawbmp.h" @@ -353,7 +361,7 @@ wxBitmapRefData::wxBitmapRefData() : m_width(0) , m_height(0) , m_depth(0) - , m_ok(FALSE) + , m_ok(false) , m_numColors(0) , m_quality(0) { @@ -508,12 +516,12 @@ wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type) bool wxBitmap::CreateFromXpm(const char **bits) { - wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") ); + wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") ); wxXPMDecoder decoder; wxImage img = decoder.ReadData(bits); - 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; } wxBitmap::wxBitmap(const char **bits) @@ -710,7 +718,7 @@ bool wxBitmap::Create(void *data, wxBitmapType type, int width, int height, int if ( handler == NULL ) { wxLogWarning(wxT("no bitmap handler for type %d defined."), type); - return FALSE; + return false; } return handler->Create(this, data, type, width, height, depth); @@ -949,7 +957,7 @@ bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type, return false; } -bool wxBitmap::Ok() const +bool wxBitmap::IsOk() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); } @@ -991,25 +999,19 @@ wxMask *wxBitmap::GetMask() const void wxBitmap::SetWidth(int w) { - if (!M_BITMAPDATA) - m_refData = new wxBitmapRefData; - + AllocExclusive(); M_BITMAPDATA->m_width = w; } void wxBitmap::SetHeight(int h) { - if (!M_BITMAPDATA) - m_refData = new wxBitmapRefData; - + AllocExclusive(); M_BITMAPDATA->m_height = h; } void wxBitmap::SetDepth(int d) { - if (!M_BITMAPDATA) - m_refData = new wxBitmapRefData; - + AllocExclusive(); M_BITMAPDATA->m_depth = d; } @@ -1162,7 +1164,7 @@ bool wxMask::Create(const wxBitmap& bitmap) UnlockPixels( GetGWorldPixMap( (GWorldPtr) m_maskBitmap) ); UnlockPixels( GetGWorldPixMap( (GWorldPtr) bitmap.GetHBITMAP()) ); - return FALSE; + return false; } // Create a mask from a bitmap and a palette index indicating @@ -1171,7 +1173,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) { // TODO wxCHECK_MSG( 0, false, wxT("wxMask::Create not yet implemented")); - return FALSE; + return false; } // Create a mask from a bitmap and a colour indicating @@ -1226,7 +1228,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) UnlockPixels( GetGWorldPixMap( (GWorldPtr) bitmap.GetHBITMAP() ) ) ; SetGWorld( origPort , origDevice ) ; - return TRUE; + return true; } bool wxMask::PointMasked(int x, int y) @@ -1260,18 +1262,18 @@ wxBitmapHandler::~wxBitmapHandler() bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) { - return FALSE; + return false; } bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, int desiredWidth, int desiredHeight) { - return FALSE; + return false; } bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette) { - return FALSE; + return false; } /* @@ -1317,9 +1319,9 @@ bool wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo M_BITMAPHANDLERDATA->m_numColors = theInfo.uniqueColors ; // M_BITMAPHANDLERDATA->m_bitmapPalette; // M_BITMAPHANDLERDATA->m_quality; - return TRUE ; + return true ; } - return FALSE ; + return false ; } void wxBitmap::InitStandardHandlers() @@ -1429,4 +1431,3 @@ void wxBitmap::UseAlpha() // mask in UngetRawData() M_BITMAPDATA->m_hasAlpha = true; } -