void ThumbnailTileCreator::ThreadProc( int32_t threadID )
{
    ThreadEnter( threadID );

    if ( m_Results && m_Results->HasResults() )
    {
        for ( std::set< TrackedFile >::const_iterator itr = m_Results->GetResults().begin(), end = m_Results->GetResults().end(); itr != end; ++itr )
        {
            if ( CheckThreadLeave( threadID ) )
            {
                return;
            }
            
            const TrackedFile& file = (*itr);
            HELIUM_ASSERT( !wxGetApp().GetFrame()->GetProject().Empty() );
#ifdef TRACKER_REFACTOR
            FilePath path( wxGetApp().GetFrame()->GetProject()->GetPath().Directory() + file.mPath.value() );
            ThumbnailTilePtr tile = new ThumbnailTile( path );
            m_Tiles.insert( std::make_pair( path, tile ) );
            m_Sorter.Add( tile );
            if ( path.IsDirectory() )
            {
                tile->SetThumbnail( m_TextureFolder );
            }
            else if ( path.Exists() )
            {
                tile->SetThumbnail( m_TextureLoading );
            }
            else
            {
                tile->SetThumbnail( m_TextureError );
            }
#endif
        }
    }

    // Build the ordered list of files that we need thumbnails for
    for ( ThumbnailIteratorPtr sortedItr = m_Sorter.GetIterator(); !sortedItr->IsDone(); sortedItr->Next() )
    {
        if ( CheckThreadLeave( threadID ) )
        {
            return;
        }

        ThumbnailTile* tile = sortedItr->GetCurrentTile();
        if ( tile->GetPath().IsFile() && tile->GetThumbnail() == m_TextureLoading.Ptr() )
        {
            m_TextureRequests.insert( tile->GetPath() );
        }
    }

    ThreadLeave( threadID );
}
示例#2
0
void ThumbnailTileCreator::ThreadProc( i32 threadID )
{
    ThreadEnter( threadID );

    if ( m_Results && m_Results->HasResults() )
    {
        for ( std::map< u64, Helium::Path >::const_iterator itr = m_Results->GetPathsMap().begin(), end = m_Results->GetPathsMap().end(); itr != end; ++itr )
        {
            if ( CheckThreadLeave( threadID ) )
            {
                return;
            }
            const Helium::Path& path = (*itr).second;
            ThumbnailTilePtr tile = new ThumbnailTile( path );
            m_Tiles.insert( std::make_pair( path, tile ) );
            m_Sorter.Add( tile );
            if ( path.IsDirectory() )
            {
                tile->SetThumbnail( m_TextureFolder );
            }
            else if ( path.Exists() )
            {
                tile->SetThumbnail( m_TextureLoading );
            }
            else
            {
                tile->SetThumbnail( m_TextureError );
            }
        }
    }

    // Build the ordered list of files that we need thumbnails for
    for ( ThumbnailIteratorPtr sortedItr = m_Sorter.GetIterator(); !sortedItr->IsDone(); sortedItr->Next() )
    {
        if ( CheckThreadLeave( threadID ) )
        {
            return;
        }

        ThumbnailTile* tile = sortedItr->GetCurrentTile();
        if ( tile->GetPath().IsFile() && tile->GetThumbnail() == m_TextureLoading.Ptr() )
        {
            m_TextureRequests.insert( tile->GetPath() );
        }
    }

    ThreadLeave( threadID );
}