1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2010 the VideoLAN team
7 * Author: Erwan Tulou <erwan10@vidoelan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
28 #include "art_bitmap.hpp"
29 #include <vlc_image.h>
33 intf_thread_t* ArtBitmap::m_pIntf = NULL;
34 image_handler_t* ArtBitmap::m_pImageHandler = NULL;
35 list<ArtBitmap*> ArtBitmap::m_listBitmap;
37 ArtBitmap::ArtBitmap( string uriName ):
38 FileBitmap( m_pIntf, m_pImageHandler, uriName, -1 ), m_uriName( uriName )
42 void ArtBitmap::initArtBitmap( intf_thread_t* pIntf )
47 // retain reference to skins interface
51 m_pImageHandler = image_HandlerCreate( pIntf );
53 if( !m_pImageHandler )
54 msg_Err( m_pIntf, "initialization of art bitmaps failed" );
58 ArtBitmap* ArtBitmap::getArtBitmap( string uriName )
60 if( !m_pImageHandler )
63 // check whether art is already loaded
64 list<ArtBitmap*>::const_iterator it;
65 for( it = m_listBitmap.begin(); it != m_listBitmap.end(); ++it )
67 if( (*it)->getUriName() == uriName )
71 // create and retain a new ArtBitmap since uri if not yet known
72 ArtBitmap* pArt = new ArtBitmap( uriName );
73 if( pArt && pArt->getWidth() && pArt->getHeight() )
75 m_listBitmap.push_back( pArt );
85 void ArtBitmap::freeArtBitmap( )
91 image_HandlerDelete( m_pImageHandler );
92 m_pImageHandler = NULL;