Commit 8e20a9cf authored by Cyril Deguet's avatar Cyril Deguet

* winamp2.xml: hack to support nums_ex.bmp and numbers.bmp

* theme_loader.cpp: correct handling of subdirectories in winamp
  skins
parent 4d447b06
...@@ -146,6 +146,12 @@ void Builder::addBitmap( const BuilderData::Bitmap &rData ) ...@@ -146,6 +146,12 @@ void Builder::addBitmap( const BuilderData::Bitmap &rData )
GenericBitmap *pBmp = GenericBitmap *pBmp =
new FileBitmap( getIntf(), m_pImageHandler, new FileBitmap( getIntf(), m_pImageHandler,
rData.m_fileName, rData.m_alphaColor ); rData.m_fileName, rData.m_alphaColor );
if( !pBmp->getData() )
{
// Invalid bitmap
delete pBmp;
return;
}
m_pTheme->m_bitmaps[rData.m_id] = GenericBitmapPtr( pBmp ); m_pTheme->m_bitmaps[rData.m_id] = GenericBitmapPtr( pBmp );
} }
...@@ -175,6 +181,13 @@ void Builder::addBitmapFont( const BuilderData::BitmapFont &rData ) ...@@ -175,6 +181,13 @@ void Builder::addBitmapFont( const BuilderData::BitmapFont &rData )
{ {
GenericBitmap *pBmp = GenericBitmap *pBmp =
new FileBitmap( getIntf(), m_pImageHandler, rData.m_file, 0 ); new FileBitmap( getIntf(), m_pImageHandler, rData.m_file, 0 );
if( !pBmp->getData() )
{
// invalid bitmap
delete pBmp;
return;
}
m_pTheme->m_bitmaps[rData.m_id] = GenericBitmapPtr( pBmp ); m_pTheme->m_bitmaps[rData.m_id] = GenericBitmapPtr( pBmp );
GenericFont *pFont = new BitmapFont( getIntf(), *pBmp, rData.m_type ); GenericFont *pFont = new BitmapFont( getIntf(), *pBmp, rData.m_type );
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler, FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
string fileName, uint32_t aColor ): string fileName, uint32_t aColor ):
GenericBitmap( pIntf ), m_width( 0 ), m_height( 0 ) GenericBitmap( pIntf ), m_width( 0 ), m_height( 0 ), m_pData( NULL )
{ {
video_format_t fmt_in = {0}, fmt_out = {0}; video_format_t fmt_in = {0}, fmt_out = {0};
picture_t *pPic; picture_t *pPic;
......
...@@ -44,6 +44,11 @@ void BitmapImpl::drawBitmap( const GenericBitmap &rSource, int xSrc, int ySrc, ...@@ -44,6 +44,11 @@ void BitmapImpl::drawBitmap( const GenericBitmap &rSource, int xSrc, int ySrc,
{ {
int srcWidth = rSource.getWidth(); int srcWidth = rSource.getWidth();
uint32_t *pSrc = (uint32_t*)rSource.getData() + ySrc * srcWidth + xSrc; uint32_t *pSrc = (uint32_t*)rSource.getData() + ySrc * srcWidth + xSrc;
if( !pSrc )
{
return;
}
uint32_t *pDest = (uint32_t*)m_pData + yDest * m_width + xDest ; uint32_t *pDest = (uint32_t*)m_pData + yDest * m_width + xDest ;
for( int y = 0; y < height; y++ ) for( int y = 0; y < height; y++ )
{ {
......
...@@ -283,16 +283,21 @@ bool ThemeLoader::extract( const string &fileName ) ...@@ -283,16 +283,21 @@ bool ThemeLoader::extract( const string &fileName )
} }
else else
{ {
// No XML file, assume it is a winamp2 skin // No XML file, check if it is a winamp2 skin
path = tempPath; string mainBmp;
if( findFile( tempPath, "main.bmp", mainBmp ) )
// Look for winamp2.xml in the resource path
list<string> resPath = pOsFactory->getResourcePath();
list<string>::const_iterator it;
for( it = resPath.begin(); it != resPath.end(); it++ )
{ {
if( findFile( *it, WINAMP2_XML_FILE, xmlFile ) ) msg_Dbg( getIntf(), "Try to load a winamp2 skin" );
break; path = getFilePath( mainBmp );
// Look for winamp2.xml in the resource path
list<string> resPath = pOsFactory->getResourcePath();
list<string>::const_iterator it;
for( it = resPath.begin(); it != resPath.end(); it++ )
{
if( findFile( *it, WINAMP2_XML_FILE, xmlFile ) )
break;
}
} }
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<SubBitmap id="quit_up" x="18" y="0" width="9" height="9" /> <SubBitmap id="quit_up" x="18" y="0" width="9" height="9" />
<SubBitmap id="quit_down" x="18" y="9" width="9" height="9" /> <SubBitmap id="quit_down" x="18" y="9" width="9" height="9" />
</Bitmap> </Bitmap>
<BitmapFont id="digits_font" file="numbers.bmp" type="digits"/>
<BitmapFont id="digits_font" file="nums_ex.bmp" type="digits"/> <BitmapFont id="digits_font" file="nums_ex.bmp" type="digits"/>
<BitmapFont id="text_font" file="text.bmp" type="text"/> <BitmapFont id="text_font" file="text.bmp" type="text"/>
......
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