/**
* Destory one TAknsSrvWallpaper item
*/ 
void CAknsSrvWallpaperCache::DestoryItem( TAknsSrvWallpaper& aItem )
    {    
    delete aItem.iPortrait;
    delete aItem.iPortraitMask;
    delete aItem.iLandscape;
    delete aItem.iLandscapeMask;
   
    ZeroItem( aItem );
    }
예제 #2
0
파일: CRecentImp.cpp 프로젝트: beru/sakura
bool CRecentImp<T, S>::DeleteItem( int nIndex )
{
	if( ! IsAvailable() ) return false;
	if( nIndex < 0 || nIndex >= *m_pnUserItemCount ) return false;

	ZeroItem( nIndex );

	//以降のアイテムを前に詰める。
	int i;
	for( i = nIndex; i < *m_pnUserItemCount - 1; i++ )
	{
		CopyItem( i + 1, i );
	}
	ZeroItem( i );

	*m_pnUserItemCount -= 1;

	return true;
}
예제 #3
0
파일: CRecentImp.cpp 프로젝트: beru/sakura
void CRecentImp<T, S>::DeleteAllItem()
{
	int	i;

	if( ! IsAvailable() ) return;

	for( i = 0; i < m_nArrayCount; i++ )
	{
		ZeroItem( i );
	}

	*m_pnUserItemCount = 0;

	return;
}
/**
* Add a image to wallpaper cache
*/
TAknsSrvWallpaper* CAknsSrvWallpaperCache::AddL( RFs& aRFs, const TDesC& aFileName, 
        const TSize aTrgSize, const TSize aMaxSize )
    {
    if ( aTrgSize ==  TSize(-1, -1) )
        {
        TryDecodeImageL( aRFs,aFileName );
        return NULL;
        }
    
    TBool cached = EFalse;
    TAknsSrvWallpaper* wp = NULL;
    
    wp = CachedImage( aFileName );
    if ( !wp )
        {
        wp = new TAknsSrvWallpaper;
        ZeroItem ( *wp );
        }
    else
        {
        cached = ETrue;
        }

    
    _LIT( KSvgFileExt, ".svg" );
    TBool isSvgFormat = aFileName.Right(4).CompareF( KSvgFileExt ) == 0;
    
    TBool needDecodePortrait = EFalse;
    TBool needDecodeLandscape = EFalse;    

    if( aTrgSize.iHeight >= aTrgSize.iWidth ) //Portait
        {
        if ( aTrgSize != iPrtSize || ( !wp->iPortrait && !wp->iPortraitMask) )
            {
            needDecodePortrait = ETrue;
            iPrtSize = aTrgSize;
            }
        }
    else //Landscape
        {
        if ( aTrgSize != iLscSize || ( !wp->iLandscape && !wp->iLandscapeMask ) )
            {
            needDecodeLandscape = ETrue;
            iLscSize = aTrgSize;
            }
        }
    
    if( isSvgFormat )   
        {
        if( needDecodePortrait )
            {
            CAknsSrvSVGImageDecoder* svgdecoder = CAknsSrvSVGImageDecoder::NewL();
            CleanupStack::PushL( svgdecoder );
            svgdecoder->DecodeImageL(
                aFileName,
                aTrgSize,
                wp->iPortrait,
                wp->iPortraitMask );
            CleanupStack::PopAndDestroy( svgdecoder );
            }
        if( needDecodeLandscape )
            {
            CAknsSrvSVGImageDecoder* svgdecoder = CAknsSrvSVGImageDecoder::NewL();
            CleanupStack::PushL( svgdecoder );
            svgdecoder->DecodeImageL(
                aFileName,
                aTrgSize,
                wp->iLandscape,
                wp->iLandscapeMask );
            CleanupStack::PopAndDestroy( svgdecoder );
            }
        }
    else
        {
        if( needDecodePortrait )
            {
            CAknsSrvImageConverter::DecodeImageL(
                aRFs,
                aFileName,
                aTrgSize,
                wp->iPortrait,
                wp->iPortraitMask,
                aMaxSize );
            }
        if( needDecodeLandscape )
            {
            CAknsSrvImageConverter::DecodeImageL(
                aRFs,
                aFileName,
                aTrgSize,
                wp->iLandscape,
                wp->iLandscapeMask,
                aMaxSize );
            }
        }
    wp->iName.Copy( aFileName );
    if ( !cached )
        {
        RemoveOldestItem();        
        iCache.Append( wp );
        }
    return wp;
    }