Display -> FontViewAndCloseUp, UpdateSample -> UpdateCloseUp. Fix leak of CloseUp bitmap.

This commit is contained in:
Chris Danford
2008-05-27 08:56:36 +00:00
parent 0aa00e9e5a
commit 3793272aaa
2 changed files with 14 additions and 16 deletions
@@ -111,7 +111,6 @@ void CTextureFontGeneratorDlg::UpdateFont()
m_bUpdateFontNeeded = false; m_bUpdateFontNeeded = false;
m_FontView.SetBitmap( NULL ); m_FontView.SetBitmap( NULL );
m_CloseUp.SetBitmap( NULL );
CString sOld; CString sOld;
{ {
@@ -186,7 +185,7 @@ void CTextureFontGeneratorDlg::UpdateFont()
m_ShownPage.SetCurSel( iRet ); m_ShownPage.SetCurSel( iRet );
} }
void CTextureFontGeneratorDlg::UpdateSample() void CTextureFontGeneratorDlg::UpdateCloseUp()
{ {
HBITMAP hBitmap = m_CloseUp.GetBitmap(); HBITMAP hBitmap = m_CloseUp.GetBitmap();
m_CloseUp.SetBitmap( NULL ); m_CloseUp.SetBitmap( NULL );
@@ -303,16 +302,15 @@ BOOL CTextureFontGeneratorDlg::OnInitDialog()
m_SpinBaseline.SetRange( 64, 0 ); m_SpinBaseline.SetRange( 64, 0 );
m_bUpdateFontNeeded = true; m_bUpdateFontNeeded = true;
m_bUpdateDisplayNeeded = true; m_bUpdateFontViewAndCloseUpNeeded = true;
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
} }
void CTextureFontGeneratorDlg::UpdateDisplay() void CTextureFontGeneratorDlg::UpdateFontViewAndCloseUp()
{ {
m_bUpdateDisplayNeeded = false; m_bUpdateFontViewAndCloseUpNeeded = false;
m_FontView.SetBitmap( NULL ); m_FontView.SetBitmap( NULL );
m_CloseUp.SetBitmap( NULL );
m_SpinTop.EnableWindow( true ); m_SpinTop.EnableWindow( true );
m_SpinBaseline.EnableWindow( true ); m_SpinBaseline.EnableWindow( true );
@@ -339,7 +337,7 @@ void CTextureFontGeneratorDlg::UpdateDisplay()
HBITMAP hBitmap = g_pTextureFont->m_apPages[iSelectedPage]->m_hPage; HBITMAP hBitmap = g_pTextureFont->m_apPages[iSelectedPage]->m_hPage;
m_FontView.SetBitmap( hBitmap ); m_FontView.SetBitmap( hBitmap );
UpdateSample(); UpdateCloseUp();
CString sStr; CString sStr;
sStr.Format("Overlap: %i, %i\nMaximum size: %ix%i", sStr.Format("Overlap: %i, %i\nMaximum size: %ix%i",
@@ -379,12 +377,12 @@ void CTextureFontGeneratorDlg::OnPaint()
if( m_bUpdateFontNeeded ) if( m_bUpdateFontNeeded )
{ {
m_bUpdateDisplayNeeded = true; m_bUpdateFontViewAndCloseUpNeeded = true;
UpdateFont(); UpdateFont();
} }
if( m_bUpdateDisplayNeeded ) if( m_bUpdateFontViewAndCloseUpNeeded )
UpdateDisplay(); UpdateFontViewAndCloseUp();
CDialog::OnPaint(); CDialog::OnPaint();
} }
@@ -447,7 +445,7 @@ BOOL CTextureFontGeneratorDlg::CanExit()
void CTextureFontGeneratorDlg::OnCbnSelchangeShownPage() void CTextureFontGeneratorDlg::OnCbnSelchangeShownPage()
{ {
m_bUpdateDisplayNeeded = true; m_bUpdateFontViewAndCloseUpNeeded = true;
Invalidate( FALSE ); Invalidate( FALSE );
UpdateWindow(); UpdateWindow();
} }
@@ -517,7 +515,7 @@ void CTextureFontGeneratorDlg::OnDeltaposSpinTop(NMHDR *pNMHDR, LRESULT *pResult
LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR); LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
*pResult = 0; *pResult = 0;
m_bUpdateDisplayNeeded = true; m_bUpdateFontViewAndCloseUpNeeded = true;
Invalidate( FALSE ); Invalidate( FALSE );
} }
@@ -526,7 +524,7 @@ void CTextureFontGeneratorDlg::OnDeltaposSpinBaseline(NMHDR *pNMHDR, LRESULT *pR
LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR); LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
*pResult = 0; *pResult = 0;
m_bUpdateDisplayNeeded = true; m_bUpdateFontViewAndCloseUpNeeded = true;
Invalidate( FALSE ); Invalidate( FALSE );
} }
@@ -24,7 +24,7 @@ protected:
BOOL CanExit(); BOOL CanExit();
bool m_bUpdateFontNeeded; bool m_bUpdateFontNeeded;
bool m_bUpdateDisplayNeeded; bool m_bUpdateFontViewAndCloseUpNeeded;
// Generated message map functions // Generated message map functions
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
@@ -37,9 +37,9 @@ protected:
virtual BOOL OnMouseWheel( UINT nFlags, short zDelta, CPoint pt ); virtual BOOL OnMouseWheel( UINT nFlags, short zDelta, CPoint pt );
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
void UpdateDisplay(); void UpdateFontViewAndCloseUp();
void UpdateFont(); void UpdateFont();
void UpdateSample(); void UpdateCloseUp();
public: public:
vector<FontPageDescription> m_PagesToGenerate; vector<FontPageDescription> m_PagesToGenerate;