From 732d8c74f805e35cd398711fcd3969c4c668e259 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sat, 14 Mar 2009 13:57:51 +0000 Subject: [PATCH] add wxSize overloads to wxBitmap ctors and to wxBitmap::Create git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/bitmap.h | 2 ++ include/wx/cocoa/bitmap.h | 14 +++++++++++--- include/wx/dfb/bitmap.h | 7 +++++-- include/wx/gtk/bitmap.h | 9 +++++++-- include/wx/gtk1/bitmap.h | 9 ++++++--- include/wx/mgl/bitmap.h | 9 +++++++-- include/wx/msw/bitmap.h | 6 +++++- include/wx/os2/bitmap.h | 16 ++++++++++++++-- include/wx/osx/bitmap.h | 12 ++++++++---- include/wx/palmos/bitmap.h | 10 +++++++--- include/wx/x11/bitmap.h | 11 ++++++++--- interface/wx/bitmap.h | 14 ++++++++++++-- src/cocoa/bitmap.mm | 11 ++++------- src/dfb/bitmap.cpp | 5 ----- src/gtk/bitmap.cpp | 10 ++++------ src/gtk1/bitmap.cpp | 15 +++++---------- src/mgl/bitmap.cpp | 11 ++++------- src/msw/bitmap.cpp | 7 +------ src/os2/bitmap.cpp | 13 ------------- src/osx/core/bitmap.cpp | 33 +++++++++++++-------------------- src/palmos/bitmap.cpp | 8 -------- src/x11/bitmap.cpp | 16 ++++++---------- 22 files changed, 129 insertions(+), 119 deletions(-) diff --git a/include/wx/bitmap.h b/include/wx/bitmap.h index 22debebe20..e6e837d948 100644 --- a/include/wx/bitmap.h +++ b/include/wx/bitmap.h @@ -148,6 +148,7 @@ public: wxBitmap(const wxBitmap& bmp); wxBitmap(const char bits[], int width, int height, int depth = 1); wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + wxBitmap(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH); wxBitmap(const char* const* bits); wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM); wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH); @@ -156,6 +157,7 @@ public: */ virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0; + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0; virtual int GetHeight() const = 0; virtual int GetWidth() const = 0; diff --git a/include/wx/cocoa/bitmap.h b/include/wx/cocoa/bitmap.h index e1f3e681c4..94d7eb3140 100644 --- a/include/wx/cocoa/bitmap.h +++ b/include/wx/cocoa/bitmap.h @@ -59,9 +59,11 @@ protected: WX_NSBitmapImageRep m_cocoaNSBitmapImageRep; }; + // ======================================================================== // wxBitmap // ======================================================================== + class WXDLLIMPEXP_CORE wxBitmap: public wxGDIObject { // ------------------------------------------------------------------------ @@ -83,10 +85,13 @@ public: // Constructor for generalised creation from data wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); // If depth is omitted, will create a bitmap compatible with the display - wxBitmap(int width, int height, int depth = -1); + wxBitmap(int width, int height, int depth = -1) + { (void)Create(width, height, depth); } + wxBitmap(const wxSize& sz, int depth = -1) + { (void)Create(sz, depth); } // Convert from wxImage: wxBitmap(const wxImage& image, int depth = -1) - { CreateFromImage(image, depth); } + { CreateFromImage(image, depth); } // Convert from wxIcon wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } @@ -100,7 +105,10 @@ public: // Initialize from wxImage bool CreateFromImage(const wxImage& image, int depth=-1); - virtual bool Create(int width, int height, int depth = -1); + virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + bool Create(NSImage* cocoaNSImage); bool Create(NSBitmapImageRep* cocoaNSBitmapImageRep); virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); diff --git a/include/wx/dfb/bitmap.h b/include/wx/dfb/bitmap.h index 246582a809..e7335658e5 100644 --- a/include/wx/dfb/bitmap.h +++ b/include/wx/dfb/bitmap.h @@ -26,7 +26,8 @@ class WXDLLIMPEXP_CORE wxBitmap : public wxBitmapBase public: wxBitmap() {} wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); } - wxBitmap(int width, int height, int depth = -1); + wxBitmap(int width, int height, int depth = -1) { Create(width, height, depth); } + wxBitmap(const wxSize& sz, int depth = -1) { Create(sz, depth); } wxBitmap(const char bits[], int width, int height, int depth = 1); wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); wxBitmap(const char* const* bits); @@ -35,7 +36,9 @@ public: #endif bool Create(const wxIDirectFBSurfacePtr& surface); - bool Create(int width, int height, int depth = -1); + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } virtual int GetHeight() const; virtual int GetWidth() const; diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index 8c65fa9e80..96f3e23814 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -51,13 +51,16 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase { public: wxBitmap() { } - wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH ); + wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH ) + { Create(width, height, depth); } + wxBitmap( const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH ) + { Create(sz, depth); } wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char* const* bits ); #ifdef wxNEEDS_CHARPP // needed for old GCC wxBitmap(char** data) - { *this = wxBitmap(const_cast(data)); } + { *this = wxBitmap(const_cast(data)); } #endif wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); #if wxUSE_IMAGE @@ -67,6 +70,8 @@ public: virtual ~wxBitmap(); bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } virtual int GetHeight() const; virtual int GetWidth() const; diff --git a/include/wx/gtk1/bitmap.h b/include/wx/gtk1/bitmap.h index 769083eee3..14f94a6664 100644 --- a/include/wx/gtk1/bitmap.h +++ b/include/wx/gtk1/bitmap.h @@ -64,8 +64,9 @@ private: class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase { public: - wxBitmap(); - wxBitmap( int width, int height, int depth = -1 ); + wxBitmap() {} + wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); } + wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); } wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char* const* bits ); #ifdef wxNEEDS_CHARPP @@ -79,7 +80,9 @@ public: wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } virtual ~wxBitmap(); - bool Create(int width, int height, int depth = -1); + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } virtual int GetHeight() const; virtual int GetWidth() const; diff --git a/include/wx/mgl/bitmap.h b/include/wx/mgl/bitmap.h index 913c2ff756..f6392e5f8c 100644 --- a/include/wx/mgl/bitmap.h +++ b/include/wx/mgl/bitmap.h @@ -27,14 +27,19 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase { public: wxBitmap() {} - wxBitmap(int width, int height, int depth = -1); + wxBitmap(int width, int height, int depth = -1) + { Create(width, height, depth); } + wxBitmap(const wxSize& sz, int depth = -1) + { Create(sz, depth); } wxBitmap(const char bits[], int width, int height, int depth = 1); wxBitmap(const char* const* bits); wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); wxBitmap(const wxImage& image, int depth = -1); virtual ~wxBitmap() {} - bool Create(int width, int height, int depth = -1); + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } virtual int GetHeight() const; virtual int GetWidth() const; diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index b93ee6a498..515ceb966e 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -73,7 +73,8 @@ public: // // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor // taking a DC argument if you want to force using DDB in this case - wxBitmap(int width, int height, int depth = -1); + wxBitmap(int width, int height, int depth = -1) { (void)Create(width, height, depth); } + wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); } // Create a bitmap compatible with the given DC wxBitmap(int width, int height, const wxDC& dc); @@ -137,6 +138,9 @@ public: #endif virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + virtual bool Create(int width, int height, const wxDC& dc); virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); diff --git a/include/wx/os2/bitmap.h b/include/wx/os2/bitmap.h index 0206629798..b7d02925a0 100644 --- a/include/wx/os2/bitmap.h +++ b/include/wx/os2/bitmap.h @@ -114,7 +114,16 @@ public: ); // If depth is omitted, will create a bitmap compatible with the display - wxBitmap( int nWidth, int nHeight, int nDepth = -1 ); + wxBitmap( int nWidth, int nHeight, int nDepth = -1 ) + { + Init(); + (void)Create(nWidth, nHeight, nDepth); + } + wxBitmap( const wxSize& sz, int nDepth = -1 ) + { + Init(); + (void)Create(sz, nDepth); + } wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } @@ -152,8 +161,11 @@ public: virtual bool Create( int nWidth ,int nHeight - ,int nDepth = -1 + ,int nDepth = wxBITMAP_SCREEN_DEPTH ); + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + virtual bool Create( const void* pData ,wxBitmapType lType ,int nWidth diff --git a/include/wx/osx/bitmap.h b/include/wx/osx/bitmap.h index a9d2f3fe36..9fd20675fb 100644 --- a/include/wx/osx/bitmap.h +++ b/include/wx/osx/bitmap.h @@ -87,7 +87,7 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase friend class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; public: - wxBitmap(); // Platform-specific + wxBitmap() {} // Platform-specific // Initialize with raw data. wxBitmap(const char bits[], int width, int height, int depth = 1); @@ -102,7 +102,8 @@ public: wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); // If depth is omitted, will create a bitmap compatible with the display - wxBitmap(int width, int height, int depth = -1); + wxBitmap(int width, int height, int depth = -1) { (void)Create(width, height, depth); } + wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); } // Convert from wxImage: wxBitmap(const wxImage& image, int depth = -1); @@ -110,14 +111,17 @@ public: // Convert from wxIcon wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } - virtual ~wxBitmap(); + virtual ~wxBitmap() {} wxImage ConvertToImage() const; // get the given part of bitmap wxBitmap GetSubBitmap( const wxRect& rect ) const; - virtual bool Create(int width, int height, int depth = -1); + virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); // virtual bool Create( WXHICON icon) ; virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); diff --git a/include/wx/palmos/bitmap.h b/include/wx/palmos/bitmap.h index 04b38d7b08..d08b6117d9 100644 --- a/include/wx/palmos/bitmap.h +++ b/include/wx/palmos/bitmap.h @@ -58,7 +58,8 @@ public: // // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor // taking a DC argument if you want to force using DDB in this case - wxBitmap(int width, int height, int depth = -1); + wxBitmap(int width, int height, int depth = -1) { /*TODO*/ } + wxBitmap(const wxSize& sz, int depth = -1) { /*TODO*/ } // Create a bitmap compatible with the given DC wxBitmap(int width, int height, const wxDC& dc); @@ -91,7 +92,7 @@ public: return *this; } - virtual ~wxBitmap(); + virtual ~wxBitmap() {} #if wxUSE_IMAGE && wxUSE_WXDIB wxImage ConvertToImage() const; @@ -111,7 +112,10 @@ public: bool CopyFromDIB(const wxDIB& dib); #endif - virtual bool Create(int width, int height, int depth = -1); + virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + virtual bool Create(int width, int height, const wxDC& dc); virtual bool Create(const void* data, long type, int width, int height, int depth = 1); virtual bool LoadFile(const wxString& name, long type = wxBITMAP_DEFAULT_TYPE); diff --git a/include/wx/x11/bitmap.h b/include/wx/x11/bitmap.h index 2a40965b35..e60874f815 100644 --- a/include/wx/x11/bitmap.h +++ b/include/wx/x11/bitmap.h @@ -65,8 +65,10 @@ private: class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase { public: - wxBitmap(); - wxBitmap( int width, int height, int depth = -1 ); + wxBitmap() {} + wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); } + wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); } + wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char* const* bits ); #ifdef wxNEEDS_CHARPP @@ -81,7 +83,10 @@ public: static void InitStandardHandlers(); - bool Create(int width, int height, int depth = -1); + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + bool Create(const void* data, wxBitmapType type, int width, int height, int depth = -1); // create the wxBitmap using a _copy_ of the pixmap diff --git a/interface/wx/bitmap.h b/interface/wx/bitmap.h index ce3e67080d..1d2b8b81f8 100644 --- a/interface/wx/bitmap.h +++ b/interface/wx/bitmap.h @@ -273,6 +273,11 @@ public: A depth of 32 including an alpha channel is supported under MSW, Mac and GTK+. */ wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + + /** + @overload + */ + wxBitmap(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH); /** Creates a bitmap from XPM data. @@ -374,10 +379,15 @@ public: /** Creates a fresh bitmap. If the final argument is omitted, the display depth of the screen is used. - - This overload works on all platforms. + + @return @true if the creation was successful. */ virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + + /** + @overload + */ + virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH); /* Creates a bitmap from the given data, which can be of arbitrary type. diff --git a/src/cocoa/bitmap.mm b/src/cocoa/bitmap.mm index daffce382a..b2569b0104 100644 --- a/src/cocoa/bitmap.mm +++ b/src/cocoa/bitmap.mm @@ -39,6 +39,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase) // ======================================================================== // wxBitmapRefData // ======================================================================== + class wxBitmapRefData: public wxGDIRefData { friend class wxBitmap; @@ -61,8 +62,6 @@ protected: wxMask *m_bitmapMask; // Optional mask }; -#define M_BITMAPDATA ((wxBitmapRefData *)m_refData) - wxBitmapRefData::wxBitmapRefData() { m_ok = FALSE; @@ -102,6 +101,9 @@ wxBitmapRefData::~wxBitmapRefData() // ======================================================================== // wxBitmap // ======================================================================== + +#define M_BITMAPDATA ((wxBitmapRefData *)m_refData) + IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) wxBitmap::wxBitmap() @@ -125,11 +127,6 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits /* TODO: create the bitmap from data */ } -wxBitmap::wxBitmap(int w, int h, int d) -{ - (void)Create(w, h, d); -} - wxBitmap::wxBitmap(NSImage* cocoaNSImage) { (void) Create(cocoaNSImage); diff --git a/src/dfb/bitmap.cpp b/src/dfb/bitmap.cpp index 4496298f13..239520cb7c 100644 --- a/src/dfb/bitmap.cpp +++ b/src/dfb/bitmap.cpp @@ -394,11 +394,6 @@ public: IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxBitmapBase) -wxBitmap::wxBitmap(int width, int height, int depth) -{ - Create(width, height, depth); -} - bool wxBitmap::Create(const wxIDirectFBSurfacePtr& surface) { UnRef(); diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 8a2785bbd8..65619c3d57 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -179,7 +179,7 @@ GdkBitmap *wxMask::GetBitmap() const } //----------------------------------------------------------------------------- -// wxBitmap +// wxBitmapRefData //----------------------------------------------------------------------------- class wxBitmapRefData: public wxGDIRefData @@ -226,17 +226,15 @@ wxBitmapRefData::~wxBitmapRefData() #endif // wxUSE_PALETTE } + +//----------------------------------------------------------------------------- +// wxBitmap //----------------------------------------------------------------------------- #define M_BMPDATA static_cast(m_refData) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) -wxBitmap::wxBitmap(int width, int height, int depth) -{ - Create(width, height, depth); -} - wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type) { LoadFile(filename, type); diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 3c651e38db..dba5a517fb 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -220,8 +220,9 @@ GdkBitmap *wxMask::GetBitmap() const return m_bitmap; } + //----------------------------------------------------------------------------- -// wxBitmap +// wxBitmapRefData //----------------------------------------------------------------------------- class wxBitmapRefData : public wxGDIRefData @@ -347,21 +348,15 @@ wxBitmapRefData::~wxBitmapRefData() #endif // wxUSE_PALETTE } + +//----------------------------------------------------------------------------- +// wxBitmap //----------------------------------------------------------------------------- #define M_BMPDATA ((wxBitmapRefData *)m_refData) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) -wxBitmap::wxBitmap() -{ -} - -wxBitmap::wxBitmap( int width, int height, int depth ) -{ - Create( width, height, depth ); -} - wxGDIRefData *wxBitmap::CreateGDIRefData() const { return new wxBitmapRefData; diff --git a/src/mgl/bitmap.cpp b/src/mgl/bitmap.cpp index 013e9f4674..3c717d4fe9 100644 --- a/src/mgl/bitmap.cpp +++ b/src/mgl/bitmap.cpp @@ -58,7 +58,7 @@ static pixel_format_t gs_pixel_format_wxImage = {0xFF,0x00,0, 0xFF,0x08,0, 0xFF,0x10,0, 0x00,0x00,0}; // RGB 24bpp for wxImage //----------------------------------------------------------------------------- -// wxBitmap +// wxBitmapRefData //----------------------------------------------------------------------------- class wxBitmapRefData: public wxGDIRefData @@ -163,18 +163,15 @@ wxBitmapRefData::~wxBitmapRefData() delete m_palette; } + +//----------------------------------------------------------------------------- +// wxBitmap //----------------------------------------------------------------------------- #define M_BMPDATA ((wxBitmapRefData *)m_refData) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase) -wxBitmap::wxBitmap(int width, int height, int depth) -{ - Create(width, height, depth); -} - - wxGDIRefData *wxBitmap::CreateGDIRefData() const { return new wxBitmapRefData; diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 6e7e0436f6..c3ffd63876 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -56,7 +56,7 @@ #endif // no CLR_INVALID // ---------------------------------------------------------------------------- -// Bitmap data +// wxBitmapRefData // ---------------------------------------------------------------------------- class WXDLLEXPORT wxBitmapRefData : public wxGDIImageRefData @@ -512,11 +512,6 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) #endif } -wxBitmap::wxBitmap(int w, int h, int d) -{ - (void)Create(w, h, d); -} - wxBitmap::wxBitmap(int w, int h, const wxDC& dc) { (void)Create(w, h, dc); diff --git a/src/os2/bitmap.cpp b/src/os2/bitmap.cpp index 74db703010..6f9f968eb1 100644 --- a/src/os2/bitmap.cpp +++ b/src/os2/bitmap.cpp @@ -276,19 +276,6 @@ wxBitmap::wxBitmap( SetHBITMAP((WXHBITMAP)hBmp); } // end of wxBitmap::wxBitmap -wxBitmap::wxBitmap( - int nW -, int nH -, int nD -) -{ - Init(); - (void)Create( nW - ,nH - ,nD - ); -} // end of wxBitmap::wxBitmap - wxBitmap::wxBitmap( const void* pData , wxBitmapType lType diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 96a26525f9..71b8bda63a 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -608,13 +608,13 @@ PicHandle wxBitmapRefData::GetPictHandle() err = GraphicsExportDoExport(exporter, NULL); CGImageRelease( imageRef ); - size_t handleSize = GetHandleSize( (Handle) m_pictHandle ); - // the 512 bytes header is only needed for pict files, but not in memory - if ( handleSize >= 512 ) - { - memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 ); - SetHandleSize( (Handle) m_pictHandle, handleSize - 512 ); - } + size_t handleSize = GetHandleSize( (Handle) m_pictHandle ); + // the 512 bytes header is only needed for pict files, but not in memory + if ( handleSize >= 512 ) + { + memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 ); + SetHandleSize( (Handle) m_pictHandle, handleSize - 512 ); + } } CloseComponent( exporter ); } @@ -785,6 +785,12 @@ wxBitmapRefData::~wxBitmapRefData() Free() ; } + + +// ---------------------------------------------------------------------------- +// wxBitmap +// ---------------------------------------------------------------------------- + bool wxBitmap::CopyFromIcon(const wxIcon& icon) { bool created = false ; @@ -890,14 +896,6 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon) return true; } -wxBitmap::wxBitmap() -{ -} - -wxBitmap::~wxBitmap() -{ -} - wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits) { wxBitmapRefData* bitmapRefData; @@ -952,11 +950,6 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits } /* bitmapRefData->IsOk() */ } -wxBitmap::wxBitmap(int w, int h, int d) -{ - (void)Create(w, h, d); -} - wxBitmap::wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth) { (void) Create(data, type, width, height, depth); diff --git a/src/palmos/bitmap.cpp b/src/palmos/bitmap.cpp index 35e484a48a..ed435cf0dd 100644 --- a/src/palmos/bitmap.cpp +++ b/src/palmos/bitmap.cpp @@ -198,19 +198,11 @@ bool wxBitmap::CopyFromDIB(const wxDIB& dib) #endif // NEVER_USE_DIB -wxBitmap::~wxBitmap() -{ -} - wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) { Init(); } -wxBitmap::wxBitmap(int w, int h, int d) -{ -} - wxBitmap::wxBitmap(int w, int h, const wxDC& dc) { } diff --git a/src/x11/bitmap.cpp b/src/x11/bitmap.cpp index be6e240a15..c32c1eb031 100644 --- a/src/x11/bitmap.cpp +++ b/src/x11/bitmap.cpp @@ -224,7 +224,7 @@ bool wxMask::Create( const wxBitmap& bitmap ) } //----------------------------------------------------------------------------- -// wxBitmap +// wxBitmapRefData //----------------------------------------------------------------------------- class wxBitmapRefData : public wxGDIRefData @@ -347,18 +347,14 @@ static WXPixmap wxGetSubPixmap( WXDisplay* xdisplay, WXPixmap xpixmap, return (WXPixmap)ret; } -#define M_BMPDATA ((wxBitmapRefData *)m_refData) -IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) +//----------------------------------------------------------------------------- +// wxBitmap +//----------------------------------------------------------------------------- -wxBitmap::wxBitmap() -{ -} +#define M_BMPDATA ((wxBitmapRefData *)m_refData) -wxBitmap::wxBitmap( int width, int height, int depth ) -{ - Create( width, height, depth ); -} +IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) bool wxBitmap::Create( int width, int height, int depth ) { -- 2.45.2