mirror of
				https://github.com/rofafor/vdr-plugin-femon.git
				synced 2023-10-10 11:36:53 +00:00 
			
		
		
		
	Fixed font handling to be thread-safe.
This commit is contained in:
		
							
								
								
									
										7
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								HISTORY
									
									
									
									
									
								
							@@ -339,6 +339,10 @@ VDR Plugin 'femon' Revision History
 | 
			
		||||
 | 
			
		||||
- Backported from 1.7.1.
 | 
			
		||||
 | 
			
		||||
2009-06-18: Version 1.6.7
 | 
			
		||||
 | 
			
		||||
- Backported from 1.7.2.
 | 
			
		||||
 | 
			
		||||
===================================
 | 
			
		||||
VDR Plugin 'femon' Revision History
 | 
			
		||||
===================================
 | 
			
		||||
@@ -356,6 +360,7 @@ VDR Plugin 'femon' Revision History
 | 
			
		||||
- Fixed closing of frontend file handles (Thanks to Brendon Higgins for
 | 
			
		||||
  reporting this one).
 | 
			
		||||
 | 
			
		||||
2009-xx-xx: Version 1.7.2
 | 
			
		||||
2009-06-18: Version 1.7.2
 | 
			
		||||
 | 
			
		||||
- Cleaned up compilation warnings.
 | 
			
		||||
- Fixed font handling to be thread-safe.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								femonosd.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								femonosd.c
									
									
									
									
									
								
							@@ -116,6 +116,14 @@
 | 
			
		||||
#define OSDCLEARINFO() \
 | 
			
		||||
        m_Osd->DrawRectangle(0, OSDINFOWIN_Y(0), OSDWIDTH, OSDINFOWIN_Y(OSDINFOHEIGHT) - 1, clrTransparent)
 | 
			
		||||
 | 
			
		||||
class cFemonDummyFont : public cFont {
 | 
			
		||||
public:
 | 
			
		||||
  virtual int Width(uint c) const { return 10; }
 | 
			
		||||
  virtual int Width(const char *s) const { return 50; }
 | 
			
		||||
  virtual int Height(void) const { return 20; }
 | 
			
		||||
  virtual void DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
cFemonOsd *cFemonOsd::pInstance = NULL;
 | 
			
		||||
 | 
			
		||||
cFemonOsd *cFemonOsd::Instance(bool create)
 | 
			
		||||
@@ -150,14 +158,11 @@ cFemonOsd::cFemonOsd()
 | 
			
		||||
{
 | 
			
		||||
  Dprintf("%s()\n", __PRETTY_FUNCTION__);
 | 
			
		||||
  m_SvdrpConnection.handle = -1;
 | 
			
		||||
  if (Setup.UseSmallFont == 0) {
 | 
			
		||||
     // Dirty hack to force the small fonts...
 | 
			
		||||
     Setup.UseSmallFont = 1;
 | 
			
		||||
     m_Font = cFont::GetFont(fontSml);
 | 
			
		||||
     Setup.UseSmallFont = 0;
 | 
			
		||||
  m_Font = cFont::CreateFont(Setup.FontSml, min(max(Setup.FontSmlSize, MINFONTSIZE), MAXFONTSIZE));
 | 
			
		||||
  if (!m_Font || !m_Font->Height()) {
 | 
			
		||||
     m_Font = new cFemonDummyFont;
 | 
			
		||||
     esyslog("ERROR: cFemonOsd::cFemonOsd() cannot create required font.");
 | 
			
		||||
     }
 | 
			
		||||
  else
 | 
			
		||||
     m_Font = cFont::GetFont(fontSml);
 | 
			
		||||
  if (OSDHEIGHT < (OSDINFOHEIGHT + OSDROWHEIGHT + OSDSTATUSHEIGHT))
 | 
			
		||||
     OSDHEIGHT = (OSDINFOHEIGHT + OSDROWHEIGHT + OSDSTATUSHEIGHT);
 | 
			
		||||
}
 | 
			
		||||
@@ -179,6 +184,8 @@ cFemonOsd::~cFemonOsd(void)
 | 
			
		||||
     }
 | 
			
		||||
  if (m_Osd)
 | 
			
		||||
     DELETENULL(m_Osd);
 | 
			
		||||
  if (m_Font)
 | 
			
		||||
     DELETENULL(m_Font);
 | 
			
		||||
  if (m_Frontend >= 0) {
 | 
			
		||||
     close(m_Frontend);
 | 
			
		||||
     m_Frontend = -1;
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ private:
 | 
			
		||||
  uint32_t          m_UNC;
 | 
			
		||||
  fe_status_t       m_FrontendStatus;
 | 
			
		||||
  int               m_DisplayMode;
 | 
			
		||||
  const cFont      *m_Font;
 | 
			
		||||
  cFont            *m_Font;
 | 
			
		||||
  cTimeMs           m_InputTime;
 | 
			
		||||
  cCondWait         m_Sleep;
 | 
			
		||||
  cMutex            m_Mutex;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user