Example #1
0
void Pixmap::create ( unsigned int width, unsigned int height, const Color* data )
{
    cleanupData ();
    m_width = width;
    m_height = height;
    m_pixels = (Color *)malloc ( sizeof(Color) * m_width * m_height );
    if ( data != 0 )
        memcpy ( m_pixels, data, sizeof(Color)*m_width*m_height );
}
Example #2
0
Pixmap& Pixmap::operator= ( const Pixmap& other )
{
    cleanupData ();
    m_width = other.m_width;
    m_height = other.m_height;
    memcpy ( m_error, other.m_error, sizeof(m_error) );
    m_pixels = (Color *)malloc ( sizeof(Color) * m_width * m_height );
    memcpy ( m_pixels, other.m_pixels, sizeof(Color)*m_width*m_height );
    return *this;
}
Example #3
0
bool Pixmap::load ( std::istream& stream )
{
    cleanupData ();
    
    // Check for the file type to load
    char header [ 8 ];
    stream.read ( header, 8 );
    if ( stream.gcount() != 8 )
        return SetError("Invalid file");
    
    if ( !png_sig_cmp ((png_byte*)header, 0, 8) )
        return loadPNG ( stream );
    else
        return SetError ( "Unsupported file type" );
}
/**
Create a new database.
*/
EXPORT_C void CPplContactsFile::CreateL(const TDesC& aFileName, TPlCreateMode aMode)
{
    TFileName fileName;
    GetPhysicalFileNameL(fileName, aFileName);

    TUint attVal;
    LocalFsL();
    TInt err = iLocalFs.Att(fileName, attVal);
    TBool fileExists = (err == KErrNone);

    if (fileExists)
    {
        switch (aMode)
        {
        case EPlLeaveIfExist:
            User::Leave(KErrAlreadyExists);
            break;

        case EPlOverwrite:
            err = iLocalFs.Delete(fileName);
            break;
        }
    }

    // If the database is not created propertly delete the database file using
    // the cleanup item.
    TFileCleanup cleanupData(iDatabase, iLocalFs, fileName);
    CleanupStack::PushL(TCleanupItem(TFileCleanup::Cleanup,&cleanupData));

    if ((err != KErrNone) && (err != KErrNotFound))
    {
        User::LeaveIfError(err);
    }

    User::LeaveIfError(iDatabase.Create(fileName, iConfigureStr));
    iItemManager->CreateTablesL();

    // If the folder exists recreate it since the database is new
    TRAP_IGNORE(TCntImageRescaleUtility::DeleteImageDirectoryL());
    TRAP_IGNORE(TCntImageRescaleUtility::CreateImageDirectoryL());

    iContactProperties.SystemTemplateManager().RecreateSystemTemplateL();

    CleanupStack::Pop(); // The TCleanupItem.

    iDatabase.Close();
}
void TSProvider::stopEngineFilter( void ) {
	printf( "[TSProvider] Stop engine filter\n" );
	
	//	Signal thread to exit
	_mutex.lock();
	_needStop = true;
	_mutex.unlock();
	_cWakeup.notify_all();

	//	Join
	_thread.join();

	//	Deinitialize ts data provider
	_ts->deinitialize();

	//	Free all data enqueued
	cleanupData();
}
Example #6
0
Pixmap::~Pixmap ()
{
    cleanupData ();
}
//	Reset demuxer
void TSProvider::reset() {
	_mutex.lock();
	cleanupData();
	_tsDemuxer->reset();
	_mutex.unlock();
}
int main(int argc, char** argv) {
    Galois::StatManager M;
    LonestarStart(argc, argv, name, desc, url);

    Graph g;
    G = &g;

    G->structureFromFile(filename.c_str());

    NumNodes = G->size();

#if SHARE_SINGLE_BC
    std::vector<cache_line_storage<BCrecord> > cb(NumNodes);
    CB = &cb;
#else
    Galois::GVectorElementAccumulator<std::vector<double> > cb;
    CB = &cb;
#endif

    initGraphData();

    int iterations = NumNodes;
    if (iterLimit)
        iterations = iterLimit;

    boost::filter_iterator<HasOut,Graph::iterator>
    begin = boost::make_filter_iterator(HasOut(G), g.begin(), g.end()),
    end = boost::make_filter_iterator(HasOut(G), g.end(), g.end());

    iterations = std::min((int) std::distance(begin, end), iterations);

    std::cout
            << "NumNodes: " << NumNodes
            << " Iterations: " << iterations << "\n";

    end = begin;
    std::advance(end, iterations);
    std::vector<GNode> tmp;
    std::copy(begin, end, std::back_inserter(tmp));

    typedef GaloisRuntime::WorkList::dChunkedLIFO<1> WL;
    Galois::StatTimer T;
    T.start();
    Galois::for_each<WL>(tmp.begin(), tmp.end(), process());
    T.stop();

    if (forceVerify || !skipVerify) {
        verify();
    } else { // print bc value for first 10 nodes
#if SHARE_SINGLE_BC
#else
        const std::vector<double>& bcv = CB->reduce();
#endif
        for (int i=0; i<10; ++i)
#if SHARE_SINGLE_BC
            std::cout << i << ": " << setiosflags(std::ios::fixed) << std::setprecision(6) << (*CB)[i].data.bc << "\n";
#else
            std::cout << i << ": " << setiosflags(std::ios::fixed) << std::setprecision(6) << bcv[i] << "\n";
#endif
#if SHOULD_PRODUCE_CERTIFICATE
        printBCcertificate();
#endif
    }
    std::cerr << "Application done...\n";

    Galois::StatTimer tt("cleanup");
    tt.start();
    cleanupData();
    tt.stop();

    return 0;
}