From aa58cc1edb1ba27495f5418148dd16b0f0231cc3 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Wed, 8 Apr 2020 14:42:25 +0300
Subject: [PATCH] SL-12607 FMOD Logo, small improvement

---
 indra/newview/CMakeLists.txt          |  2 ++
 indra/newview/llviewertexturelist.cpp | 37 ++++++++++++---------------
 2 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 1c50e0551ab..1ede6188fbe 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1715,6 +1715,8 @@ endif (OPENAL)
 
 if (FMODSTUDIO)
   set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_FMODSTUDIO")
+  # texture list needs to load fmod icon
+  set_source_files_properties(llviewertexturelist.cpp PROPERTIES COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS}")
   set(FMODWRAPPER_LIBRARY ${FMODSTUDIO_LIBRARY})
 endif (FMODSTUDIO)
 
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index b29e65923bb..1657e5153d8 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -194,30 +194,25 @@ void LLViewerTextureList::doPreloadImages()
     // but 3p images were added from packages and had to stay in separate folder
     // with path relative to exe.
 
+#ifdef LL_FMODSTUDIO
     std::string full_path = gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "3p_icons", "fmod.png");
-    if (full_path.empty())
-    {
-        LL_WARNS() << "Failed to find local image file fmod.png at " << full_path << LL_ENDL;
-    }
-    else if (gDirUtilp->fileExists(full_path))
+    image = LLViewerTextureManager::getFetchedTextureFromUrl("file://" + full_path, FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
+        0, 0, IMG_LOGO_FMOD);
+    if (image)
     {
-        image = LLViewerTextureManager::getFetchedTextureFromUrl("file://" + full_path, FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE,
-            0, 0, IMG_LOGO_FMOD);
-        if (image)
-        {
-            image->setAddressMode(LLTexUnit::TAM_WRAP);
-            mImagePreloads.insert(image);
-            // Speed up load (this texture will be used early)
-            image->setKnownDrawSize(364, 98);
-            image->processTextureStats();
-            image->setDecodePriority(LLViewerFetchedTexture::maxDecodePriority());
-            image->updateFetch();
-            // Fmod logo is only needed at startup, if we will get more logos
-            // for startup, might be good idea to save resources and do loading
-            // in scope of llprogressview and then unload everything once no
-            // longer needed
-        }
+        image->setAddressMode(LLTexUnit::TAM_WRAP);
+        mImagePreloads.insert(image);
+        // Speed up load (this texture will be used early)
+        image->setKnownDrawSize(364, 98);
+        image->processTextureStats();
+        image->setDecodePriority(LLViewerFetchedTexture::maxDecodePriority());
+        image->updateFetch();
+        // Fmod logo is only needed at startup, if we will get more logos
+        // for startup, might be good idea to save resources and do loading
+        // in scope of llprogressview and then unload everything once no
+        // longer needed
     }
+#endif
 
 	LLPointer<LLImageRaw> img_blak_square_tex(new LLImageRaw(2, 2, 3));
 	memset(img_blak_square_tex->getData(), 0, img_blak_square_tex->getDataSize());
-- 
GitLab