MCPcopy Create free account
hub / github.com/bumptop/BumpTop / loadSampledImage

Method loadSampledImage

trunk/win/Source/BT_GLTextureManager.cpp:449–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449int GLTextureManager::loadSampledImage(const GLTextureObject& obj)
450{
451 // ConsoleWriteGuard guard(QString("\t\tloadSampledImage: %1").arg(obj.key));
452
453 // initialize COM on this thread for the win32 icon extraction calls
454 COMOLEResourceInitializer comOLEResource;
455
456 bool thumbnailLoaded = false;
457
458 // try and load the thumbnail from window's thumbs db
459 int ilImageId = -1;
460 /* TODO: reimplement BT_ThumbsDBReader
461 if (winOS->IsWindowsVersion(WindowsXP))
462 {
463 byte * data = NULL;
464 size_t numBytes = 0;
465
466 // find the thumbnailer and load the thumbnail data
467 QString lowerPath = native(parent(obj.srcPath)).toLower();
468 _thumbsDbsMutex.lock();
469 ThumbsDbs::const_iterator iter = _thumbsDbs.find(lowerPath);
470 if (iter != _thumbsDbs.end())
471 {
472 QString fileName = filename(obj.srcPath);
473 data = iter.value()->getThumbData((LPCWSTR) fileName.utf16(), numBytes);
474 }
475 _thumbsDbsMutex.unlock();
476
477 // load the thumbnail data into an IL image
478 if (data && numBytes > 0)
479 {
480 TRY_SLEEP_LOCK(_ilMutex)
481 int imgId = ilGenImage();
482 ilBindImage(imgId);
483 if (ilLoadL(IL_JPG, data, numBytes))
484 {
485 // convert the image to bgra if necessary
486 if (ilGetInteger(IL_IMAGE_FORMAT) != IL_BGR)
487 ilConvertImage(IL_BGR, IL_UNSIGNED_BYTE);
488
489 // flip windows bitmaps since they are defined differently
490 iluRotate(-180.0f);
491 ilImageId = imgId;
492 }
493 _ilMutex.unlock();
494
495 // free the thumbs db image memory
496 SAFE_DELETE_ARRAY(data);
497 }
498 }
499 else*/
500 if (winOS->IsWindowsVersionGreaterThanOrEqualTo(WindowsVista))
501 {
502 // run the process to make sure it's up to date
503 TRY_SLEEP_LOCK(_ilMutex);
504 QString cacheDir = native(_cacheDirectory);
505 _ilMutex.unlock();
506 ensurePathSlash(cacheDir);

Callers

nothing calls this directly

Calls 14

ensurePathSlashFunction · 0.85
ensureQuotedFunction · 0.85
consoleWriteFunction · 0.85
getFileExtensionMethod · 0.80
nativeFunction · 0.70
existsFunction · 0.70
QDirClass · 0.50
QStringFunction · 0.50
unlockMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected