Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  art_manager.cpp   Sprache: C

 

/*****************************************************************************
 * art_manager.cpp
 *****************************************************************************
 * Copyright (C) 2010 the VideoLAN team
 *
 * Author: Erwan Tulou      <erwan10@vidoelan.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/


#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "art_manager.hpp"
#include <vlc_image.h>

#include <new>

#define MAX_ART_CACHED    2


ArtManager *ArtManager::instance( intf_thread_t *pIntf )
{
    if( pIntf->p_sys->p_artManager == NULL )
    {
        pIntf->p_sys->p_artManager = new ArtManager( pIntf );
    }

    return pIntf->p_sys->p_artManager;
}


void ArtManager::destroy( intf_thread_t *pIntf )
{
    delete pIntf->p_sys->p_artManager;
    pIntf->p_sys->p_artManager = NULL;
}


ArtManager::ArtManager( intf_thread_t* pIntf ) : SkinObject( pIntf )
{
    // initialize handler
    m_pImageHandler = image_HandlerCreate( pIntf );

    if( !m_pImageHandler )
        msg_Err( getIntf(), "initialization of art manager failed" );
}


ArtManager::~ArtManager( )
{
    if( m_pImageHandler )
    {
        image_HandlerDelete( m_pImageHandler );
        m_pImageHandler = NULL;
    }

    std::list<ArtBitmap*>::const_iterator it;
    for( it = m_listBitmap.cbegin(); it != m_listBitmap.cend(); ++it )
        delete *it;
    m_listBitmap.clear();
}


ArtBitmap* ArtManager::getArtBitmap( const std::string &uriName )
{
    if( !uriName.size() )
        return NULL;

    if( !m_pImageHandler )
        return NULL;

    // check whether art is already loaded
    std::list<ArtBitmap*>::const_iterator it;
    for( it = m_listBitmap.cbegin(); it != m_listBitmap.cend(); ++it )
    {
        if( (*it)->getUriName() == uriName )
            return *it;
    }

    // create and retain a new ArtBitmap since uri is not yet known
    ArtBitmap* pArt = new (std::nothrow) ArtBitmap( getIntf(), m_pImageHandler, uriName );
    if( pArt && pArt->getWidth() && pArt->getHeight() )
    {
        if( m_listBitmap.size() == MAX_ART_CACHED )
        {
            ArtBitmap* pOldest = *(m_listBitmap.begin());
            delete pOldest;
            m_listBitmap.pop_front();
        }
        m_listBitmap.push_back( pArt );
        return pArt;
    }
    else
    {
        delete pArt;
        return NULL;
    }
}

Messung
CHZG
82938887

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1104857
#Domains=418202