Ticket #7855: relax_image_cache.patch

File relax_image_cache.patch, 1.0 KB (added by Jim Stichnoth <stichnot@…>, 10 years ago)
  • libs/libmythui/mythuihelper.cpp

     
    12791279
    12801280    if (srcfile.isEmpty() || label.isEmpty())
    12811281        return NULL;
    1282        
     1282
     1283    // Some screens include certain images dozens or even hundreds of
     1284    // times.  Even if the image is in the cache, there is still a
     1285    // stat system call on the original file to see if it has changed.
     1286    // This code relaxes the original-file check so that the check
     1287    // isn't repeated if it was already done within kImageCacheTimeout
     1288    // seconds.
     1289    const uint kImageCacheTimeout = 5;
     1290    uint now = QDateTime::currentDateTime().toTime_t();
     1291    if (d->imageCache.contains(label) &&
     1292        d->CacheTrack[label] + kImageCacheTimeout > now)
     1293    {
     1294        return d->imageCache[label];
     1295    }
     1296
    12831297    QString cachefilepath = GetThemeCacheDir() + '/' + label;
    12841298    QFileInfo fi(cachefilepath);
    12851299