GDI double-deletion fix, wxBitmap depth bug
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -440,30 +440,34 @@ wxBitmapList::wxBitmapList ()
|
||||
wxBitmapList::~wxBitmapList ()
|
||||
{
|
||||
wxLogDebug("~wxBitmapList: count = %d", Number());
|
||||
#ifdef __WXMSW__
|
||||
|
||||
wxNode *node = First ();
|
||||
while (node)
|
||||
{
|
||||
wxBitmap *bitmap = (wxBitmap *) node->Data ();
|
||||
wxNode *next = node->Next ();
|
||||
if (bitmap->GetVisible())
|
||||
delete bitmap;
|
||||
// bitmap->FreeResource(TRUE);
|
||||
node = next;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Pen and Brush lists
|
||||
wxPenList::~wxPenList ()
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
wxNode *node = First ();
|
||||
while (node)
|
||||
{
|
||||
wxPen *pen = (wxPen *) node->Data ();
|
||||
wxNode *next = node->Next ();
|
||||
if (pen->GetVisible())
|
||||
delete pen;
|
||||
// pen->FreeResource(TRUE);
|
||||
node = next;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxPenList::AddPen (wxPen * pen)
|
||||
@@ -510,14 +514,17 @@ wxPen *wxPenList::FindOrCreatePen (const wxString& colour, int width, int style)
|
||||
|
||||
wxBrushList::~wxBrushList ()
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
wxNode *node = First ();
|
||||
while (node)
|
||||
{
|
||||
wxBrush *brush = (wxBrush *) node->Data ();
|
||||
wxNode *next = node->Next ();
|
||||
if (brush->GetVisible())
|
||||
delete brush;
|
||||
node = next;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxBrushList::AddBrush (wxBrush * brush)
|
||||
@@ -566,20 +573,15 @@ wxFontList::~wxFontList ()
|
||||
wxNode *node = First ();
|
||||
while (node)
|
||||
{
|
||||
/*
|
||||
// Only delete objects that are 'visible', i.e.
|
||||
// that have been created using FindOrCreate...,
|
||||
// where the pointers are expected to be shared
|
||||
// (and therefore not deleted by any one part of an app).
|
||||
wxFont *font = (wxFont *) node->Data ();
|
||||
wxNode *next = node->Next ();
|
||||
if (font->GetVisible())
|
||||
delete font;
|
||||
node = next;
|
||||
*/
|
||||
// New for 2.0: don't delete the font (it may be a member
|
||||
// of a wxDC, for example)
|
||||
wxFont *font = (wxFont *) node->Data ();
|
||||
wxNode *next = node->Next ();
|
||||
|
||||
// Force the font to be deleted
|
||||
font->FreeResource(TRUE);
|
||||
node = next;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@@ -99,6 +99,8 @@ void wxInitializeResourceSystem(void)
|
||||
void wxCleanUpResourceSystem(void)
|
||||
{
|
||||
delete wxDefaultResourceTable;
|
||||
if (wxResourceBuffer)
|
||||
delete[] wxResourceBuffer;
|
||||
}
|
||||
|
||||
void wxLogWarning(char *msg)
|
||||
|
@@ -133,7 +133,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
|
||||
M_BITMAPDATA->m_depth = no_bits ;
|
||||
M_BITMAPDATA->m_numColors = 0;
|
||||
|
||||
M_BITMAPDATA->m_hBitmap = (WXHBITMAP) CreateBitmap(the_width, the_height, no_bits, 1, bits);
|
||||
M_BITMAPDATA->m_hBitmap = (WXHBITMAP) CreateBitmap(the_width, the_height, 1, no_bits, bits);
|
||||
|
||||
if (M_BITMAPDATA->m_hBitmap)
|
||||
M_BITMAPDATA->m_ok = TRUE;
|
||||
@@ -190,7 +190,7 @@ bool wxBitmap::Create(int w, int h, int d)
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
M_BITMAPDATA->m_hBitmap = (WXHBITMAP) CreateBitmap(w, h, d, 1, NULL);
|
||||
M_BITMAPDATA->m_hBitmap = (WXHBITMAP) CreateBitmap(w, h, 1, d, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -412,7 +412,12 @@ void wxDC::DrawArc(long x1,long y1,long x2,long y2, long xc, long yc)
|
||||
long yyy2 = (long) (yyc+ray);
|
||||
if (m_brush.Ok() && m_brush.GetStyle() !=wxTRANSPARENT)
|
||||
{
|
||||
Pie((HDC) m_hDC,xxx1,yyy1,xxx2,yyy2,
|
||||
// Have to add 1 to bottom-right corner of rectangle
|
||||
// to make semi-circles look right (crooked line otherwise).
|
||||
// Unfortunately this is not a reliable method, depends
|
||||
// on the size of shape.
|
||||
// TODO: figure out why this happens!
|
||||
Pie((HDC) m_hDC,xxx1,yyy1,xxx2+1,yyy2+1,
|
||||
xx1,yy1,xx2,yy2) ;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user