Commit e5489da6 authored by Clément Stenac's avatar Clément Stenac

Fix crash while drawing playlist

+ popup compile fix (bonus !)
parent 8f8be7fe
...@@ -597,6 +597,7 @@ void CtrlTree::makeImage() ...@@ -597,6 +597,7 @@ void CtrlTree::makeImage()
const GenericBitmap *m_pCurBitmap; const GenericBitmap *m_pCurBitmap;
UString *pStr = (UString*)(it->m_cString.get()); UString *pStr = (UString*)(it->m_cString.get());
uint32_t color = ( it->m_playing ? m_playColor : m_fgColor ); uint32_t color = ( it->m_playing ? m_playColor : m_fgColor );
// Draw the text // Draw the text
if( pStr != NULL ) if( pStr != NULL )
{ {
...@@ -613,17 +614,19 @@ void CtrlTree::makeImage() ...@@ -613,17 +614,19 @@ void CtrlTree::makeImage()
if( m_pCurBitmap ) if( m_pCurBitmap )
{ {
// Make sure we are centered on the line
int yPos2 = yPos+(i_itemHeight-m_pCurBitmap->getHeight()+1)/2; int yPos2 = yPos+(i_itemHeight-m_pCurBitmap->getHeight()+1)/2;
if( yPos2 >= height )
{
delete pText;
break;
}
m_pImage->drawBitmap( *m_pCurBitmap, 0, 0, m_pImage->drawBitmap( *m_pCurBitmap, 0, 0,
bitmapWidth * (depth - 1 ), yPos2, bitmapWidth * (depth - 1 ), yPos2,
m_pCurBitmap->getWidth(), m_pCurBitmap->getWidth(),
__MIN( m_pCurBitmap->getHeight(), __MIN( m_pCurBitmap->getHeight(),
height - yPos2), true ); height - yPos2), true );
} }
else
{
/* it would be nice to draw something */
}
yPos += i_itemHeight - pText->getHeight(); yPos += i_itemHeight - pText->getHeight();
int ySrc = 0; int ySrc = 0;
if( yPos < 0 ) if( yPos < 0 )
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "../src/os_popup.hpp" #include "../src/os_popup.hpp"
class X11Display;
/// X11 implementation of OSPopup /// X11 implementation of OSPopup
class X11Popup: public OSPopup class X11Popup: public OSPopup
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment