diff options
author | Aleksoid <aleksoid@users.sourceforge.net> | 2010-03-11 09:43:16 +0300 |
---|---|---|
committer | Aleksoid <aleksoid@users.sourceforge.net> | 2010-03-11 09:43:16 +0300 |
commit | 580a99a63d5c655be52b43f45bc7b065ad8ff03a (patch) | |
tree | 9e34c15bc56dfb3b3ac254dc7fc0fe07f60ed41e /src/apps | |
parent | 2e0a13ef04b43b2dce2c07d3e11b601cee73a35a (diff) |
fix : prevent CreatePointFont on every OSD.DrawMessage();
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1751 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps')
-rw-r--r-- | src/apps/mplayerc/VMROSD.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/apps/mplayerc/VMROSD.cpp b/src/apps/mplayerc/VMROSD.cpp index 2e0300faf..dc16a9103 100644 --- a/src/apps/mplayerc/VMROSD.cpp +++ b/src/apps/mplayerc/VMROSD.cpp @@ -50,6 +50,9 @@ CVMROSD::CVMROSD(void) m_pMFVMB = NULL;
m_pVMB = NULL;
memset(&m_BitmapInfo, 0, sizeof(m_BitmapInfo));
+
+ m_FontSize = 0;
+ m_OSD_Font = _T("");
}
CVMROSD::~CVMROSD(void)
@@ -396,14 +399,23 @@ void CVMROSD::DisplayMessage (OSD_MESSAGEPOS nPos, LPCTSTR strMsg, int nDuration m_nMessagePos = nPos;
m_strMessage = strMsg;
+ int temp_m_FontSize = m_FontSize;
+ CString temp_m_OSD_Font = m_OSD_Font;
+
if (FontSize == 0) m_FontSize = AfxGetAppSettings().nOSD_Size;
else m_FontSize = FontSize;
if (m_FontSize<10 || m_FontSize>26) m_FontSize=20;
if (OSD_Font == _T("")) m_OSD_Font = AfxGetAppSettings().m_OSD_Font;
else m_OSD_Font = OSD_Font;
- m_MainFont.CreatePointFont(m_FontSize*10, m_OSD_Font);
- m_MemDC.SelectObject(m_MainFont);
+ if((temp_m_FontSize != m_FontSize) || (temp_m_OSD_Font != m_OSD_Font))
+ {
+ if(m_MainFont.GetSafeHandle())
+ m_MainFont.DeleteObject();
+
+ m_MainFont.CreatePointFont(m_FontSize*10, m_OSD_Font);
+ m_MemDC.SelectObject(m_MainFont);
+ }
if (m_pWnd)
{
@@ -411,7 +423,5 @@ void CVMROSD::DisplayMessage (OSD_MESSAGEPOS nPos, LPCTSTR strMsg, int nDuration if (nDuration != -1) SetTimer(m_pWnd->m_hWnd, (long)this, nDuration, (TIMERPROC)TimerFunc);
}
Invalidate();
- if(m_MainFont.GetSafeHandle())
- m_MainFont.DeleteObject();
}
}
|