Merge branch 'master' of github.com:singularity-viewer/SingularityViewer
This commit is contained in:
@@ -133,6 +133,26 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
|
||||
|
||||
parameters.cp_reduce = base.getRawDiscardLevel();
|
||||
|
||||
if(parameters.cp_reduce == 0 && *(U16*)(base.getData() + base.getDataSize() - 2) != 0xD9FF)
|
||||
{
|
||||
bool failed = true;
|
||||
for(S32 i = base.getDataSize()-1; i > 42; --i)
|
||||
{
|
||||
if(base.getData()[i] != 0x00)
|
||||
{
|
||||
failed = *(U16*)(base.getData()+i-1) != 0xD9FF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(failed)
|
||||
{
|
||||
opj_image_destroy(image);
|
||||
base.decodeFailed();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* decode the code-stream */
|
||||
/* ---------------------- */
|
||||
|
||||
@@ -212,7 +232,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
|
||||
|
||||
if(image->numcomps <= first_channel)
|
||||
{
|
||||
llwarns << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl;
|
||||
LL_WARNS("Texture") << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl;
|
||||
if (image)
|
||||
{
|
||||
opj_image_destroy(image);
|
||||
|
||||
@@ -48,8 +48,28 @@ LLDir_Win32::LLDir_Win32()
|
||||
|
||||
WCHAR w_str[MAX_PATH];
|
||||
|
||||
HRESULT (WINAPI* pSHGetKnownFolderPath)(REFKNOWNFOLDERID rfid, DWORD dwFlags, HANDLE hToken, PWSTR *ppszPath) = NULL;
|
||||
HMODULE shell = LoadLibrary(L"shell32");
|
||||
if(shell) //SHGetSpecialFolderPath is deprecated from Vista an onwards. Try to use SHGetKnownFolderPath if it's available
|
||||
{
|
||||
pSHGetKnownFolderPath = (HRESULT (WINAPI *)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *))GetProcAddress(shell, "SHGetKnownFolderPath");
|
||||
}
|
||||
|
||||
// Application Data is where user settings go
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_APPDATA, TRUE);
|
||||
if(pSHGetKnownFolderPath)
|
||||
{
|
||||
WCHAR* pPath = NULL;
|
||||
if((*pSHGetKnownFolderPath)(FOLDERID_RoamingAppData, 0, NULL, &pPath) == S_OK)
|
||||
wcscpy_s(w_str,pPath);
|
||||
else
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_APPDATA, TRUE);
|
||||
if(pPath)
|
||||
CoTaskMemFree(pPath);
|
||||
}
|
||||
else //XP doesn't support SHGetKnownFolderPath
|
||||
{
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_APPDATA, TRUE);
|
||||
}
|
||||
|
||||
mOSUserDir = utf16str_to_utf8str(llutf16string(w_str));
|
||||
|
||||
@@ -64,17 +84,14 @@ LLDir_Win32::LLDir_Win32()
|
||||
// We used to store the cache in AppData\Roaming, and the installer
|
||||
// cleans up that version on upgrade. JC
|
||||
|
||||
if(HMODULE shell = LoadLibrary(L"shell32")) //SHGetSpecialFolderPath is deprecated from Vista an onwards. Try to use SHGetSpecialFolderPath if it's available
|
||||
|
||||
if(pSHGetKnownFolderPath)
|
||||
{
|
||||
HRESULT (WINAPI* pSHGetKnownFolderPath)(REFKNOWNFOLDERID rfid, DWORD dwFlags, HANDLE hToken, PWSTR *ppszPath);
|
||||
pSHGetKnownFolderPath = (HRESULT (WINAPI *)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *))GetProcAddress(shell, "SHGetKnownFolderPath");
|
||||
WCHAR* pPath = NULL;
|
||||
if(pSHGetKnownFolderPath && (*pSHGetKnownFolderPath)(FOLDERID_LocalAppData, 0, NULL, &pPath) == S_OK)
|
||||
if((*pSHGetKnownFolderPath)(FOLDERID_LocalAppData, 0, NULL, &pPath) == S_OK)
|
||||
wcscpy_s(w_str,pPath);
|
||||
else
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_LOCAL_APPDATA, TRUE);
|
||||
|
||||
FreeLibrary(shell);
|
||||
if(pPath)
|
||||
CoTaskMemFree(pPath);
|
||||
}
|
||||
@@ -82,6 +99,10 @@ LLDir_Win32::LLDir_Win32()
|
||||
{
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_LOCAL_APPDATA, TRUE);
|
||||
}
|
||||
|
||||
if(shell)
|
||||
FreeLibrary(shell);
|
||||
|
||||
mOSCacheDir = utf16str_to_utf8str(llutf16string(w_str));
|
||||
|
||||
if (GetTempPath(MAX_PATH, w_str))
|
||||
|
||||
@@ -85,7 +85,7 @@ LLDebugView::LLDebugView(const std::string& name, const LLRect &rect)
|
||||
mFastTimerView->setVisible(FALSE); // start invisible
|
||||
addChild(mFastTimerView);
|
||||
|
||||
r.set(150, rect.getHeight() - 50, 870, 100);
|
||||
r.set(150, rect.getHeight() - 50, 970, 100);
|
||||
LLTextureView::Params tvp;
|
||||
tvp.name("gTextureView");
|
||||
tvp.rect(r);
|
||||
|
||||
@@ -163,7 +163,7 @@ LLPanelGroup::LLPanelGroup(const LLUUID& group_id)
|
||||
|
||||
LLGroupMgr::getInstance()->addObserver(this);
|
||||
|
||||
mCommitCallbackRegistrar.add("Group.CopyURI", boost::bind(copy_group_profile_uri, group_id));
|
||||
mCommitCallbackRegistrar.add("Group.CopyURI", boost::bind(copy_group_profile_uri, boost::ref(mID)));
|
||||
// Pass on construction of this panel to the control factory.
|
||||
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap());
|
||||
}
|
||||
|
||||
@@ -373,9 +373,9 @@ bool LLTextureCacheRemoteWorker::doRead()
|
||||
if (!done && (mState == LOCAL))
|
||||
{
|
||||
llassert(local_size != 0); // we're assuming there is a non empty local file here...
|
||||
if (!mDataSize || mDataSize > local_size - mOffset)
|
||||
if (!mDataSize || mDataSize > local_size/* - mOffset*/)
|
||||
{
|
||||
mDataSize = local_size - mOffset;
|
||||
mDataSize = local_size/* - mOffset*/;
|
||||
}
|
||||
// Allocate read buffer
|
||||
mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -84,8 +84,14 @@ public:
|
||||
S32 getFetchState(const LLUUID& id, F32& decode_progress_p, F32& requested_priority_p,
|
||||
U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p, bool& can_use_http);
|
||||
void dump();
|
||||
S32 getNumRequests() ;
|
||||
U32 getTotalNumHTTPRequests() ;
|
||||
// Threads: T*
|
||||
S32 getNumRequests();
|
||||
|
||||
// Threads: T*
|
||||
S32 getNumHTTPRequests();
|
||||
|
||||
// Threads: T*
|
||||
U32 getTotalNumHTTPRequests();
|
||||
|
||||
// Public for access by callbacks
|
||||
S32 getPending();
|
||||
|
||||
@@ -81,7 +81,7 @@ static std::string title_string1a("Tex UUID Area DDis(Req) DecodePri(Fetch)
|
||||
static std::string title_string1b("Tex UUID Area DDis(Req) Fetch(DecodePri) [download] pk/max");
|
||||
static std::string title_string2("State");
|
||||
static std::string title_string3("Pkt Bnd");
|
||||
static std::string title_string4(" W x H (Dis) Mem");
|
||||
static std::string title_string4(" W x H (Dis) Mem Type");
|
||||
|
||||
static S32 title_x1 = 0;
|
||||
static S32 title_x2 = 460;
|
||||
@@ -211,6 +211,9 @@ void LLTextureBar::draw()
|
||||
std::string uuid_str;
|
||||
mImagep->mID.toString(uuid_str);
|
||||
uuid_str = uuid_str.substr(0,7);
|
||||
|
||||
std::string vsstr = llformat("%f",mImagep->mMaxVirtualSize);
|
||||
std::string dpstr = llformat("%f",mImagep->getDecodePriority());
|
||||
if (mTextureView->mOrderFetch)
|
||||
{
|
||||
tex_str = llformat("%s %7.0f %d(%d) 0x%08x(%8.0f)",
|
||||
@@ -223,14 +226,14 @@ void LLTextureBar::draw()
|
||||
}
|
||||
else
|
||||
{
|
||||
tex_str = llformat("%s %7.0f %d(%d) %8.0f(0x%08x) %1.2f",
|
||||
tex_str = llformat("%s %7.0f %d(%d) %8.0f(0x%08x) %3d%%",
|
||||
uuid_str.c_str(),
|
||||
mImagep->mMaxVirtualSize,
|
||||
mImagep->mDesiredDiscardLevel,
|
||||
mImagep->mRequestedDiscardLevel,
|
||||
mImagep->getDecodePriority(),
|
||||
mImagep->mFetchPriority,
|
||||
mImagep->mDownloadProgress);
|
||||
llfloor(mImagep->mDownloadProgress*100.f));
|
||||
}
|
||||
|
||||
LLFontGL::getFontMonospace()->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(),
|
||||
@@ -239,12 +242,14 @@ void LLTextureBar::draw()
|
||||
// State
|
||||
// Hack: mirrored from lltexturefetch.cpp
|
||||
struct { const std::string desc; LLColor4 color; } fetch_state_desc[] = {
|
||||
{ "---", LLColor4::red }, // INVALID
|
||||
{ "-?-", LLColor4::red }, // INVALID
|
||||
{ "INI", LLColor4::white }, // INIT
|
||||
{ "DSK", LLColor4::cyan }, // LOAD_FROM_TEXTURE_CACHE
|
||||
{ "DSK", LLColor4::blue }, // CACHE_POST
|
||||
{ "NET", LLColor4::green }, // LOAD_FROM_NETWORK
|
||||
{ "SIM", LLColor4::green }, // LOAD_FROM_SIMULATOR
|
||||
{ "REQ", LLColor4::magenta },// SEND_UDP_REQ
|
||||
{ "UDP", LLColor4::cyan }, // WAIT_UDP_REQ
|
||||
{ "REQ", LLColor4::yellow },// SEND_HTTP_REQ
|
||||
{ "HTP", LLColor4::green }, // WAIT_HTTP_REQ
|
||||
{ "DEC", LLColor4::yellow },// DECODE_IMAGE
|
||||
@@ -252,12 +257,12 @@ void LLTextureBar::draw()
|
||||
{ "WRT", LLColor4::purple },// WRITE_TO_CACHE
|
||||
{ "WRT", LLColor4::orange },// WAIT_ON_WRITE
|
||||
{ "END", LLColor4::red }, // DONE
|
||||
#define LAST_STATE 12
|
||||
#define LAST_STATE 14
|
||||
{ "CRE", LLColor4::magenta }, // LAST_STATE+1
|
||||
{ "FUL", LLColor4::green }, // LAST_STATE+2
|
||||
{ "BAD", LLColor4::red }, // LAST_STATE+3
|
||||
{ "MIS", LLColor4::red }, // LAST_STATE+4
|
||||
{ "---", LLColor4::white }, // LAST_STATE+5
|
||||
{ "-!-", LLColor4::white }, // LAST_STATE+5
|
||||
};
|
||||
const S32 fetch_state_desc_size = (S32)LL_ARRAY_SIZE(fetch_state_desc);
|
||||
S32 state =
|
||||
@@ -370,8 +375,39 @@ void LLTextureBar::draw()
|
||||
|
||||
// draw the image size at the end
|
||||
{
|
||||
std::string num_str = llformat("%3dx%3d (%d) %7d", mImagep->getWidth(), mImagep->getHeight(),
|
||||
mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory() : 0);
|
||||
std::string boost_lvl("UNKNOWN");
|
||||
switch(mImagep->getBoostLevel())
|
||||
{
|
||||
#define BOOST_LVL(type) case LLGLTexture::BOOST_##type: boost_lvl="B_"#type; break;
|
||||
#define CAT_LVL(type) case LLGLTexture::type: boost_lvl=#type; break;
|
||||
BOOST_LVL(NONE)
|
||||
BOOST_LVL(AVATAR_BAKED)
|
||||
BOOST_LVL(AVATAR)
|
||||
BOOST_LVL(CLOUDS)
|
||||
BOOST_LVL(SCULPTED)
|
||||
BOOST_LVL(HIGH)
|
||||
BOOST_LVL(BUMP)
|
||||
BOOST_LVL(TERRAIN)
|
||||
BOOST_LVL(SELECTED)
|
||||
BOOST_LVL(AVATAR_BAKED_SELF)
|
||||
BOOST_LVL(AVATAR_SELF)
|
||||
BOOST_LVL(SUPER_HIGH)
|
||||
BOOST_LVL(HUD)
|
||||
BOOST_LVL(ICON)
|
||||
BOOST_LVL(UI)
|
||||
BOOST_LVL(PREVIEW)
|
||||
BOOST_LVL(MAP)
|
||||
BOOST_LVL(MAP_VISIBLE)
|
||||
CAT_LVL(LOCAL)
|
||||
CAT_LVL(AVATAR_SCRATCH_TEX)
|
||||
CAT_LVL(DYNAMIC_TEX)
|
||||
CAT_LVL(MEDIA)
|
||||
CAT_LVL(OTHER)
|
||||
CAT_LVL(MAX_GL_IMAGE_CATEGORY)
|
||||
default:;
|
||||
};
|
||||
std::string num_str = llformat("%4dx%4d (%+d) %7d %s", mImagep->getWidth(), mImagep->getHeight(),
|
||||
mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory() : 0, boost_lvl.c_str());
|
||||
LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color,
|
||||
LLFontGL::LEFT, LLFontGL::TOP);
|
||||
}
|
||||
|
||||
@@ -926,7 +926,7 @@ void LLViewerFetchedTexture::init(bool firstinit)
|
||||
mIsMissingAsset = FALSE;
|
||||
|
||||
mLoadedCallbackDesiredDiscardLevel = S8_MAX;
|
||||
mPauseLoadedCallBacks = TRUE ;
|
||||
mPauseLoadedCallBacks = FALSE ;
|
||||
|
||||
mNeedsCreateTexture = FALSE;
|
||||
|
||||
@@ -1288,6 +1288,7 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
|
||||
// An inappropriately-sized image was uploaded (through a non standard client)
|
||||
// We treat these images as missing assets which causes them to
|
||||
// be renderd as 'missing image' and to stop requesting data
|
||||
llwarns << "!size_ok, setting as missing" << llendl;
|
||||
setIsMissingAsset();
|
||||
destroyRawImage();
|
||||
return FALSE;
|
||||
@@ -1712,6 +1713,7 @@ bool LLViewerFetchedTexture::updateFetch()
|
||||
{
|
||||
//discard all oversized textures.
|
||||
destroyRawImage();
|
||||
llwarns << "oversize, setting as missing" << llendl;
|
||||
setIsMissingAsset();
|
||||
mRawDiscardLevel = INVALID_DISCARD_LEVEL ;
|
||||
mIsFetching = FALSE ;
|
||||
@@ -1741,6 +1743,10 @@ bool LLViewerFetchedTexture::updateFetch()
|
||||
// We finished but received no data
|
||||
if (current_discard < 0)
|
||||
{
|
||||
llwarns << "!mIsFetching, setting as missing, decode_priority " << decode_priority
|
||||
<< " mRawDiscardLevel " << mRawDiscardLevel
|
||||
<< " current_discard " << current_discard
|
||||
<< llendl;
|
||||
setIsMissingAsset();
|
||||
desired_discard = -1;
|
||||
}
|
||||
@@ -1781,6 +1787,10 @@ bool LLViewerFetchedTexture::updateFetch()
|
||||
{
|
||||
make_request = false;
|
||||
}
|
||||
else if(mDesiredDiscardLevel > getMaxDiscardLevel())
|
||||
{
|
||||
make_request = false;
|
||||
}
|
||||
else if (mNeedsCreateTexture || mIsMissingAsset)
|
||||
{
|
||||
make_request = false;
|
||||
@@ -1789,6 +1799,11 @@ bool LLViewerFetchedTexture::updateFetch()
|
||||
{
|
||||
make_request = false;
|
||||
}
|
||||
else if(mCachedRawImage.notNull() && (current_discard < 0 || current_discard > mCachedRawDiscardLevel))
|
||||
{
|
||||
make_request = false;
|
||||
switchToCachedImage() ; //use the cached raw data first
|
||||
}
|
||||
//else if (!isJustBound() && mCachedRawImageReady)
|
||||
//{
|
||||
// make_request = false;
|
||||
@@ -1881,11 +1896,14 @@ void LLViewerFetchedTexture::forceToDeleteRequest()
|
||||
{
|
||||
if (mHasFetcher)
|
||||
{
|
||||
LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
|
||||
//LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
|
||||
mHasFetcher = FALSE;
|
||||
mIsFetching = FALSE ;
|
||||
resetTextureStats();
|
||||
}
|
||||
|
||||
resetTextureStats();
|
||||
|
||||
mDesiredDiscardLevel = getMaxDiscardLevel() + 1; //defer LLAppViewer::getTextureFetch()->deleteRequest to updateFetch?
|
||||
}
|
||||
|
||||
void LLViewerFetchedTexture::setIsMissingAsset()
|
||||
@@ -1928,10 +1946,18 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call
|
||||
mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level) ;
|
||||
}
|
||||
|
||||
if(mPauseLoadedCallBacks && !pause)
|
||||
if(mPauseLoadedCallBacks)
|
||||
{
|
||||
unpauseLoadedCallbacks(src_callback_list) ;
|
||||
if(!pause)
|
||||
{
|
||||
unpauseLoadedCallbacks(src_callback_list) ;
|
||||
}
|
||||
}
|
||||
else if(pause)
|
||||
{
|
||||
pauseLoadedCallbacks(src_callback_list) ;
|
||||
}
|
||||
|
||||
LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, this, pause);
|
||||
mLoadedCallbackList.push_back(entryp);
|
||||
|
||||
|
||||
@@ -1466,6 +1466,7 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **
|
||||
LLViewerFetchedTexture* image = gTextureList.findImage( image_id );
|
||||
if( image )
|
||||
{
|
||||
llwarns << "not in db" << llendl;
|
||||
image->setIsMissingAsset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3768,6 +3768,23 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
|
||||
else if (!getParent() && mIsSitting && !isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED))
|
||||
{
|
||||
getOffObject();
|
||||
//<edit>
|
||||
//Singu note: this appears to be a safety catch:
|
||||
// when getParent() is NULL and we're note playing ANIM_AGENT_SIT_GROUND_CONSTRAINED then we aren't sitting!
|
||||
// The previous call existed in an attempt to fix this inconsistent state by standing up from an object.
|
||||
// However, since getParent() is NULL that function would crash!
|
||||
// Since we never got crash reports regarding to this, that apparently never happened, except, I discovered
|
||||
// today, when you are ground sitting and then LLMotionController::deleteAllMotions or
|
||||
// LLMotionController::deactivateAllMotions is called, which seems to only happen when previewing an
|
||||
// to-be-uploaded animation on your own avatar (while ground sitting).
|
||||
// Hence, we DO need this safety net but not for standing up from an object but for standing up from the ground.
|
||||
// I fixed the crash in getOffObject(), so it's ok to call that. In order to make things consistent with
|
||||
// the server we need to actually stand up though, or we can't move anymore afterwards.
|
||||
if (isSelf())
|
||||
{
|
||||
gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
|
||||
}
|
||||
//</edit>
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
@@ -6564,7 +6581,7 @@ void LLVOAvatar::getOffObject()
|
||||
|
||||
gAgentCamera.setSitCamera(LLUUID::null);
|
||||
|
||||
if (!sit_object->permYouOwner() && gSavedSettings.getBOOL("RevokePermsOnStandUp"))
|
||||
if (sit_object && !sit_object->permYouOwner() && gSavedSettings.getBOOL("RevokePermsOnStandUp"))
|
||||
{
|
||||
gMessageSystem->newMessageFast(_PREHASH_RevokePermissions);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
|
||||
Reference in New Issue
Block a user