* ctrl_list.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_list.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
// Draw the text
GenericBitmap *pText = m_rFont.drawString( *pStr, color, width );
+ if( !pText )
+ {
+ return;
+ }
yPos += itemHeight - pText->getHeight();
int ySrc = 0;
if( yPos < 0 )
* ctrl_text.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ctrl_text.cpp,v 1.2 2004/02/29 16:49:55 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
delete m_pImg;
}
m_pImg = m_rFont.drawString( rText, m_color );
+ if( !m_pImg )
+ {
+ return;
+ }
// 'Double' image
const UString doubleStringWithSep = rText + SEPARATOR_STRING + rText;
if( m_pImgDouble )
void CtrlText::onChangePosition()
{
- if( getPosition() )
+ if( m_pImg && getPosition() )
{
if( m_pImg->getWidth() < getPosition()->getWidth() )
{
// Start the automatic movement, but only if the text is wider than the
// control
- if( pThis->m_pImg->getWidth() >= pThis->getPosition()->getWidth() )
+ if( pThis->m_pImg &&
+ pThis->m_pImg->getWidth() >= pThis->getPosition()->getWidth() )
{
// The current image may have been set incorrectly in displayText(), so
// set the correct value
EvtMouse *pEvtMouse = (EvtMouse*)pThis->m_pEvt;
// Do nothing if the text fits in the control
- if( pThis->m_pImg->getWidth() >= pThis->getPosition()->getWidth() )
+ if( pThis->m_pImg &&
+ pThis->m_pImg->getWidth() >= pThis->getPosition()->getWidth() )
{
// The current image may have been set incorrectly in displayText(), so
// we set the correct value
// {m_pImgDouble->getWidth() - m_pImg->getWidth()} is the period of the
// bitmap; remember that the string used to generate m_pImgDouble is of the
// form: "foo foo", the number of spaces being a parameter
+ if( !m_pImg )
+ {
+ return;
+ }
position %= m_pImgDouble->getWidth() - m_pImg->getWidth();
if( position > 0 )
{
* ft2_font.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: ft2_font.cpp,v 1.2 2004/02/27 13:24:12 gbazin Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
FT2Font::FT2Font( intf_thread_t *pIntf, const string &rName, int size ):
- GenericFont( pIntf ), m_name( rName ), m_buffer( NULL ), m_size( size )
+ GenericFont( pIntf ), m_name( rName ), m_buffer( NULL ), m_size( size ),
+ m_lib( NULL ), m_face( NULL ), m_dotGlyph( NULL )
{
}
FT2Font::~FT2Font()
{
-
- FT_Done_Glyph( m_dotGlyph );
- FT_Done_Face( m_face );
- FT_Done_FreeType( m_lib );
+ if( m_dotGlyph )
+ {
+ FT_Done_Glyph( m_dotGlyph );
+ }
+ if( m_face )
+ {
+ FT_Done_Face( m_face );
+ }
+ if( m_lib )
+ {
+ FT_Done_FreeType( m_lib );
+ }
if( m_buffer )
{
free( m_buffer );
int yMin = 0, yMax = 0;
uint32_t *pString = (uint32_t*)rString.u_str();
+ // Check if freetype has been initialized
+ if( !m_face )
+ {
+ return NULL;
+ }
+
// Get the length of the string
int len = rString.length();
* tooltip.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: tooltip.cpp,v 1.3 2004/01/25 11:44:19 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
{
// Render the text on a bitmap
GenericBitmap *pBmpTip = m_rFont.drawString( rText, 0 );
+ if( !pBmpTip )
+ {
+ return;
+ }
int w = pBmpTip->getWidth() + 10;
int h = m_rFont.getSize() + 8;