wxDIB::Create(wxBitmap) shouldn't do any conversions if the bitmap is already a DIB section

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-03-24 22:58:50 +00:00
parent 9cf743aa7f
commit 82ac3b0a42
2 changed files with 73 additions and 39 deletions

View File

@@ -151,30 +151,10 @@ public:
private:
// common part of all ctors
void Init()
{
m_handle = 0;
m_data = NULL;
m_width =
m_height =
m_depth = 0;
}
void Init();
// free resources
void Free()
{
if ( m_handle )
{
if ( !::DeleteObject(m_handle) )
{
wxLogLastError(wxT("DeleteObject(hDIB)"));
}
Init();
}
}
void Free();
// the DIB section handle, 0 if invalid
HBITMAP m_handle;
@@ -198,6 +178,11 @@ private:
m_height,
m_depth;
// in some cases we could be using a handle which we didn't create and in
// this case we shouldn't free it neither -- this flag tell us if this is
// the case
bool m_ownsHandle;
// DIBs can't be copied
wxDIB(const wxDIB&);
@@ -208,6 +193,33 @@ private:
// inline functions implementation
// ----------------------------------------------------------------------------
inline
void wxDIB::Init()
{
m_handle = 0;
m_ownsHandle = true;
m_data = NULL;
m_width =
m_height =
m_depth = 0;
}
inline
void wxDIB::Free()
{
if ( m_handle && m_ownsHandle )
{
if ( !::DeleteObject(m_handle) )
{
wxLogLastError(wxT("DeleteObject(hDIB)"));
}
Init();
}
}
inline wxDIB::~wxDIB()
{
Free();