aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimage.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llviewerimage.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerimage.cpp59
1 files changed, 54 insertions, 5 deletions
diff --git a/linden/indra/newview/llviewerimage.cpp b/linden/indra/newview/llviewerimage.cpp
index 7cac905..0316c10 100644
--- a/linden/indra/newview/llviewerimage.cpp
+++ b/linden/indra/newview/llviewerimage.cpp
@@ -206,6 +206,16 @@ LLViewerImage::LLViewerImage(const LLUUID& id, BOOL usemipmaps)
206 sImageCount++; 206 sImageCount++;
207} 207}
208 208
209LLViewerImage::LLViewerImage(const LLString& filename, const LLUUID& id, BOOL usemipmaps)
210 : LLImageGL(usemipmaps),
211 mID(id)
212{
213 mLocalFileName = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "textures", filename);
214 init(true);
215 sImageCount++;
216}
217
218
209LLViewerImage::LLViewerImage(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) 219LLViewerImage::LLViewerImage(const U32 width, const U32 height, const U8 components, BOOL usemipmaps)
210 : LLImageGL(width, height, components, usemipmaps) 220 : LLImageGL(width, height, components, usemipmaps)
211{ 221{
@@ -232,6 +242,8 @@ void LLViewerImage::init(bool firstinit)
232{ 242{
233 mFullWidth = 0; 243 mFullWidth = 0;
234 mFullHeight = 0; 244 mFullHeight = 0;
245 mOrigWidth = 0;
246 mOrigHeight = 0;
235 mNeedsAux = FALSE; 247 mNeedsAux = FALSE;
236 mTexelsPerImage = 64.f*64.f; 248 mTexelsPerImage = 64.f*64.f;
237 mMaxVirtualSize = 0.f; 249 mMaxVirtualSize = 0.f;
@@ -290,6 +302,8 @@ void LLViewerImage::dump()
290 << " mIsMissingAsset " << (S32)mIsMissingAsset 302 << " mIsMissingAsset " << (S32)mIsMissingAsset
291 << " mFullWidth " << mFullWidth 303 << " mFullWidth " << mFullWidth
292 << " mFullHeight " << mFullHeight 304 << " mFullHeight " << mFullHeight
305 << " mOrigWidth" << mOrigWidth
306 << " mOrigHeight" << mOrigHeight
293 << llendl; 307 << llendl;
294} 308}
295 309
@@ -359,6 +373,22 @@ BOOL LLViewerImage::createTexture(S32 usename/*= 0*/)
359 BOOL res = TRUE; 373 BOOL res = TRUE;
360 if (!gNoRender) 374 if (!gNoRender)
361 { 375 {
376 // store original size only for locally-sourced images
377 if (!mLocalFileName.empty())
378 {
379 mOrigWidth = mRawImage->getWidth();
380 mOrigHeight = mRawImage->getHeight();
381
382 // leave black border, do not scale image content
383 mRawImage->expandToPowerOfTwo(MAX_IMAGE_SIZE, FALSE);
384 }
385 else
386 {
387 mOrigWidth = mFullWidth;
388 mOrigHeight = mFullHeight;
389 }
390
391
362 if (LLImageGL::checkSize(mRawImage->getWidth(), mRawImage->getHeight())) 392 if (LLImageGL::checkSize(mRawImage->getWidth(), mRawImage->getHeight()))
363 { 393 {
364 res = LLImageGL::createGLTexture(mRawDiscardLevel, mRawImage, usename); 394 res = LLImageGL::createGLTexture(mRawDiscardLevel, mRawImage, usename);
@@ -592,6 +622,10 @@ F32 LLViewerImage::calcDecodePriority()
592 // Don't decode anything we don't need 622 // Don't decode anything we don't need
593 priority = -1.0f; 623 priority = -1.0f;
594 } 624 }
625 else if (mBoostLevel == LLViewerImage::BOOST_UI)
626 {
627 priority = 1.f;
628 }
595 else if (pixel_priority <= 0.f && (cur_discard < 0 || mDesiredDiscardLevel < cur_discard)) 629 else if (pixel_priority <= 0.f && (cur_discard < 0 || mDesiredDiscardLevel < cur_discard))
596 { 630 {
597 // Not on screen but we might want some data 631 // Not on screen but we might want some data
@@ -782,12 +816,11 @@ bool LLViewerImage::updateFetch()
782 816
783 if (!mIsFetching) 817 if (!mIsFetching)
784 { 818 {
785 if (mRawDiscardLevel < 0) 819 if (mRawDiscardLevel < 0 || mRawDiscardLevel == INVALID_DISCARD_LEVEL)
786 { 820 {
787 // We finished but received no data 821 // We finished but received no data
788 if (current_discard < 0) 822 if (current_discard < 0)
789 { 823 {
790 llwarns << mID << ": Marking image as missing" << llendl;
791 setIsMissingAsset(); 824 setIsMissingAsset();
792 desired_discard = -1; 825 desired_discard = -1;
793 } 826 }
@@ -864,9 +897,23 @@ bool LLViewerImage::updateFetch()
864 desired_discard = llmax(desired_discard, current_discard-2); 897 desired_discard = llmax(desired_discard, current_discard-2);
865 } 898 }
866 } 899 }
867 if (LLAppViewer::getTextureFetch()->createRequest(getID(),getTargetHost(), decode_priority, 900
868 w, h, c, desired_discard, 901 // bypass texturefetch directly by pulling from LLTextureCache
869 needsAux())) 902 bool fetch_request_created = false;
903 if (mLocalFileName.empty())
904 {
905 fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(getID(), getTargetHost(), decode_priority,
906 w, h, c, desired_discard,
907 needsAux());
908 }
909 else
910 {
911 fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mLocalFileName, getID(),getTargetHost(), decode_priority,
912 w, h, c, desired_discard,
913 needsAux());
914 }
915
916 if (fetch_request_created)
870 { 917 {
871 mHasFetcher = TRUE; 918 mHasFetcher = TRUE;
872 mIsFetching = TRUE; 919 mIsFetching = TRUE;
@@ -874,6 +921,7 @@ bool LLViewerImage::updateFetch()
874 mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority, 921 mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority,
875 mFetchPriority, mFetchDeltaTime, mRequestDeltaTime); 922 mFetchPriority, mFetchDeltaTime, mRequestDeltaTime);
876 } 923 }
924
877 // if createRequest() failed, we're finishing up a request for this UUID, 925 // if createRequest() failed, we're finishing up a request for this UUID,
878 // wait for it to complete 926 // wait for it to complete
879 } 927 }
@@ -896,6 +944,7 @@ bool LLViewerImage::updateFetch()
896 944
897void LLViewerImage::setIsMissingAsset() 945void LLViewerImage::setIsMissingAsset()
898{ 946{
947 llwarns << mLocalFileName << " " << mID << ": Marking image as missing" << llendl;
899 if (mHasFetcher) 948 if (mHasFetcher)
900 { 949 {
901 LLAppViewer::getTextureFetch()->deleteRequest(getID(), true); 950 LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);