Beispiel #1
0
QImage
PlaylistModel::loadData(const ImageFile &f)
{
    QImage img;
    QByteArray *data = prft.get(f.createKey());
    if (data)
    {
        fprintf(stderr, "cache hit\n");
        img.loadFromData(*data);
    }
    else
    {
        fprintf(stderr, "cache miss\n");
        data = f.readData();
        if (!data) return QImage();
        img.loadFromData(*data);
        delete data;
    }

    if (img.format() != QImage::Format_ARGB32)
    {
        return img.convertToFormat(QImage::Format_ARGB32);
    }
    return img;
}
Beispiel #2
0
void
Prefetcher::Worker::run()
{
    for (;;)
    {
        ImageFile *f = master->getTask();
        QByteArray *data = f->readData();
        master->setResult(f->createKey(), data);
    }
}