diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llrender/llfontfreetype.cpp | 64 | ||||
-rw-r--r-- | indra/llrender/llfontfreetype.h | 2 | ||||
-rw-r--r-- | indra/llrender/llfontregistry.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llbadge.cpp | 10 | ||||
-rw-r--r-- | indra/llui/llbadge.h | 3 | ||||
-rw-r--r-- | indra/llui/llbadgeowner.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llbadgeowner.h | 1 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 94 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 4 | ||||
-rw-r--r-- | indra/newview/llfloatermemleak.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llfloaterreporter.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llfloaterreporter.h | 1 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llpanelmarketplaceinboxinventory.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llpanelobjectinventory.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llpreviewscript.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewertextureanim.cpp | 6 |
18 files changed, 175 insertions, 71 deletions
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index de26d19efc..5c1f4ff8b3 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -106,6 +106,8 @@ LLFontFreetype::LLFontFreetype() mAscender(0.f), mDescender(0.f), mLineHeight(0.f), + pFontBuffer(NULL), + mBufferSize(0), mIsFallback(FALSE), mFTFace(NULL), mRenderGlyphCount(0), @@ -128,6 +130,8 @@ LLFontFreetype::~LLFontFreetype() mCharGlyphInfoMap.clear(); delete mFontBitmapCachep; + delete pFontBuffer; + disclaimMem(mBufferSize); // mFallbackFonts cleaned up by LLPointer destructor } @@ -143,13 +147,64 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v int error; +#ifdef LL_WINDOWS + + if (mBufferSize > 0) + { + delete pFontBuffer; + disclaimMem(mBufferSize); + pFontBuffer = NULL; + mBufferSize = 0; + } + + S32 file_size = 0; + LLFILE* file = LLFile::fopen(filename, "rb"); + if (!file) + { + return FALSE; + } + + if (!fseek(file, 0, SEEK_END)) + { + file_size = ftell(file); + fseek(file, 0, SEEK_SET); + } + + // Don't delete before FT_Done_Face + pFontBuffer = new(std::nothrow) U8[file_size]; + if (!pFontBuffer) + { + fclose(file); + return FALSE; + } + + mBufferSize = fread(pFontBuffer, 1, file_size, file); + fclose(file); + + if (mBufferSize != file_size) + { + delete pFontBuffer; + mBufferSize = 0; + return FALSE; + } + + error = FT_New_Memory_Face( gFTLibrary, + (FT_Byte*) pFontBuffer, + mBufferSize, + 0, + &mFTFace); +#else error = FT_New_Face( gFTLibrary, filename.c_str(), 0, - &mFTFace ); + &mFTFace); +#endif - if (error) + if (error) { + delete pFontBuffer; + pFontBuffer = NULL; + mBufferSize = 0; return FALSE; } @@ -166,10 +221,15 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v { // Clean up freetype libs. FT_Done_Face(mFTFace); + delete pFontBuffer; + pFontBuffer = NULL; + mBufferSize = 0; mFTFace = NULL; return FALSE; } + claimMem(mBufferSize); + F32 y_max, y_min, x_max, x_min; F32 ems_per_unit = 1.f/ mFTFace->units_per_EM; F32 pixels_per_unit = pixels_per_em * ems_per_unit; diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index a5ece42b88..26ba695418 100644 --- a/indra/llrender/llfontfreetype.h +++ b/indra/llrender/llfontfreetype.h @@ -158,6 +158,8 @@ private: F32 mLineHeight; LLFT_Face mFTFace; + U8* pFontBuffer; + S32 mBufferSize; BOOL mIsFallback; font_vector_t mFallbackFonts; // A list of fallback fonts to look for glyphs in (for Unicode chars) diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index d003687415..3c829596ce 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -447,7 +447,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) if (!fontp->loadFace(font_path, extra_scale * point_size, LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback)) { - LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << LL_ENDL; + LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << " from path " << local_path << LL_ENDL; delete fontp; fontp = NULL; } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index f10301b42d..c06fdd9700 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -191,6 +191,10 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) if (mUsage != GL_DYNAMIC_COPY_ARB) { //data will be provided by application ret = (U8*) ll_aligned_malloc<64>(size); + if (!ret) + { + LL_ERRS() << "Failed to allocate for LLVBOPool buffer" << LL_ENDL; + } } } else diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 15b6899d74..589b75ab5b 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -102,6 +102,7 @@ LLBadge::LLBadge(const LLBadge::Params& p) , mPaddingHoriz(p.padding_horiz) , mPaddingVert(p.padding_vert) , mParentScroller(NULL) + , mDrawAtParentTop(false) { if (mImage.isNull()) { @@ -307,7 +308,14 @@ void LLBadge::draw() // Compute y position if (mLocationOffsetVCenter == BADGE_OFFSET_NOT_SPECIFIED) { - badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; + if(mDrawAtParentTop) + { + badge_center_y = owner_rect.mTop - badge_height * 0.5f - 1; + } + else + { + badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; + } } else { diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index 4b21a71aaa..55f92e6e34 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -137,6 +137,8 @@ public: const std::string getLabel() const { return wstring_to_utf8str(mLabel); } void setLabel( const LLStringExplicit& label); + void setDrawAtParentTop(bool draw_at_top) { mDrawAtParentTop = draw_at_top;} + private: LLPointer< LLUIImage > mBorderImage; LLUIColor mBorderColor; @@ -164,6 +166,7 @@ private: F32 mPaddingVert; LLScrollContainer* mParentScroller; + bool mDrawAtParentTop; }; // Build time optimization, generate once in .cpp file diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index 55e64bb940..0557cd4375 100644 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -64,6 +64,14 @@ void LLBadgeOwner::setBadgeVisibility(bool visible) } } +void LLBadgeOwner::setDrawBadgeAtTop(bool draw_at_top) +{ + if (mBadge) + { + mBadge->setDrawAtParentTop(draw_at_top); + } +} + void LLBadgeOwner::addBadgeToParentHolder() { LLView * owner_view = mBadgeOwnerView.get(); diff --git a/indra/llui/llbadgeowner.h b/indra/llui/llbadgeowner.h index 53c2de95c8..01ed95f3a3 100644 --- a/indra/llui/llbadgeowner.h +++ b/indra/llui/llbadgeowner.h @@ -45,6 +45,7 @@ public: bool hasBadgeHolderParent() const { return mHasBadgeHolderParent; }; void setBadgeVisibility(bool visible); + void setDrawBadgeAtTop(bool draw_at_top); private: diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index b33b3a6410..3b11c9ff75 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -353,6 +353,8 @@ BOOL gCrashOnStartup = FALSE; BOOL gLLErrorActivated = FALSE; BOOL gLogoutInProgress = FALSE; +BOOL gSimulateMemLeak = FALSE; + //////////////////////////////////////////////////////////// // Internal globals... that should be removed. static std::string gArgs; @@ -1318,6 +1320,35 @@ LLTrace::BlockTimerStatHandle FTM_FRAME("Frame"); bool LLAppViewer::frame() { + bool ret = false; + + if (gSimulateMemLeak) + { + try + { + ret = doFrame(); + } + catch (std::bad_alloc) + { + LLMemory::logMemoryInfo(TRUE); + LLFloaterMemLeak* mem_leak_instance = LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); + if (mem_leak_instance) + { + mem_leak_instance->stop(); + } + LL_WARNS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL; + } + } + else + { + ret = doFrame(); + } + + return ret; +} + +bool LLAppViewer::doFrame() +{ LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); LLSD newFrame; @@ -1338,7 +1369,6 @@ bool LLAppViewer::frame() //check memory availability information checkMemory() ; - try { pingMainloopTimeout("Main:MiscNativeWindowEvents"); @@ -1362,12 +1392,15 @@ bool LLAppViewer::frame() } //memory leaking simulation - LLFloaterMemLeak* mem_leak_instance = - LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); - if(mem_leak_instance) + if (gSimulateMemLeak) { - mem_leak_instance->idle() ; - } + LLFloaterMemLeak* mem_leak_instance = + LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); + if (mem_leak_instance) + { + mem_leak_instance->idle(); + } + } // canonical per-frame event mainloop.post(newFrame); @@ -1542,60 +1575,13 @@ bool LLAppViewer::frame() pingMainloopTimeout("Main:End"); } } - catch (const LLContinueError&) - { - LOG_UNHANDLED_EXCEPTION(""); - } - catch(std::bad_alloc) - { - LLMemory::logMemoryInfo(TRUE) ; - - //stop memory leaking simulation - LLFloaterMemLeak* mem_leak_instance = - LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); - if(mem_leak_instance) - { - mem_leak_instance->stop() ; - LL_WARNS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL ; - } - else - { - //output possible call stacks to log file. - LLError::LLCallStacks::print() ; - - LL_ERRS() << "Bad memory allocation in LLAppViewer::frame()!" << LL_ENDL ; - } - } - catch (...) - { - CRASH_ON_UNHANDLED_EXCEPTION(""); - } if (LLApp::isExiting()) { // Save snapshot for next time, if we made it through initialization if (STATE_STARTED == LLStartUp::getStartupState()) { - try - { - saveFinalSnapshot(); - } - catch(std::bad_alloc) - { - LL_WARNS() << "Bad memory allocation when saveFinalSnapshot() is called!" << LL_ENDL ; - - //stop memory leaking simulation - LLFloaterMemLeak* mem_leak_instance = - LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking"); - if(mem_leak_instance) - { - mem_leak_instance->stop() ; - } - } - catch (...) - { - CRASH_ON_UNHANDLED_EXCEPTION("saveFinalSnapshot()"); - } + saveFinalSnapshot(); } delete gServicePump; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 6eb45d2495..e5a8883725 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -222,6 +222,8 @@ protected: private: + bool doFrame(); + void initMaxHeapSize(); bool initThreads(); // Initialize viewer threads, return false on failure. bool initConfiguration(); // Initialize settings from the command line/config file. @@ -396,4 +398,6 @@ extern LLUUID gBlackSquareID; extern BOOL gRandomizeFramerate; extern BOOL gPeriodicSlowFrame; +extern BOOL gSimulateMemLeak; + #endif // LL_LLAPPVIEWER_H diff --git a/indra/newview/llfloatermemleak.cpp b/indra/newview/llfloatermemleak.cpp index 9edfe1e354..c43526acaf 100644 --- a/indra/newview/llfloatermemleak.cpp +++ b/indra/newview/llfloatermemleak.cpp @@ -42,6 +42,8 @@ U32 LLFloaterMemLeak::sTotalLeaked = 0 ; S32 LLFloaterMemLeak::sStatus = LLFloaterMemLeak::STOP ; BOOL LLFloaterMemLeak::sbAllocationFailed = FALSE ; +extern BOOL gSimulateMemLeak; + LLFloaterMemLeak::LLFloaterMemLeak(const LLSD& key) : LLFloater(key) { @@ -104,6 +106,7 @@ void LLFloaterMemLeak::release() sStatus = STOP ; sTotalLeaked = 0 ; sbAllocationFailed = FALSE ; + gSimulateMemLeak = FALSE; } void LLFloaterMemLeak::stop() @@ -140,8 +143,7 @@ void LLFloaterMemLeak::idle() } if(!p) { - sStatus = STOP ; - sbAllocationFailed = TRUE ; + stop(); } } @@ -181,6 +183,7 @@ void LLFloaterMemLeak::onChangeMaxMemLeaking() void LLFloaterMemLeak::onClickStart() { sStatus = START ; + gSimulateMemLeak = TRUE; } void LLFloaterMemLeak::onClickStop() diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index c0f5e63623..3a3660bb31 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -162,7 +162,8 @@ LLFloaterReporter::LLFloaterReporter(const LLSD& key) mPosition(), mCopyrightWarningSeen( FALSE ), mResourceDatap(new LLResourceData()), - mAvatarNameCacheConnection() + mAvatarNameCacheConnection(), + mSnapshotTimer() { } @@ -245,6 +246,12 @@ LLFloaterReporter::~LLFloaterReporter() void LLFloaterReporter::draw() { LLFloater::draw(); + static LLCachedControl<F32> screenshot_delay(gSavedSettings, "AbuseReportScreenshotDelay"); + if (mSnapshotTimer.getStarted() && mSnapshotTimer.getElapsedTimeF32() > screenshot_delay) + { + mSnapshotTimer.stop(); + takeNewSnapshot(); + } } void LLFloaterReporter::enableControls(BOOL enable) @@ -877,8 +884,7 @@ void LLFloaterReporter::onOpen(const LLSD& key) { childSetEnabled("send_btn", false); //Time delay to avoid UI artifacts. MAINT-7067 - doAfterInterval(boost::bind(&LLFloaterReporter::takeNewSnapshot,this), gSavedSettings.getF32("AbuseReportScreenshotDelay")); - + mSnapshotTimer.start(); } void LLFloaterReporter::onLoadScreenshotDialog(const LLSD& notification, const LLSD& response) @@ -950,6 +956,7 @@ void LLFloaterReporter::setPosBox(const LLVector3d &pos) void LLFloaterReporter::onClose(bool app_quitting) { + mSnapshotTimer.stop(); gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", app_quitting); } diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index decc01be98..f5ba63ce7f 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -149,6 +149,7 @@ private: LLPointer<LLImageRaw> mImageRaw; LLPointer<LLImageRaw> mPrevImageRaw; + LLFrameTimer mSnapshotTimer; }; #endif diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 3acfaeb049..67b51f11b3 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -6588,11 +6588,9 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) getClipboardEntries(true, items, disabled_items, flags); items.push_back(std::string("Wearable And Object Separator")); - items.push_back(std::string("Wearable Edit")); - bool modifiable = !gAgentWearables.isWearableModifiable(item->getUUID()); - if (((flags & FIRST_SELECTED_ITEM) == 0) || modifiable) + if (((flags & FIRST_SELECTED_ITEM) == 0) || (item && !gAgentWearables.isWearableModifiable(item->getUUID()))) { disabled_items.push_back(std::string("Wearable Edit")); } diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index 2d2ba30e9b..f089faea09 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -139,6 +139,7 @@ void LLInboxFolderViewFolder::draw() if (!hasBadgeHolderParent()) { addBadgeToParentHolder(); + setDrawBadgeAtTop(true); } setBadgeVisibility(mFresh); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index b5ee68ba25..c50f3477ad 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -696,6 +696,10 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Task Open")); } items.push_back(std::string("Task Properties")); + if ((flags & FIRST_SELECTED_ITEM) == 0) + { + disabled_items.push_back(std::string("Task Properties")); + } if(isItemRenameable()) { items.push_back(std::string("Task Rename")); @@ -1017,6 +1021,10 @@ void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } } items.push_back(std::string("Task Properties")); + if ((flags & FIRST_SELECTED_ITEM) == 0) + { + disabled_items.push_back(std::string("Task Properties")); + } if(isItemRenameable()) { items.push_back(std::string("Task Rename")); @@ -1388,6 +1396,10 @@ void LLTaskMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) } } items.push_back(std::string("Task Properties")); + if ((flags & FIRST_SELECTED_ITEM) == 0) + { + disabled_items.push_back(std::string("Task Properties")); + } if(isItemRenameable()) { items.push_back(std::string("Task Rename")); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 6ecc4c7fb9..945f3c370c 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -2041,7 +2041,15 @@ void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE); mScriptEd->makeEditorPristine(); - mScriptEd->setScriptName(getItem()->getName()); + + std::string script_name = DEFAULT_SCRIPT_NAME; + const LLInventoryItem* inv_item = getItem(); + + if(inv_item) + { + script_name = inv_item->getName(); + } + mScriptEd->setScriptName(script_name); } diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp index 9af92d7377..b94f6f4569 100644 --- a/indra/newview/llviewertextureanim.cpp +++ b/indra/newview/llviewertextureanim.cpp @@ -138,10 +138,8 @@ S32 LLViewerTextureAnim::animateTextures(F32 &off_s, F32 &off_t, { frame_counter = fmod(frame_counter, full_length); } - else - { - frame_counter = llmin(full_length - 1.f, frame_counter); - } + + frame_counter = llmin(full_length - 1.f, frame_counter); if (!(mMode & SMOOTH)) { |