diff options
Diffstat (limited to 'indra/llui')
211 files changed, 70 insertions, 2088 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 9c961d67d6..34a08603fa 100644..100755 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -25,6 +25,10 @@ include_directories( ${LLXML_INCLUDE_DIRS} ${LIBS_PREBUILD_DIR}/include/hunspell ) +include_directories(SYSTEM + ${LLCOMMON_SYSTEM_INCLUDE_DIRS} + ${LLXML_SYSTEM_INCLUDE_DIRS} + ) set(llui_SOURCE_FILES llaccordionctrl.cpp @@ -113,7 +117,6 @@ set(llui_SOURCE_FILES lluicolortable.cpp lluictrl.cpp lluictrlfactory.cpp - lluiimage.cpp lluistring.cpp llundo.cpp llurlaction.cpp @@ -227,7 +230,6 @@ set(llui_HEADER_FILES lluifwd.h llui.h lluicolor.h - lluiimage.h lluistring.h llundo.h llurlaction.h diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index d636161baf..d636161baf 100644..100755 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 1fe64c472e..1fe64c472e 100644..100755 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 43462bd244..43462bd244 100644..100755 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index dddaa581e6..dddaa581e6 100644..100755 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 8ede4e3468..8ede4e3468 100644..100755 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index 4b21a71aaa..4b21a71aaa 100644..100755 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h diff --git a/indra/llui/llbadgeholder.cpp b/indra/llui/llbadgeholder.cpp index 1f786f36ae..1f786f36ae 100644..100755 --- a/indra/llui/llbadgeholder.cpp +++ b/indra/llui/llbadgeholder.cpp diff --git a/indra/llui/llbadgeholder.h b/indra/llui/llbadgeholder.h index 2538eaae91..2538eaae91 100644..100755 --- a/indra/llui/llbadgeholder.h +++ b/indra/llui/llbadgeholder.h diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index 1860a05edd..1860a05edd 100644..100755 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp diff --git a/indra/llui/llbadgeowner.h b/indra/llui/llbadgeowner.h index 8d03e30645..8d03e30645 100644..100755 --- a/indra/llui/llbadgeowner.h +++ b/indra/llui/llbadgeowner.h diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index a8149a9a1d..a8149a9a1d 100644..100755 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 060db59a8a..060db59a8a 100644..100755 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h diff --git a/indra/llui/llcallbackmap.h b/indra/llui/llcallbackmap.h index 0a10877c09..0a10877c09 100644..100755 --- a/indra/llui/llcallbackmap.h +++ b/indra/llui/llcallbackmap.h diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index 6a1b48a08a..6a1b48a08a 100644..100755 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp diff --git a/indra/llui/llchatentry.h b/indra/llui/llchatentry.h index 49c8d21450..49c8d21450 100644..100755 --- a/indra/llui/llchatentry.h +++ b/indra/llui/llchatentry.h diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 5525520d78..5525520d78 100644..100755 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index 5ce45b2135..5ce45b2135 100644..100755 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 14173fdbb0..14173fdbb0 100644..100755 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index fd2e7610df..fd2e7610df 100644..100755 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 41e5d74042..d4e14d9419 100644..100755 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -551,7 +551,7 @@ void LLComboBox::showList() LLCoordWindow window_size; getWindow()->getSize(&window_size); //HACK: shouldn't have to know about scale here - mList->fitContents( 192, llfloor((F32)window_size.mY / LLUI::sGLScaleFactor.mV[VY]) - 50 ); + mList->fitContents( 192, llfloor((F32)window_size.mY / LLUI::getScaleFactor().mV[VY]) - 50 ); // Make sure that we can see the whole list LLRect root_view_local; diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 64dbaea306..64dbaea306 100644..100755 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 625fb8e870..625fb8e870 100644..100755 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index ff5a8a3257..ff5a8a3257 100644..100755 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 161496b1f5..c216d593a2 100644..100755 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -243,7 +243,6 @@ void LLConsole::draw() void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color) { LLSD paragraph_color_segments; - LLColor4 lcolor=color; paragraph_color_segments[0]["text"] =wstring_to_utf8str(mParagraphText); LLSD color_sd = color.getValue(); diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h index f32f1dd74c..f32f1dd74c 100644..100755 --- a/indra/llui/llconsole.h +++ b/indra/llui/llconsole.h diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp index e08ccb0b78..e08ccb0b78 100644..100755 --- a/indra/llui/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index e81600fd6c..e81600fd6c 100644..100755 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h diff --git a/indra/llui/llctrlselectioninterface.cpp b/indra/llui/llctrlselectioninterface.cpp index 7e886aff48..7e886aff48 100644..100755 --- a/indra/llui/llctrlselectioninterface.cpp +++ b/indra/llui/llctrlselectioninterface.cpp diff --git a/indra/llui/llctrlselectioninterface.h b/indra/llui/llctrlselectioninterface.h index 2cdcbd88fe..2cdcbd88fe 100644..100755 --- a/indra/llui/llctrlselectioninterface.h +++ b/indra/llui/llctrlselectioninterface.h diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 3396213f1c..3396213f1c 100644..100755 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 89c9852f4a..89c9852f4a 100644..100755 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index bd42497cb6..bd42497cb6 100644..100755 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index 98a9c7236d..98a9c7236d 100644..100755 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 5f69c6af31..5f69c6af31 100644..100755 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index e095e577b1..e095e577b1 100644..100755 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h diff --git a/indra/llui/lleditmenuhandler.cpp b/indra/llui/lleditmenuhandler.cpp index d48237e377..d48237e377 100644..100755 --- a/indra/llui/lleditmenuhandler.cpp +++ b/indra/llui/lleditmenuhandler.cpp diff --git a/indra/llui/lleditmenuhandler.h b/indra/llui/lleditmenuhandler.h index 0932f094ef..0932f094ef 100644..100755 --- a/indra/llui/lleditmenuhandler.h +++ b/indra/llui/lleditmenuhandler.h diff --git a/indra/llui/llf32uictrl.cpp b/indra/llui/llf32uictrl.cpp index d186f085b4..d186f085b4 100644..100755 --- a/indra/llui/llf32uictrl.cpp +++ b/indra/llui/llf32uictrl.cpp diff --git a/indra/llui/llf32uictrl.h b/indra/llui/llf32uictrl.h index 6e648f9102..6e648f9102 100644..100755 --- a/indra/llui/llf32uictrl.h +++ b/indra/llui/llf32uictrl.h diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp index d62874d793..d62874d793 100644..100755 --- a/indra/llui/llfiltereditor.cpp +++ b/indra/llui/llfiltereditor.cpp diff --git a/indra/llui/llfiltereditor.h b/indra/llui/llfiltereditor.h index 3a05bc05a1..3a05bc05a1 100644..100755 --- a/indra/llui/llfiltereditor.h +++ b/indra/llui/llfiltereditor.h diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp index e49628acd5..e49628acd5 100644..100755 --- a/indra/llui/llflashtimer.cpp +++ b/indra/llui/llflashtimer.cpp diff --git a/indra/llui/llflashtimer.h b/indra/llui/llflashtimer.h index c60f99a8ea..c60f99a8ea 100644..100755 --- a/indra/llui/llflashtimer.h +++ b/indra/llui/llflashtimer.h diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 97a52fada4..97a52fada4 100644..100755 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 92bf429031..92bf429031 100644..100755 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 09e27a264a..09e27a264a 100644..100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 4dba1e645f..4dba1e645f 100644..100755 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 1cdddf0d5b..1cdddf0d5b 100644..100755 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index a1e1f8a988..a1e1f8a988 100644..100755 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp index 7525b8cab3..7525b8cab3 100644..100755 --- a/indra/llui/llfloaterreglistener.cpp +++ b/indra/llui/llfloaterreglistener.cpp diff --git a/indra/llui/llfloaterreglistener.h b/indra/llui/llfloaterreglistener.h index 24311a2dfa..24311a2dfa 100644..100755 --- a/indra/llui/llfloaterreglistener.h +++ b/indra/llui/llfloaterreglistener.h diff --git a/indra/llui/llflyoutbutton.cpp b/indra/llui/llflyoutbutton.cpp index 4b3a0a5d21..4b3a0a5d21 100644..100755 --- a/indra/llui/llflyoutbutton.cpp +++ b/indra/llui/llflyoutbutton.cpp diff --git a/indra/llui/llflyoutbutton.h b/indra/llui/llflyoutbutton.h index 36998eba2e..36998eba2e 100644..100755 --- a/indra/llui/llflyoutbutton.h +++ b/indra/llui/llflyoutbutton.h diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 724d190307..724d190307 100644..100755 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 25ae1d2579..25ae1d2579 100644..100755 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 8feaf654f0..8aa1eb7cd5 100644..100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1055,12 +1055,6 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) LLMenuGL::sMenuContainer->hideMenus(); } - LLView *item = NULL; - if (getChildCount() > 0) - { - item = *(getChildList()->begin()); - } - switch( key ) { case KEY_F2: diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 11fccdace4..11fccdace4 100644..100755 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 3593804554..3593804554 100644..100755 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 1b61212c0e..1b61212c0e 100644..100755 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h diff --git a/indra/llui/llfunctorregistry.cpp b/indra/llui/llfunctorregistry.cpp index 8003324973..8003324973 100644..100755 --- a/indra/llui/llfunctorregistry.cpp +++ b/indra/llui/llfunctorregistry.cpp diff --git a/indra/llui/llfunctorregistry.h b/indra/llui/llfunctorregistry.h index 899cc3a326..beac212441 100644..100755 --- a/indra/llui/llfunctorregistry.h +++ b/indra/llui/llfunctorregistry.h @@ -69,7 +69,6 @@ public: bool registerFunctor(const std::string& name, ResponseFunctor f) { bool retval = true; - typename FunctorMap::iterator it = mMap.find(name); if (mMap.count(name) == 0) { mMap[name] = f; @@ -96,7 +95,6 @@ public: FUNCTOR_TYPE getFunctor(const std::string& name) { - typename FunctorMap::iterator it = mMap.find(name); if (mMap.count(name) != 0) { return mMap[name]; diff --git a/indra/llui/llhelp.h b/indra/llui/llhelp.h index 1726347a78..1726347a78 100644..100755 --- a/indra/llui/llhelp.h +++ b/indra/llui/llhelp.h diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 30b79b4d20..30b79b4d20 100644..100755 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index efa0925a4a..efa0925a4a 100644..100755 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index c1cd04186b..795dacdbb0 100644..100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -367,7 +367,6 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW const llwchar* base = wtext.c_str(); const llwchar* cur = base; - const llwchar* line = NULL; while( *cur ) { @@ -385,9 +384,6 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW } } - // Start of a new line - line = cur; - // Skip white space while( *cur && isspace(*cur) && (*cur != '\n') ) { diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index ac34015393..ac34015393 100644..100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index e642883991..e33ac1d5c2 100644..100755 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -476,7 +476,6 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) if (lp->mResizeBar == NULL) { LLResizeBar::Side side = (mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM; - LLRect resize_bar_rect = getRect(); LLResizeBar::Params resize_params; resize_params.name("resize"); diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 02c664f1a0..02c664f1a0 100644..100755 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h diff --git a/indra/llui/lllazyvalue.h b/indra/llui/lllazyvalue.h index 0fc95d9efa..0fc95d9efa 100644..100755 --- a/indra/llui/lllazyvalue.h +++ b/indra/llui/lllazyvalue.h diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 6976b06a92..5478e85e13 100644..100755 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -2023,8 +2023,8 @@ void LLLineEditor::draw() LLRect screen_pos = calcScreenRect(); LLCoordGL ime_pos( screen_pos.mLeft + pixels_after_scroll, screen_pos.mTop - lineeditor_v_pad ); - ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); - ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); + ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]); + ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]); getWindow()->setLanguageTextInput( ime_pos ); } } @@ -2571,7 +2571,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length) S32 LLLineEditor::getPreeditFontSize() const { - return llround(mGLFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]); + return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace) diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 40f931ecc1..40f931ecc1 100644..100755 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h diff --git a/indra/llui/llloadingindicator.cpp b/indra/llui/llloadingindicator.cpp index 1ede5b706f..1ede5b706f 100644..100755 --- a/indra/llui/llloadingindicator.cpp +++ b/indra/llui/llloadingindicator.cpp diff --git a/indra/llui/llloadingindicator.h b/indra/llui/llloadingindicator.h index ffcb329f42..ffcb329f42 100644..100755 --- a/indra/llui/llloadingindicator.h +++ b/indra/llui/llloadingindicator.h diff --git a/indra/llui/lllocalcliprect.cpp b/indra/llui/lllocalcliprect.cpp index 6841301219..0620e0f52d 100644..100755 --- a/indra/llui/lllocalcliprect.cpp +++ b/indra/llui/lllocalcliprect.cpp @@ -33,7 +33,7 @@ LLScreenClipRect::LLScreenClipRect(const LLRect& rect, BOOL enabled) -: mScissorState(GL_SCISSOR_TEST), + : mScissorState(GL_SCISSOR_TEST), mEnabled(enabled) { if (mEnabled) @@ -88,10 +88,10 @@ void LLScreenClipRect::updateScissorRegion() LLRect rect = sClipRectStack.top(); stop_glerror(); S32 x,y,w,h; - x = llfloor(rect.mLeft * LLUI::sGLScaleFactor.mV[VX]); - y = llfloor(rect.mBottom * LLUI::sGLScaleFactor.mV[VY]); - w = llmax(0, llceil(rect.getWidth() * LLUI::sGLScaleFactor.mV[VX])) + 1; - h = llmax(0, llceil(rect.getHeight() * LLUI::sGLScaleFactor.mV[VY])) + 1; + x = llfloor(rect.mLeft * LLUI::getScaleFactor().mV[VX]); + y = llfloor(rect.mBottom * LLUI::getScaleFactor().mV[VY]); + w = llmax(0, llceil(rect.getWidth() * LLUI::getScaleFactor().mV[VX])) + 1; + h = llmax(0, llceil(rect.getHeight() * LLUI::getScaleFactor().mV[VY])) + 1; glScissor( x,y,w,h ); stop_glerror(); } @@ -100,10 +100,10 @@ void LLScreenClipRect::updateScissorRegion() // LLLocalClipRect //--------------------------------------------------------------------------- LLLocalClipRect::LLLocalClipRect(const LLRect& rect, BOOL enabled /* = TRUE */) -: LLScreenClipRect(LLRect(rect.mLeft + LLFontGL::sCurOrigin.mX, - rect.mTop + LLFontGL::sCurOrigin.mY, - rect.mRight + LLFontGL::sCurOrigin.mX, - rect.mBottom + LLFontGL::sCurOrigin.mY), enabled) + : LLScreenClipRect(LLRect(rect.mLeft + LLFontGL::sCurOrigin.mX, + rect.mTop + LLFontGL::sCurOrigin.mY, + rect.mRight + LLFontGL::sCurOrigin.mX, + rect.mBottom + LLFontGL::sCurOrigin.mY), enabled) {} LLLocalClipRect::~LLLocalClipRect() diff --git a/indra/llui/lllocalcliprect.h b/indra/llui/lllocalcliprect.h index eeeaf2adb6..eeeaf2adb6 100644..100755 --- a/indra/llui/lllocalcliprect.h +++ b/indra/llui/lllocalcliprect.h diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 746ade4648..746ade4648 100644..100755 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index 67ec1983b3..67ec1983b3 100644..100755 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index f7bf39c897..f7bf39c897 100644..100755 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 51df5df1f8..51df5df1f8 100644..100755 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index 8c2be44904..8c2be44904 100644..100755 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp diff --git a/indra/llui/llmodaldialog.h b/indra/llui/llmodaldialog.h index 4e09d11d77..4e09d11d77 100644..100755 --- a/indra/llui/llmodaldialog.h +++ b/indra/llui/llmodaldialog.h diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 179b251cdb..179b251cdb 100644..100755 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index d992212650..d992212650 100644..100755 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 70bcfb5b4f..70bcfb5b4f 100644..100755 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 2b422e89c9..2b422e89c9 100644..100755 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 91e5b6b9de..91e5b6b9de 100644..100755 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index b6a3542376..b6a3542376 100644..100755 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h diff --git a/indra/llui/llnotificationptr.h b/indra/llui/llnotificationptr.h index acc047527f..acc047527f 100644..100755 --- a/indra/llui/llnotificationptr.h +++ b/indra/llui/llnotificationptr.h diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 1789f003b9..1789f003b9 100644..100755 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 87573c2a56..87573c2a56 100644..100755 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h diff --git a/indra/llui/llnotificationsutil.cpp b/indra/llui/llnotificationsutil.cpp index cc791c26d1..cc791c26d1 100644..100755 --- a/indra/llui/llnotificationsutil.cpp +++ b/indra/llui/llnotificationsutil.cpp diff --git a/indra/llui/llnotificationsutil.h b/indra/llui/llnotificationsutil.h index 4093324d0c..4093324d0c 100644..100755 --- a/indra/llui/llnotificationsutil.h +++ b/indra/llui/llnotificationsutil.h diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index 18a82190b5..18a82190b5 100644..100755 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h diff --git a/indra/llui/llnotificationvisibilityrule.h b/indra/llui/llnotificationvisibilityrule.h index 78788a275c..78788a275c 100644..100755 --- a/indra/llui/llnotificationvisibilityrule.h +++ b/indra/llui/llnotificationvisibilityrule.h diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 67472ad166..67472ad166 100644..100755 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index e63b41f97c..e63b41f97c 100644..100755 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h diff --git a/indra/llui/llprogressbar.cpp b/indra/llui/llprogressbar.cpp index 84a890edfa..84a890edfa 100644..100755 --- a/indra/llui/llprogressbar.cpp +++ b/indra/llui/llprogressbar.cpp diff --git a/indra/llui/llprogressbar.h b/indra/llui/llprogressbar.h index a8ec83ea00..a8ec83ea00 100644..100755 --- a/indra/llui/llprogressbar.h +++ b/indra/llui/llprogressbar.h diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 95a7d09382..95a7d09382 100644..100755 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h index 8bd5698538..8bd5698538 100644..100755 --- a/indra/llui/llradiogroup.h +++ b/indra/llui/llradiogroup.h diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index 15e56cbfe5..15e56cbfe5 100644..100755 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index 8190a95a71..8190a95a71 100644..100755 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 24794305ac..24794305ac 100644..100755 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h index 7541b9e6c0..7541b9e6c0 100644..100755 --- a/indra/llui/llresizehandle.h +++ b/indra/llui/llresizehandle.h diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 820e7cb26a..820e7cb26a 100644..100755 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp diff --git a/indra/llui/llresmgr.h b/indra/llui/llresmgr.h index a652dcd2c0..a652dcd2c0 100644..100755 --- a/indra/llui/llresmgr.h +++ b/indra/llui/llresmgr.h diff --git a/indra/llui/llrngwriter.cpp b/indra/llui/llrngwriter.cpp index 5e6840d7df..5e6840d7df 100644..100755 --- a/indra/llui/llrngwriter.cpp +++ b/indra/llui/llrngwriter.cpp diff --git a/indra/llui/llrngwriter.h b/indra/llui/llrngwriter.h index c33aa28613..c33aa28613 100644..100755 --- a/indra/llui/llrngwriter.h +++ b/indra/llui/llrngwriter.h diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 13887cbe73..13887cbe73 100644..100755 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index 21fd2d631e..21fd2d631e 100644..100755 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index cbcce0ece5..cbcce0ece5 100644..100755 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index 4eb43539b8..4eb43539b8 100644..100755 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp index 9b65c2b79d..9b65c2b79d 100644..100755 --- a/indra/llui/llscrollingpanellist.cpp +++ b/indra/llui/llscrollingpanellist.cpp diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h index e8df176ec3..e8df176ec3 100644..100755 --- a/indra/llui/llscrollingpanellist.h +++ b/indra/llui/llscrollingpanellist.h diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 8000efad0e..8000efad0e 100644..100755 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index d625ebddcc..d625ebddcc 100644..100755 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h diff --git a/indra/llui/llscrolllistcolumn.cpp b/indra/llui/llscrolllistcolumn.cpp index af124d9826..af124d9826 100644..100755 --- a/indra/llui/llscrolllistcolumn.cpp +++ b/indra/llui/llscrolllistcolumn.cpp diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h index b4d4a6d05e..b4d4a6d05e 100644..100755 --- a/indra/llui/llscrolllistcolumn.h +++ b/indra/llui/llscrolllistcolumn.h diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 7f04c92b27..7f04c92b27 100644..100755 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 8fa06cc499..8fa06cc499 100644..100755 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp index 5a1e96ab03..5a1e96ab03 100644..100755 --- a/indra/llui/llscrolllistitem.cpp +++ b/indra/llui/llscrolllistitem.cpp diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h index 13655b5873..13655b5873 100644..100755 --- a/indra/llui/llscrolllistitem.h +++ b/indra/llui/llscrolllistitem.h diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index ea96fc573d..ea96fc573d 100644..100755 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h index c2d7916938..c2d7916938 100644..100755 --- a/indra/llui/llsearcheditor.h +++ b/indra/llui/llsearcheditor.h diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index db72234f94..db72234f94 100644..100755 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 700c17ea3e..700c17ea3e 100644..100755 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 583ed1ed2e..583ed1ed2e 100644..100755 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 5153e33f49..5153e33f49 100644..100755 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index a189375fbe..250372da5b 100644..100755 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -145,10 +145,14 @@ void LLSpellChecker::refreshDictionaryMap() // Load dictionary information (file name, friendly name, ...) llifstream user_file(user_path + DICT_FILE_MAIN, std::ios::binary); - if ( (!user_file.is_open()) || (0 == LLSDSerialize::fromXMLDocument(sDictMap, user_file)) || (0 == sDictMap.size()) ) + if ( (!user_file.is_open()) + || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(sDictMap, user_file)) + || (0 == sDictMap.size()) ) { llifstream app_file(app_path + DICT_FILE_MAIN, std::ios::binary); - if ( (!app_file.is_open()) || (0 == LLSDSerialize::fromXMLDocument(sDictMap, app_file)) || (0 == sDictMap.size()) ) + if ( (!app_file.is_open()) + || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(sDictMap, app_file)) + || (0 == sDictMap.size()) ) { return; } diff --git a/indra/llui/llspellcheck.h b/indra/llui/llspellcheck.h index 4ab80195ea..4ab80195ea 100644..100755 --- a/indra/llui/llspellcheck.h +++ b/indra/llui/llspellcheck.h diff --git a/indra/llui/llspellcheckmenuhandler.h b/indra/llui/llspellcheckmenuhandler.h index d5c95bad39..d5c95bad39 100644..100755 --- a/indra/llui/llspellcheckmenuhandler.h +++ b/indra/llui/llspellcheckmenuhandler.h diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 8a728df2e7..8a728df2e7 100644..100755 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index e34add879d..e34add879d 100644..100755 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 04cce7878e..04cce7878e 100644..100755 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index 513fff3234..513fff3234 100644..100755 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index e44887ebf0..e44887ebf0 100644..100755 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h index 757525e232..757525e232 100644..100755 --- a/indra/llui/llstatgraph.h +++ b/indra/llui/llstatgraph.h diff --git a/indra/llui/llstatview.cpp b/indra/llui/llstatview.cpp index eda2d6047f..eda2d6047f 100644..100755 --- a/indra/llui/llstatview.cpp +++ b/indra/llui/llstatview.cpp diff --git a/indra/llui/llstatview.h b/indra/llui/llstatview.h index 5abdc42448..5abdc42448 100644..100755 --- a/indra/llui/llstatview.h +++ b/indra/llui/llstatview.h diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index bb731f4f7e..bb731f4f7e 100644..100755 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index 9f1eba79d8..9f1eba79d8 100644..100755 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 6f895ed939..fd98155704 100644..100755 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1215,9 +1215,11 @@ void LLTabContainer::removeTabPanel(LLPanel* child) removeChild( tuple->mButton ); } delete tuple->mButton; + tuple->mButton = NULL; removeChild( tuple->mTabPanel ); // delete tuple->mTabPanel; + tuple->mTabPanel = NULL; mTabList.erase( iter ); delete tuple; @@ -1279,9 +1281,11 @@ void LLTabContainer::deleteAllTabs() removeChild( tuple->mButton ); delete tuple->mButton; + tuple->mButton = NULL; removeChild( tuple->mTabPanel ); // delete tuple->mTabPanel; + tuple->mTabPanel = NULL; } // Actually delete the tuples themselves @@ -1484,9 +1488,8 @@ BOOL LLTabContainer::setTab(S32 which) { LLTabTuple* tuple = *iter; BOOL is_selected = ( tuple == selected_tuple ); - // Although the selected tab must be complete, we may have hollow LLTabTuple tucked in the list - if (tuple->mButton) + if (tuple && tuple->mButton) { tuple->mButton->setUseEllipses(mUseTabEllipses); tuple->mButton->setHAlign(mFontHalign); @@ -1494,7 +1497,7 @@ BOOL LLTabContainer::setTab(S32 which) // RN: this limits tab-stops to active button only, which would require arrow keys to switch tabs tuple->mButton->setTabStop( is_selected ); } - if (tuple->mTabPanel) + if (tuple && tuple->mTabPanel) { tuple->mTabPanel->setVisible( is_selected ); //tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here. @@ -1525,7 +1528,7 @@ BOOL LLTabContainer::setTab(S32 which) else { S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + tabcntr_arrow_btn_size + tabcntr_arrow_btn_size + 1); - S32 running_tab_width = tuple->mButton->getRect().getWidth(); + S32 running_tab_width = (tuple && tuple->mButton ? tuple->mButton->getRect().getWidth() : 0); S32 j = i - 1; S32 min_scroll_pos = i; if (running_tab_width < available_width_with_arrows) @@ -1533,7 +1536,7 @@ BOOL LLTabContainer::setTab(S32 which) while (j >= 0) { LLTabTuple* other_tuple = getTab(j); - running_tab_width += other_tuple->mButton->getRect().getWidth(); + running_tab_width += (other_tuple && other_tuple->mButton ? other_tuple->mButton->getRect().getWidth() : 0); if (running_tab_width > available_width_with_arrows) { break; diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 57862fc626..57862fc626 100644..100755 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index a815cfc176..a45c4ced2e 100644..100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -443,6 +443,7 @@ void LLTextBase::drawSelectionBackground() ++rect_it) { LLRect selection_rect = *rect_it; + selection_rect = *rect_it; selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom); gl_rect_2d(selection_rect, selection_color); } @@ -520,8 +521,8 @@ void LLTextBase::drawCursor() LLRect screen_pos = calcScreenRect(); LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_rect.mLeft), screen_pos.mBottom + llfloor(cursor_rect.mTop) ); - ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]); - ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]); + ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]); + ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]); getWindow()->setLanguageTextInput( ime_pos ); } } @@ -1917,7 +1918,6 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url)); registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url)); registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url)); - registrar.add("Url.SendIM", boost::bind(&LLUrlAction::sendIM, url)); registrar.add("Url.AddFriend", boost::bind(&LLUrlAction::addFriend, url)); registrar.add("Url.ShowOnMap", boost::bind(&LLUrlAction::showLocationOnMap, url)); registrar.add("Url.CopyLabel", boost::bind(&LLUrlAction::copyLabelToClipboard, url)); @@ -3206,14 +3206,14 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin LLWString offsetString(text.c_str() + segment_offset + mStart); if(getLength() < segment_offset + mStart) - { - llerrs << "getLength() < segment_offset + mStart\t getLength()\t" << getLength() << "\tsegment_offset:\t" + { + llinfos << "getLength() < segment_offset + mStart\t getLength()\t" << getLength() << "\tsegment_offset:\t" << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << "\tmax_chars\t" << max_chars << llendl; } if(offsetString.length() + 1 < max_chars) { - llerrs << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetString.length():\t" << offsetString.length() + llinfos << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetString.length():\t" << offsetString.length() << " getLength() : " << getLength() << "\tsegment_offset:\t" << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << llendl; } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 20a73387b5..20a73387b5 100644..100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 11cfa1d263..11cfa1d263 100644..100755 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 071e18c638..071e18c638 100644..100755 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index b8bdea48b5..834f213097 100644..100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2917,7 +2917,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length) S32 LLTextEditor::getPreeditFontSize() const { - return llround((F32)mFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]); + return llround((F32)mFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } BOOL LLTextEditor::isDirty() const diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 969e072704..969e072704 100644..100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index 8a85f99e0c..8a85f99e0c 100644..100755 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp diff --git a/indra/llui/lltextparser.h b/indra/llui/lltextparser.h index 400aeeb8be..400aeeb8be 100644..100755 --- a/indra/llui/lltextparser.h +++ b/indra/llui/lltextparser.h diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp index 4df2c3363f..4df2c3363f 100644..100755 --- a/indra/llui/lltextutil.cpp +++ b/indra/llui/lltextutil.cpp diff --git a/indra/llui/lltextutil.h b/indra/llui/lltextutil.h index bf7dbb58ce..bf7dbb58ce 100644..100755 --- a/indra/llui/lltextutil.h +++ b/indra/llui/lltextutil.h diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index 234e600ccd..234e600ccd 100644..100755 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp diff --git a/indra/llui/lltextvalidate.h b/indra/llui/lltextvalidate.h index 5c830d7db3..5c830d7db3 100644..100755 --- a/indra/llui/lltextvalidate.h +++ b/indra/llui/lltextvalidate.h diff --git a/indra/llui/lltimectrl.cpp b/indra/llui/lltimectrl.cpp index 9ea1e8815e..9ea1e8815e 100644..100755 --- a/indra/llui/lltimectrl.cpp +++ b/indra/llui/lltimectrl.cpp diff --git a/indra/llui/lltimectrl.h b/indra/llui/lltimectrl.h index b5f268c76a..b5f268c76a 100644..100755 --- a/indra/llui/lltimectrl.h +++ b/indra/llui/lltimectrl.h diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp index 00d52fe10d..00d52fe10d 100644..100755 --- a/indra/llui/lltoggleablemenu.cpp +++ b/indra/llui/lltoggleablemenu.cpp diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h index dfe70cbf54..dfe70cbf54 100644..100755 --- a/indra/llui/lltoggleablemenu.h +++ b/indra/llui/lltoggleablemenu.h diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 1c74395c66..3d9f5cbbc2 100644..100755 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -653,7 +653,6 @@ void LLToolBar::updateLayoutAsNeeded() S32 max_row_length = 0; S32 max_length; - S32 max_total_girth; S32 cur_start; S32 cur_row ; S32 row_pad_start; @@ -664,7 +663,6 @@ void LLToolBar::updateLayoutAsNeeded() if (orientation == LLLayoutStack::HORIZONTAL) { max_length = getRect().getWidth() - mPadLeft - mPadRight; - max_total_girth = getRect().getHeight() - mPadTop - mPadBottom; row_pad_start = mPadLeft; row_pad_end = mPadRight; cur_row = mPadTop; @@ -673,7 +671,6 @@ void LLToolBar::updateLayoutAsNeeded() else // VERTICAL { max_length = getRect().getHeight() - mPadTop - mPadBottom; - max_total_girth = getRect().getWidth() - mPadLeft - mPadRight; row_pad_start = mPadTop; row_pad_end = mPadBottom; cur_row = mPadLeft; @@ -841,7 +838,6 @@ void LLToolBar::draw() if (mDragAndDropTarget && !mButtonCommands.empty()) { LLRect caret_rect = caret->getRect(); - LLRect toolbar_rect = getRect(); if (getOrientation(mSideType) == LLLayoutStack::HORIZONTAL) { caret->setRect(LLRect(mDragx-caret_rect.getWidth()/2+1, diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 31424a36d4..31424a36d4 100644..100755 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index f52a3b3323..f52a3b3323 100644..100755 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index fad127fc4c..fad127fc4c 100644..100755 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h diff --git a/indra/llui/lltrans.cpp b/indra/llui/lltrans.cpp index 5388069c24..5388069c24 100644..100755 --- a/indra/llui/lltrans.cpp +++ b/indra/llui/lltrans.cpp diff --git a/indra/llui/lltrans.h b/indra/llui/lltrans.h index 128b51d383..128b51d383 100644..100755 --- a/indra/llui/lltrans.h +++ b/indra/llui/lltrans.h diff --git a/indra/llui/lltransutil.cpp b/indra/llui/lltransutil.cpp index 80d079cbc8..80d079cbc8 100644..100755 --- a/indra/llui/lltransutil.cpp +++ b/indra/llui/lltransutil.cpp diff --git a/indra/llui/lltransutil.h b/indra/llui/lltransutil.h index 9c7cee3f6f..9c7cee3f6f 100644..100755 --- a/indra/llui/lltransutil.h +++ b/indra/llui/lltransutil.h diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 2a774d54a3..0ddb149738 100644..100755 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -39,6 +39,7 @@ #include "llrect.h" #include "lldir.h" #include "llgl.h" +#include "llsd.h" // Project includes #include "llcommandmanager.h" @@ -69,16 +70,13 @@ // // Globals // -const LLColor4 UI_VERTEX_COLOR(1.f, 1.f, 1.f, 1.f); // Language for UI construction std::map<std::string, std::string> gTranslation; std::list<std::string> gUntranslated; /*static*/ LLUI::settings_map_t LLUI::sSettingGroups; -/*static*/ LLImageProviderInterface* LLUI::sImageProvider = NULL; /*static*/ LLUIAudioCallback LLUI::sAudioCallback = NULL; /*static*/ LLUIAudioCallback LLUI::sDeferredAudioCallback = NULL; -/*static*/ LLVector2 LLUI::sGLScaleFactor(1.f, 1.f); /*static*/ LLWindow* LLUI::sWindow = NULL; /*static*/ LLView* LLUI::sRootView = NULL; /*static*/ BOOL LLUI::sDirty = FALSE; @@ -158,1474 +156,6 @@ void make_ui_sound_deferred(const char* namep) } } -BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom) -{ - if (x < left || right < x) return FALSE; - if (y < bottom || top < y) return FALSE; - return TRUE; -} - - -// Puts GL into 2D drawing mode by turning off lighting, setting to an -// orthographic projection, etc. -void gl_state_for_2d(S32 width, S32 height) -{ - stop_glerror(); - F32 window_width = (F32) width;//gViewerWindow->getWindowWidth(); - F32 window_height = (F32) height;//gViewerWindow->getWindowHeight(); - - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.loadIdentity(); - gGL.ortho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.loadIdentity(); - stop_glerror(); -} - - -void gl_draw_x(const LLRect& rect, const LLColor4& color) -{ - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.color4fv( color.mV ); - - gGL.begin( LLRender::LINES ); - gGL.vertex2i( rect.mLeft, rect.mTop ); - gGL.vertex2i( rect.mRight, rect.mBottom ); - gGL.vertex2i( rect.mLeft, rect.mBottom ); - gGL.vertex2i( rect.mRight, rect.mTop ); - gGL.end(); -} - - -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset, BOOL filled) -{ - gGL.color4fv(color.mV); - gl_rect_2d_offset_local(left, top, right, bottom, pixel_offset, filled); -} - -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled) -{ - gGL.pushUIMatrix(); - left += LLFontGL::sCurOrigin.mX; - right += LLFontGL::sCurOrigin.mX; - bottom += LLFontGL::sCurOrigin.mY; - top += LLFontGL::sCurOrigin.mY; - - gGL.loadUIIdentity(); - gl_rect_2d(llfloor((F32)left * LLUI::sGLScaleFactor.mV[VX]) - pixel_offset, - llfloor((F32)top * LLUI::sGLScaleFactor.mV[VY]) + pixel_offset, - llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset, - llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset, - filled); - gGL.popUIMatrix(); -} - - -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) -{ - stop_glerror(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - // Counterclockwise quad will face the viewer - if( filled ) - { - gGL.begin( LLRender::QUADS ); - gGL.vertex2i(left, top); - gGL.vertex2i(left, bottom); - gGL.vertex2i(right, bottom); - gGL.vertex2i(right, top); - gGL.end(); - } - else - { - if( gGLManager.mATIOffsetVerticalLines ) - { - // Work around bug in ATI driver: vertical lines are offset by (-1,-1) - gGL.begin( LLRender::LINES ); - - // Verticals - gGL.vertex2i(left + 1, top); - gGL.vertex2i(left + 1, bottom); - - gGL.vertex2i(right, bottom); - gGL.vertex2i(right, top); - - // Horizontals - top--; - right--; - gGL.vertex2i(left, bottom); - gGL.vertex2i(right, bottom); - - gGL.vertex2i(left, top); - gGL.vertex2i(right, top); - gGL.end(); - } - else - { - top--; - right--; - gGL.begin( LLRender::LINE_STRIP ); - gGL.vertex2i(left, top); - gGL.vertex2i(left, bottom); - gGL.vertex2i(right, bottom); - gGL.vertex2i(right, top); - gGL.vertex2i(left, top); - gGL.end(); - } - } - stop_glerror(); -} - -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled ) -{ - gGL.color4fv( color.mV ); - gl_rect_2d( left, top, right, bottom, filled ); -} - - -void gl_rect_2d( const LLRect& rect, const LLColor4& color, BOOL filled ) -{ - gGL.color4fv( color.mV ); - gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled ); -} - -// Given a rectangle on the screen, draws a drop shadow _outside_ -// the right and bottom edges of it. Along the right it has width "lines" -// and along the bottom it has height "lines". -void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines) -{ - stop_glerror(); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - // HACK: Overlap with the rectangle by a single pixel. - right--; - bottom++; - lines++; - - LLColor4 end_color = start_color; - end_color.mV[VALPHA] = 0.f; - - gGL.begin(LLRender::QUADS); - - // Right edge, CCW faces screen - gGL.color4fv(start_color.mV); - gGL.vertex2i(right, top-lines); - gGL.vertex2i(right, bottom); - gGL.color4fv(end_color.mV); - gGL.vertex2i(right+lines, bottom); - gGL.vertex2i(right+lines, top-lines); - - // Bottom edge, CCW faces screen - gGL.color4fv(start_color.mV); - gGL.vertex2i(right, bottom); - gGL.vertex2i(left+lines, bottom); - gGL.color4fv(end_color.mV); - gGL.vertex2i(left+lines, bottom-lines); - gGL.vertex2i(right, bottom-lines); - - // bottom left Corner - gGL.color4fv(start_color.mV); - gGL.vertex2i(left+lines, bottom); - gGL.color4fv(end_color.mV); - gGL.vertex2i(left, bottom); - // make the bottom left corner not sharp - gGL.vertex2i(left+1, bottom-lines+1); - gGL.vertex2i(left+lines, bottom-lines); - - // bottom right corner - gGL.color4fv(start_color.mV); - gGL.vertex2i(right, bottom); - gGL.color4fv(end_color.mV); - gGL.vertex2i(right, bottom-lines); - // make the rightmost corner not sharp - gGL.vertex2i(right+lines-1, bottom-lines+1); - gGL.vertex2i(right+lines, bottom); - - // top right corner - gGL.color4fv(start_color.mV); - gGL.vertex2i( right, top-lines ); - gGL.color4fv(end_color.mV); - gGL.vertex2i( right+lines, top-lines ); - // make the corner not sharp - gGL.vertex2i( right+lines-1, top-1 ); - gGL.vertex2i( right, top ); - - gGL.end(); - stop_glerror(); -} - -void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2 ) -{ - // Work around bug in ATI driver: vertical lines are offset by (-1,-1) - if( (x1 == x2) && gGLManager.mATIOffsetVerticalLines ) - { - x1++; - x2++; - y1++; - y2++; - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.begin(LLRender::LINES); - gGL.vertex2i(x1, y1); - gGL.vertex2i(x2, y2); - gGL.end(); -} - -void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ) -{ - // Work around bug in ATI driver: vertical lines are offset by (-1,-1) - if( (x1 == x2) && gGLManager.mATIOffsetVerticalLines ) - { - x1++; - x2++; - y1++; - y2++; - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.color4fv( color.mV ); - - gGL.begin(LLRender::LINES); - gGL.vertex2i(x1, y1); - gGL.vertex2i(x2, y2); - gGL.end(); -} - -void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled) -{ - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.color4fv(color.mV); - - if (filled) - { - gGL.begin(LLRender::TRIANGLES); - } - else - { - gGL.begin(LLRender::LINE_LOOP); - } - gGL.vertex2i(x1, y1); - gGL.vertex2i(x2, y2); - gGL.vertex2i(x3, y3); - gGL.end(); -} - -void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac) -{ - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - length = llmin((S32)(max_frac*(right - left)), length); - length = llmin((S32)(max_frac*(top - bottom)), length); - gGL.begin(LLRender::LINES); - gGL.vertex2i(left, top); - gGL.vertex2i(left + length, top); - - gGL.vertex2i(left, top); - gGL.vertex2i(left, top - length); - - gGL.vertex2i(left, bottom); - gGL.vertex2i(left + length, bottom); - - gGL.vertex2i(left, bottom); - gGL.vertex2i(left, bottom + length); - - gGL.vertex2i(right, top); - gGL.vertex2i(right - length, top); - - gGL.vertex2i(right, top); - gGL.vertex2i(right, top - length); - - gGL.vertex2i(right, bottom); - gGL.vertex2i(right - length, bottom); - - gGL.vertex2i(right, bottom); - gGL.vertex2i(right, bottom + length); - gGL.end(); -} - - -void gl_draw_image( S32 x, S32 y, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect ) -{ - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), 0.f, image, color, uv_rect ); -} - -void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) -{ - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect ); -} - -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect) -{ - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - - // scale screen size of borders down - F32 border_width_fraction = (F32)border_width / (F32)image->getWidth(0); - F32 border_height_fraction = (F32)border_height / (F32)image->getHeight(0); - - LLRectf scale_rect(border_width_fraction, 1.f - border_height_fraction, 1.f - border_width_fraction, border_height_fraction); - gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect); -} - -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect) -{ - stop_glerror(); - - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - - // add in offset of current image to current UI translation - const LLVector3 ui_scale = gGL.getUIScale(); - const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); - - F32 uv_width = uv_outer_rect.getWidth(); - F32 uv_height = uv_outer_rect.getHeight(); - - // shrink scaling region to be proportional to clipped image region - LLRectf uv_center_rect( - uv_outer_rect.mLeft + (center_rect.mLeft * uv_width), - uv_outer_rect.mBottom + (center_rect.mTop * uv_height), - uv_outer_rect.mLeft + (center_rect.mRight * uv_width), - uv_outer_rect.mBottom + (center_rect.mBottom * uv_height)); - - F32 image_width = image->getWidth(0); - F32 image_height = image->getHeight(0); - - S32 image_natural_width = llround(image_width * uv_width); - S32 image_natural_height = llround(image_height * uv_height); - - LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, - uv_center_rect.mTop * image_height, - uv_center_rect.mRight * image_width, - uv_center_rect.mBottom * image_height); - - { // scale fixed region of image to drawn region - draw_center_rect.mRight += width - image_natural_width; - draw_center_rect.mTop += height - image_natural_height; - - F32 border_shrink_width = llmax(0.f, draw_center_rect.mLeft - draw_center_rect.mRight); - F32 border_shrink_height = llmax(0.f, draw_center_rect.mBottom - draw_center_rect.mTop); - - F32 shrink_width_ratio = center_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - center_rect.getWidth())); - F32 shrink_height_ratio = center_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - center_rect.getHeight())); - - F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); - - draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * shrink_scale * ui_scale.mV[VX]); - draw_center_rect.mTop = llround(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale) * ui_scale.mV[VY]); - draw_center_rect.mRight = llround(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale) * ui_scale.mV[VX]); - draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * shrink_scale * ui_scale.mV[VY]); - } - - LLRectf draw_outer_rect(ui_translation.mV[VX], - ui_translation.mV[VY] + height * ui_scale.mV[VY], - ui_translation.mV[VX] + width * ui_scale.mV[VX], - ui_translation.mV[VY]); - - LLGLSUIDefault gls_ui; - - if (solid_color) - { - if (LLGLSLShader::sNoFixedFunction) - { - gSolidColorProgram.bind(); - } - else - { - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); - gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA); - } - } - - gGL.getTexUnit(0)->bind(image, true); - - gGL.color4fv(color.mV); - - const S32 NUM_VERTICES = 9 * 4; // 9 quads - LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; - - S32 index = 0; - - gGL.begin(LLRender::QUADS); - { - // draw bottom left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - // draw bottom middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - // draw bottom right - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - // draw left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - // draw middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - // draw right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - // draw top left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; - - // draw top middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; - - // draw top right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; - - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; - - gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); - } - gGL.end(); - - if (solid_color) - { - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.bind(); - } - else - { - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - } - } -} - -void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) -{ - gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), degrees, image, color, uv_rect ); -} - -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) -{ - if (NULL == image) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - - LLGLSUIDefault gls_ui; - - - gGL.getTexUnit(0)->bind(image, true); - - gGL.color4fv(color.mV); - - if (degrees == 0.f) - { - const S32 NUM_VERTICES = 4; // 9 quads - LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; - - gGL.begin(LLRender::QUADS); - { - LLVector3 ui_scale = gGL.getUIScale(); - LLVector3 ui_translation = gGL.getUITranslation(); - ui_translation.mV[VX] += x; - ui_translation.mV[VY] += y; - ui_translation.scaleVec(ui_scale); - S32 index = 0; - S32 scaled_width = llround(width * ui_scale.mV[VX]); - S32 scaled_height = llround(height * ui_scale.mV[VY]); - - uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop); - pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f); - index++; - - uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop); - pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f); - index++; - - uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom); - pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY], 0.f); - index++; - - uv[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom); - pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f); - index++; - - gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); - } - gGL.end(); - } - else - { - gGL.pushUIMatrix(); - gGL.translateUI((F32)x, (F32)y, 0.f); - - F32 offset_x = F32(width/2); - F32 offset_y = F32(height/2); - - gGL.translateUI(offset_x, offset_y, 0.f); - - LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); - - gGL.getTexUnit(0)->bind(image, true); - - gGL.color4fv(color.mV); - - gGL.begin(LLRender::QUADS); - { - LLVector3 v; - - v = LLVector3(offset_x, offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); - gGL.vertex2f(v.mV[0], v.mV[1] ); - - v = LLVector3(-offset_x, offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); - gGL.vertex2f(v.mV[0], v.mV[1] ); - - v = LLVector3(-offset_x, -offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); - gGL.vertex2f(v.mV[0], v.mV[1] ); - - v = LLVector3(offset_x, -offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); - gGL.vertex2f(v.mV[0], v.mV[1] ); - } - gGL.end(); - gGL.popUIMatrix(); - } -} - - -void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase ) -{ - phase = fmod(phase, 1.f); - - S32 shift = S32(phase * 4.f) % 4; - - // Stippled line - LLGLEnable stipple(GL_LINE_STIPPLE); - - gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); - - gGL.flush(); - glLineWidth(2.5f); - - if (!LLGLSLShader::sNoFixedFunction) - { - glLineStipple(2, 0x3333 << shift); - } - - gGL.begin(LLRender::LINES); - { - gGL.vertex3fv( start.mV ); - gGL.vertex3fv( end.mV ); - } - gGL.end(); - - LLUI::setLineWidth(1.f); -} - -void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle) -{ - if (end_angle < start_angle) - { - end_angle += F_TWO_PI; - } - - gGL.pushUIMatrix(); - { - gGL.translateUI(center_x, center_y, 0.f); - - // Inexact, but reasonably fast. - F32 delta = (end_angle - start_angle) / steps; - F32 sin_delta = sin( delta ); - F32 cos_delta = cos( delta ); - F32 x = cosf(start_angle) * radius; - F32 y = sinf(start_angle) * radius; - - if (filled) - { - gGL.begin(LLRender::TRIANGLE_FAN); - gGL.vertex2f(0.f, 0.f); - // make sure circle is complete - steps += 1; - } - else - { - gGL.begin(LLRender::LINE_STRIP); - } - - while( steps-- ) - { - // Successive rotations - gGL.vertex2f( x, y ); - F32 x_new = x * cos_delta - y * sin_delta; - y = x * sin_delta + y * cos_delta; - x = x_new; - } - gGL.end(); - } - gGL.popUIMatrix(); -} - -void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled) -{ - gGL.pushUIMatrix(); - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.translateUI(center_x, center_y, 0.f); - - // Inexact, but reasonably fast. - F32 delta = F_TWO_PI / steps; - F32 sin_delta = sin( delta ); - F32 cos_delta = cos( delta ); - F32 x = radius; - F32 y = 0.f; - - if (filled) - { - gGL.begin(LLRender::TRIANGLE_FAN); - gGL.vertex2f(0.f, 0.f); - // make sure circle is complete - steps += 1; - } - else - { - gGL.begin(LLRender::LINE_LOOP); - } - - while( steps-- ) - { - // Successive rotations - gGL.vertex2f( x, y ); - F32 x_new = x * cos_delta - y * sin_delta; - y = x * sin_delta + y * cos_delta; - x = x_new; - } - gGL.end(); - } - gGL.popUIMatrix(); -} - -// Renders a ring with sides (tube shape) -void gl_deep_circle( F32 radius, F32 depth, S32 steps ) -{ - F32 x = radius; - F32 y = 0.f; - F32 angle_delta = F_TWO_PI / (F32)steps; - gGL.begin( LLRender::TRIANGLE_STRIP ); - { - S32 step = steps + 1; // An extra step to close the circle. - while( step-- ) - { - gGL.vertex3f( x, y, depth ); - gGL.vertex3f( x, y, 0.f ); - - F32 x_new = x * cosf(angle_delta) - y * sinf(angle_delta); - y = x * sinf(angle_delta) + y * cosf(angle_delta); - x = x_new; - } - } - gGL.end(); -} - -void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ) -{ - gGL.pushUIMatrix(); - { - gGL.translateUI(0.f, 0.f, -width / 2); - if( render_center ) - { - gGL.color4fv(center_color.mV); - gGL.diffuseColor4fv(center_color.mV); - gl_deep_circle( radius, width, steps ); - } - else - { - gGL.diffuseColor4fv(side_color.mV); - gl_washer_2d(radius, radius - width, steps, side_color, side_color); - gGL.translateUI(0.f, 0.f, width); - gl_washer_2d(radius - width, radius, steps, side_color, side_color); - } - } - gGL.popUIMatrix(); -} - -// Draw gray and white checkerboard with black border -void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha) -{ - if (!LLGLSLShader::sNoFixedFunction) - { - // Initialize the first time this is called. - const S32 PIXELS = 32; - static GLubyte checkerboard[PIXELS * PIXELS]; - static BOOL first = TRUE; - if( first ) - { - for( S32 i = 0; i < PIXELS; i++ ) - { - for( S32 j = 0; j < PIXELS; j++ ) - { - checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF; - } - } - first = FALSE; - } - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - // ...white squares - gGL.color4f( 1.f, 1.f, 1.f, alpha ); - gl_rect_2d(rect); - - // ...gray squares - gGL.color4f( .7f, .7f, .7f, alpha ); - gGL.flush(); - - glPolygonStipple( checkerboard ); - - LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); - gl_rect_2d(rect); - } - else - { //polygon stipple is deprecated, use "Checker" texture - LLPointer<LLUIImage> img = LLUI::getUIImage("Checker"); - gGL.getTexUnit(0)->bind(img->getImage()); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - - LLColor4 color(1.f, 1.f, 1.f, alpha); - LLRectf uv_rect(0, 0, rect.getWidth()/32.f, rect.getHeight()/32.f); - - gl_draw_scaled_image(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), - img->getImage(), color, uv_rect); - } - - gGL.flush(); -} - - -// Draws the area between two concentric circles, like -// a doughnut or washer. -void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color) -{ - const F32 DELTA = F_TWO_PI / steps; - const F32 SIN_DELTA = sin( DELTA ); - const F32 COS_DELTA = cos( DELTA ); - - F32 x1 = outer_radius; - F32 y1 = 0.f; - F32 x2 = inner_radius; - F32 y2 = 0.f; - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - gGL.begin( LLRender::TRIANGLE_STRIP ); - { - steps += 1; // An extra step to close the circle. - while( steps-- ) - { - gGL.color4fv(outer_color.mV); - gGL.vertex2f( x1, y1 ); - gGL.color4fv(inner_color.mV); - gGL.vertex2f( x2, y2 ); - - F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; - y1 = x1 * SIN_DELTA + y1 * COS_DELTA; - x1 = x1_new; - - F32 x2_new = x2 * COS_DELTA - y2 * SIN_DELTA; - y2 = x2 * SIN_DELTA + y2 * COS_DELTA; - x2 = x2_new; - } - } - gGL.end(); -} - -// Draws the area between two concentric circles, like -// a doughnut or washer. -void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color) -{ - const F32 DELTA = (end_radians - start_radians) / steps; - const F32 SIN_DELTA = sin( DELTA ); - const F32 COS_DELTA = cos( DELTA ); - - F32 x1 = outer_radius * cos( start_radians ); - F32 y1 = outer_radius * sin( start_radians ); - F32 x2 = inner_radius * cos( start_radians ); - F32 y2 = inner_radius * sin( start_radians ); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.begin( LLRender::TRIANGLE_STRIP ); - { - steps += 1; // An extra step to close the circle. - while( steps-- ) - { - gGL.color4fv(outer_color.mV); - gGL.vertex2f( x1, y1 ); - gGL.color4fv(inner_color.mV); - gGL.vertex2f( x2, y2 ); - - F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA; - y1 = x1 * SIN_DELTA + y1 * COS_DELTA; - x1 = x1_new; - - F32 x2_new = x2 * COS_DELTA - y2 * SIN_DELTA; - y2 = x2 * SIN_DELTA + y2 * COS_DELTA; - x2 = x2_new; - } - } - gGL.end(); -} - -void gl_rect_2d_simple_tex( S32 width, S32 height ) -{ - gGL.begin( LLRender::QUADS ); - - gGL.texCoord2f(1.f, 1.f); - gGL.vertex2i(width, height); - - gGL.texCoord2f(0.f, 1.f); - gGL.vertex2i(0, height); - - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(0, 0); - - gGL.texCoord2f(1.f, 0.f); - gGL.vertex2i(width, 0); - - gGL.end(); -} - -void gl_rect_2d_simple( S32 width, S32 height ) -{ - gGL.begin( LLRender::QUADS ); - gGL.vertex2i(width, height); - gGL.vertex2i(0, height); - gGL.vertex2i(0, 0); - gGL.vertex2i(width, 0); - gGL.end(); -} - -void gl_segmented_rect_2d_tex(const S32 left, - const S32 top, - const S32 right, - const S32 bottom, - const S32 texture_width, - const S32 texture_height, - const S32 border_size, - const U32 edges) -{ - S32 width = llabs(right - left); - S32 height = llabs(top - bottom); - - gGL.pushUIMatrix(); - - gGL.translateUI((F32)left, (F32)bottom, 0.f); - LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); - - if (border_uv_scale.mV[VX] > 0.5f) - { - border_uv_scale *= 0.5f / border_uv_scale.mV[VX]; - } - if (border_uv_scale.mV[VY] > 0.5f) - { - border_uv_scale *= 0.5f / border_uv_scale.mV[VY]; - } - - F32 border_scale = llmin((F32)border_size, (F32)width * 0.5f, (F32)height * 0.5f); - LLVector2 border_width_left = ((edges & (~(U32)ROUNDED_RECT_RIGHT)) != 0) ? LLVector2(border_scale, 0.f) : LLVector2::zero; - LLVector2 border_width_right = ((edges & (~(U32)ROUNDED_RECT_LEFT)) != 0) ? LLVector2(border_scale, 0.f) : LLVector2::zero; - LLVector2 border_height_bottom = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? LLVector2(0.f, border_scale) : LLVector2::zero; - LLVector2 border_height_top = ((edges & (~(U32)ROUNDED_RECT_BOTTOM)) != 0) ? LLVector2(0.f, border_scale) : LLVector2::zero; - LLVector2 width_vec((F32)width, 0.f); - LLVector2 height_vec(0.f, (F32)height); - - gGL.begin(LLRender::QUADS); - { - // draw bottom left - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2f(0.f, 0.f); - - gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv(border_width_left.mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + border_height_bottom).mV); - - gGL.texCoord2f(0.f, border_uv_scale.mV[VY]); - gGL.vertex2fv(border_height_bottom.mV); - - // draw bottom middle - gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv(border_width_left.mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv((width_vec - border_width_right).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + border_height_bottom).mV); - - // draw bottom right - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv((width_vec - border_width_right).mV); - - gGL.texCoord2f(1.f, 0.f); - gGL.vertex2fv(width_vec.mV); - - gGL.texCoord2f(1.f, border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); - - // draw left - gGL.texCoord2f(0.f, border_uv_scale.mV[VY]); - gGL.vertex2fv(border_height_bottom.mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + border_height_bottom).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); - - gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((height_vec - border_height_top).mV); - - // draw middle - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); - - // draw right - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV); - - gGL.texCoord2f(1.f, border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec + border_height_bottom).mV); - - gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); - - // draw top left - gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((height_vec - border_height_top).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((border_width_left + height_vec).mV); - - gGL.texCoord2f(0.f, 1.f); - gGL.vertex2fv((height_vec).mV); - - // draw top middle - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((width_vec - border_width_right + height_vec).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((border_width_left + height_vec).mV); - - // draw top right - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((width_vec + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f, 1.f); - gGL.vertex2fv((width_vec + height_vec).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((width_vec - border_width_right + height_vec).mV); - } - gGL.end(); - - gGL.popUIMatrix(); -} - -//FIXME: rewrite to use scissor? -void gl_segmented_rect_2d_fragment_tex(const S32 left, - const S32 top, - const S32 right, - const S32 bottom, - const S32 texture_width, - const S32 texture_height, - const S32 border_size, - const F32 start_fragment, - const F32 end_fragment, - const U32 edges) -{ - S32 width = llabs(right - left); - S32 height = llabs(top - bottom); - - gGL.pushUIMatrix(); - - gGL.translateUI((F32)left, (F32)bottom, 0.f); - LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); - - if (border_uv_scale.mV[VX] > 0.5f) - { - border_uv_scale *= 0.5f / border_uv_scale.mV[VX]; - } - if (border_uv_scale.mV[VY] > 0.5f) - { - border_uv_scale *= 0.5f / border_uv_scale.mV[VY]; - } - - F32 border_scale = llmin((F32)border_size, (F32)width * 0.5f, (F32)height * 0.5f); - LLVector2 border_width_left = ((edges & (~(U32)ROUNDED_RECT_RIGHT)) != 0) ? LLVector2(border_scale, 0.f) : LLVector2::zero; - LLVector2 border_width_right = ((edges & (~(U32)ROUNDED_RECT_LEFT)) != 0) ? LLVector2(border_scale, 0.f) : LLVector2::zero; - LLVector2 border_height_bottom = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? LLVector2(0.f, border_scale) : LLVector2::zero; - LLVector2 border_height_top = ((edges & (~(U32)ROUNDED_RECT_BOTTOM)) != 0) ? LLVector2(0.f, border_scale) : LLVector2::zero; - LLVector2 width_vec((F32)width, 0.f); - LLVector2 height_vec(0.f, (F32)height); - - F32 middle_start = border_scale / (F32)width; - F32 middle_end = 1.f - middle_start; - - F32 u_min; - F32 u_max; - LLVector2 x_min; - LLVector2 x_max; - - gGL.begin(LLRender::QUADS); - { - if (start_fragment < middle_start) - { - u_min = (start_fragment / middle_start) * border_uv_scale.mV[VX]; - u_max = llmin(end_fragment / middle_start, 1.f) * border_uv_scale.mV[VX]; - x_min = (start_fragment / middle_start) * border_width_left; - x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left; - - // draw bottom left - gGL.texCoord2f(u_min, 0.f); - gGL.vertex2fv(x_min.mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv(x_max.mV); - - gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - // draw left - gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - // draw top left - gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_max, 1.f); - gGL.vertex2fv((x_max + height_vec).mV); - - gGL.texCoord2f(u_min, 1.f); - gGL.vertex2fv((x_min + height_vec).mV); - } - - if (end_fragment > middle_start || start_fragment < middle_end) - { - x_min = border_width_left + ((llclamp(start_fragment, middle_start, middle_end) - middle_start)) * width_vec; - x_max = border_width_left + ((llclamp(end_fragment, middle_start, middle_end) - middle_start)) * width_vec; - - // draw bottom middle - gGL.texCoord2f(border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv(x_min.mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f); - gGL.vertex2fv((x_max).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - // draw middle - gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - // draw top middle - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((x_max + height_vec).mV); - - gGL.texCoord2f(border_uv_scale.mV[VX], 1.f); - gGL.vertex2fv((x_min + height_vec).mV); - } - - if (end_fragment > middle_end) - { - u_min = (1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_uv_scale.mV[VX]; - u_max = (1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]; - x_min = width_vec - ((1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_width_right); - x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right); - - // draw bottom right - gGL.texCoord2f(u_min, 0.f); - gGL.vertex2fv((x_min).mV); - - gGL.texCoord2f(u_max, 0.f); - gGL.vertex2fv(x_max.mV); - - gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - // draw right - gGL.texCoord2f(u_min, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + border_height_bottom).mV); - - gGL.texCoord2f(u_max, border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + border_height_bottom).mV); - - gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - // draw top right - gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]); - gGL.vertex2fv((x_max + height_vec - border_height_top).mV); - - gGL.texCoord2f(u_max, 1.f); - gGL.vertex2fv((x_max + height_vec).mV); - - gGL.texCoord2f(u_min, 1.f); - gGL.vertex2fv((x_min + height_vec).mV); - } - } - gGL.end(); - - gGL.popUIMatrix(); -} - -void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, - const LLVector3& width_vec, const LLVector3& height_vec) -{ - gGL.begin(LLRender::QUADS); - { - // draw bottom left - gGL.texCoord2f(clip_rect.mLeft, clip_rect.mBottom); - gGL.vertex3f(0.f, 0.f, 0.f); - - gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mBottom * height_vec).mV); - - // draw bottom middle - gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV); - - // draw bottom right - gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, clip_rect.mBottom); - gGL.vertex3fv(width_vec.mV); - - gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV); - - // draw left - gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mTop * height_vec).mV); - - // draw middle - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - - // draw right - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mBottom); - gGL.vertex3fv((width_vec + center_draw_rect.mBottom * height_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV); - - // draw top left - gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + height_vec).mV); - - gGL.texCoord2f(clip_rect.mLeft, clip_rect.mTop); - gGL.vertex3fv((height_vec).mV); - - // draw top middle - gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft * width_vec + height_vec).mV); - - // draw top right - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((width_vec + center_draw_rect.mTop * height_vec).mV); - - gGL.texCoord2f(clip_rect.mRight, clip_rect.mTop); - gGL.vertex3fv((width_vec + height_vec).mV); - - gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight * width_vec + height_vec).mV); - } - gGL.end(); - -} - - void LLUI::initClass(const settings_map_t& settings, LLImageProviderInterface* image_provider, LLUIAudioCallback audio_callback, @@ -1633,6 +163,7 @@ void LLUI::initClass(const settings_map_t& settings, const LLVector2* scale_factor, const std::string& language) { + LLRender2D::initClass(image_provider,scale_factor); sSettingGroups = settings; if ((get_ptr_in_map(sSettingGroups, std::string("config")) == NULL) || @@ -1642,10 +173,8 @@ void LLUI::initClass(const settings_map_t& settings, llerrs << "Failure to initialize configuration groups" << llendl; } - sImageProvider = image_provider; sAudioCallback = audio_callback; sDeferredAudioCallback = deferred_audio_callback; - sGLScaleFactor = (scale_factor == NULL) ? LLVector2(1.f, 1.f) : *scale_factor; sWindow = NULL; // set later in startup LLFontGL::sShadowColor = LLUIColorTable::instance().getColor("ColorDropShadow"); @@ -1679,10 +208,7 @@ void LLUI::initClass(const settings_map_t& settings, void LLUI::cleanupClass() { - if(sImageProvider) - { - sImageProvider->cleanUp(); -} + LLRender2D::cleanupClass(); } void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups) @@ -1706,60 +232,12 @@ void LLUI::dirtyRect(LLRect rect) } } - -//static -void LLUI::translate(F32 x, F32 y, F32 z) -{ - gGL.translateUI(x,y,z); - LLFontGL::sCurOrigin.mX += (S32) x; - LLFontGL::sCurOrigin.mY += (S32) y; - LLFontGL::sCurDepth += z; -} - -//static -void LLUI::pushMatrix() -{ - gGL.pushUIMatrix(); - LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth)); -} - -//static -void LLUI::popMatrix() -{ - gGL.popUIMatrix(); - LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first; - LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second; - LLFontGL::sOriginStack.pop_back(); -} - -//static -void LLUI::loadIdentity() -{ - gGL.loadUIIdentity(); - LLFontGL::sCurOrigin.mX = 0; - LLFontGL::sCurOrigin.mY = 0; - LLFontGL::sCurDepth = 0.f; -} - -//static -void LLUI::setScaleFactor(const LLVector2 &scale_factor) -{ - sGLScaleFactor = scale_factor; -} - -//static -void LLUI::setLineWidth(F32 width) -{ - gGL.flush(); - glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f)); -} - //static void LLUI::setMousePositionScreen(S32 x, S32 y) { S32 screen_x, screen_y; - screen_x = llround((F32)x * sGLScaleFactor.mV[VX]); - screen_y = llround((F32)y * sGLScaleFactor.mV[VY]); + screen_x = llround((F32)x * getScaleFactor().mV[VX]); + screen_y = llround((F32)y * getScaleFactor().mV[VY]); LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert()); } @@ -1770,8 +248,8 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y) LLCoordWindow cursor_pos_window; getWindow()->getCursorPosition(&cursor_pos_window); LLCoordGL cursor_pos_gl(cursor_pos_window.convert()); - *x = llround((F32)cursor_pos_gl.mX / sGLScaleFactor.mV[VX]); - *y = llround((F32)cursor_pos_gl.mY / sGLScaleFactor.mV[VX]); + *x = llround((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]); + *y = llround((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]); } //static @@ -1885,21 +363,21 @@ LLVector2 LLUI::getWindowSize() LLCoordWindow window_rect; sWindow->getSize(&window_rect); - return LLVector2(window_rect.mX / sGLScaleFactor.mV[VX], window_rect.mY / sGLScaleFactor.mV[VY]); + return LLVector2(window_rect.mX / getScaleFactor().mV[VX], window_rect.mY / getScaleFactor().mV[VY]); } //static void LLUI::screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y) { - *gl_x = llround((F32)screen_x * sGLScaleFactor.mV[VX]); - *gl_y = llround((F32)screen_y * sGLScaleFactor.mV[VY]); + *gl_x = llround((F32)screen_x * getScaleFactor().mV[VX]); + *gl_y = llround((F32)screen_y * getScaleFactor().mV[VY]); } //static void LLUI::glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y) { - *screen_x = llround((F32)gl_x / sGLScaleFactor.mV[VX]); - *screen_y = llround((F32)gl_y / sGLScaleFactor.mV[VY]); + *screen_x = llround((F32)gl_x / getScaleFactor().mV[VX]); + *screen_y = llround((F32)gl_y / getScaleFactor().mV[VY]); } //static @@ -1916,27 +394,6 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen) glPointToScreen(gl.mRight, gl.mBottom, &screen->mRight, &screen->mBottom); } -//static -LLPointer<LLUIImage> LLUI::getUIImageByID(const LLUUID& image_id, S32 priority) -{ - if (sImageProvider) - { - return sImageProvider->getUIImageByID(image_id, priority); - } - else - { - return NULL; - } -} - -//static -LLPointer<LLUIImage> LLUI::getUIImage(const std::string& name, S32 priority) -{ - if (!name.empty() && sImageProvider) - return sImageProvider->getUIImage(name, priority); - else - return NULL; -} LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname) { diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 4c1703392a..0a0e0e164e 100644..100755 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -1,6 +1,6 @@ /** * @file llui.h - * @brief GL function declarations and other general static UI services. + * @brief General static UI services. * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -24,122 +24,38 @@ * $/LicenseInfo$ */ -// All immediate-mode gl drawing should happen here. #ifndef LL_LLUI_H #define LL_LLUI_H -#include "llpointer.h" // LLPointer<> #include "llrect.h" #include "llcontrol.h" #include "llcoord.h" -#include "llglslshader.h" +#include "v2math.h" #include "llinitparam.h" #include "llregistry.h" +#include "llrender2dutils.h" +#include "llpointer.h" #include "lluicolor.h" #include "lluicolortable.h" +#include "lluiimage.h" #include <boost/signals2.hpp> #include "lllazyvalue.h" #include "llframetimer.h" #include <limits> -// LLUIFactory -#include "llsd.h" - // for initparam specialization #include "llfontgl.h" -class LLColor4; -class LLVector3; -class LLVector2; -class LLUIImage; class LLUUID; class LLWindow; class LLView; class LLHelp; -// UI colors -extern const LLColor4 UI_VERTEX_COLOR; void make_ui_sound(const char* name); void make_ui_sound_deferred(const char * name); -BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom); -void gl_state_for_2d(S32 width, S32 height); - -void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2); -void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color ); -void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled); -void gl_rect_2d_simple( S32 width, S32 height ); - -void gl_draw_x(const LLRect& rect, const LLColor4& color); - -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled = TRUE ); -void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled = TRUE ); -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset = 0, BOOL filled = TRUE ); -void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE ); -void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE ); -void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE ); -void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha = 1.0f); - -void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines); - -void gl_circle_2d(F32 x, F32 y, F32 radius, S32 steps, BOOL filled); -void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle); -void gl_deep_circle( F32 radius, F32 depth ); -void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ); -void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac); -void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color); -void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color); - -void gl_draw_image(S32 x, S32 y, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); - -void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); - -void gl_rect_2d_simple_tex( S32 width, S32 height ); - -// segmented rectangles - -/* - TL |______TOP_________| TR - /| |\ - _/_|__________________|_\_ - L| | MIDDLE | |R - _|_|__________________|_|_ - \ | BOTTOM | / - BL\|__________________|/ BR - | | -*/ - -typedef enum e_rounded_edge -{ - ROUNDED_RECT_LEFT = 0x1, - ROUNDED_RECT_TOP = 0x2, - ROUNDED_RECT_RIGHT = 0x4, - ROUNDED_RECT_BOTTOM = 0x8, - ROUNDED_RECT_ALL = 0xf -}ERoundedEdge; - - -void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL); -void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL); -void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, const LLVector3& width_vec, const LLVector3& height_vec); - -inline void gl_rect_2d( const LLRect& rect, BOOL filled ) -{ - gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled ); -} - -inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL filled) -{ - gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled ); -} - class LLImageProviderInterface; typedef void (*LLUIAudioCallback)(const LLUUID& uuid); @@ -281,10 +197,10 @@ public: static void cleanupClass(); static void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& ); - static void pushMatrix(); - static void popMatrix(); - static void loadIdentity(); - static void translate(F32 x, F32 y, F32 z = 0.0f); + static void pushMatrix() { LLRender2D::pushMatrix(); } + static void popMatrix() { LLRender2D::popMatrix(); } + static void loadIdentity() { LLRender2D::loadIdentity(); } + static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::translate(x, y, z); } static LLRect sDirtyRect; static BOOL sDirty; @@ -329,10 +245,13 @@ public: static void getMousePositionScreen(S32 *x, S32 *y); static void setMousePositionLocal(const LLView* viewp, S32 x, S32 y); static void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y); - static void setScaleFactor(const LLVector2& scale_factor); - static void setLineWidth(F32 width); - static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0); - static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0); + static LLVector2& getScaleFactor() { return LLRender2D::sGLScaleFactor; } + static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::setScaleFactor(scale_factor); } + static void setLineWidth(F32 width) { LLRender2D::setLineWidth(width); } + static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0) + { return LLRender2D::getUIImageByID(image_id, priority); } + static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0) + { return LLRender2D::getUIImage(name, priority); } static LLVector2 getWindowSize(); static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); @@ -362,12 +281,10 @@ public: static settings_map_t sSettingGroups; static LLUIAudioCallback sAudioCallback; static LLUIAudioCallback sDeferredAudioCallback; - static LLVector2 sGLScaleFactor; static LLWindow* sWindow; static LLView* sRootView; static LLHelp* sHelpImpl; private: - static LLImageProviderInterface* sImageProvider; static std::vector<std::string> sXUIPaths; static LLFrameTimer sMouseIdleTimer; static add_popup_t sAddPopupFunc; @@ -378,18 +295,6 @@ private: // Moved LLLocalClipRect to lllocalcliprect.h -//RN: maybe this needs to moved elsewhere? -class LLImageProviderInterface -{ -protected: - LLImageProviderInterface() {}; - virtual ~LLImageProviderInterface() {}; -public: - virtual LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) = 0; - virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) = 0; - virtual void cleanUp() = 0; -}; - class LLCallbackRegistry { public: @@ -438,10 +343,11 @@ public: // this avoids a MSVC bug where non-referenced static members are "optimized" away // even if their constructors have side effects - void reference() + S32 reference() { S32 dummy; dummy = 0; + return dummy; } }; @@ -600,7 +506,4 @@ namespace LLInitParam }; } -extern LLGLSLShader gSolidColorProgram; -extern LLGLSLShader gUIProgram; - #endif diff --git a/indra/llui/lluicolor.cpp b/indra/llui/lluicolor.cpp index f9bb80f8c5..f9bb80f8c5 100644..100755 --- a/indra/llui/lluicolor.cpp +++ b/indra/llui/lluicolor.cpp diff --git a/indra/llui/lluicolor.h b/indra/llui/lluicolor.h index 97ebea854a..97ebea854a 100644..100755 --- a/indra/llui/lluicolor.h +++ b/indra/llui/lluicolor.h diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index ffeff15968..ffeff15968 100644..100755 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index 6a7a681d57..6a7a681d57 100644..100755 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h diff --git a/indra/llui/lluiconstants.h b/indra/llui/lluiconstants.h index 1479e58c43..1479e58c43 100644..100755 --- a/indra/llui/lluiconstants.h +++ b/indra/llui/lluiconstants.h diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index b9c843e931..b9c843e931 100644..100755 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index fb2196bb16..fb2196bb16 100644..100755 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 60fee47ae0..60fee47ae0 100644..100755 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 876bb5ef46..876bb5ef46 100644..100755 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h diff --git a/indra/llui/lluifwd.h b/indra/llui/lluifwd.h index a68629a091..a68629a091 100644..100755 --- a/indra/llui/lluifwd.h +++ b/indra/llui/lluifwd.h diff --git a/indra/llui/lluiimage.cpp b/indra/llui/lluiimage.cpp deleted file mode 100644 index 9ed98f941f..0000000000 --- a/indra/llui/lluiimage.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/** - * @file lluiimage.cpp - * @brief UI implementation - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// Utilities functions the user interface needs - -//#include "llviewerprecompiledheaders.h" -#include "linden_common.h" - -// Project includes -#include "lluiimage.h" -#include "llui.h" - -LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image) -: mName(name), - mImage(image), - mScaleRegion(0.f, 1.f, 1.f, 0.f), - mClipRegion(0.f, 1.f, 1.f, 0.f), - mUniformScaling(TRUE), - mNoClip(TRUE), - mImageLoaded(NULL) -{ -} - -LLUIImage::~LLUIImage() -{ - delete mImageLoaded; -} - -void LLUIImage::setClipRegion(const LLRectf& region) -{ - mClipRegion = region; - mNoClip = mClipRegion.mLeft == 0.f - && mClipRegion.mRight == 1.f - && mClipRegion.mBottom == 0.f - && mClipRegion.mTop == 1.f; -} - -void LLUIImage::setScaleRegion(const LLRectf& region) -{ - mScaleRegion = region; - mUniformScaling = mScaleRegion.mLeft == 0.f - && mScaleRegion.mRight == 1.f - && mScaleRegion.mBottom == 0.f - && mScaleRegion.mTop == 1.f; -} - -//TODO: move drawing implementation inside class -void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const -{ - gl_draw_scaled_image(x, y, getWidth(), getHeight(), mImage, color, mClipRegion); -} - -void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const -{ - if (mUniformScaling) - { - gl_draw_scaled_image(x, y, width, height, mImage, color, mClipRegion); - } - else - { - gl_draw_scaled_image_with_border( - x, y, - width, height, - mImage, - color, - FALSE, - mClipRegion, - mScaleRegion); - } -} - -void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const -{ - gl_draw_scaled_image_with_border( - x, y, - width, height, - mImage, - color, - TRUE, - mClipRegion, - mScaleRegion); -} - -void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const -{ - LLRect border_rect; - border_rect.setOriginAndSize(x, y, width, height); - border_rect.stretch(border_width, border_width); - drawSolid(border_rect, color); -} - -void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, const LLVector3& y_axis, - const LLRect& rect, const LLColor4& color) -{ - F32 border_scale = 1.f; - F32 border_height = (1.f - mScaleRegion.getHeight()) * getHeight(); - F32 border_width = (1.f - mScaleRegion.getWidth()) * getWidth(); - if (rect.getHeight() < border_height || rect.getWidth() < border_width) - { - if(border_height - rect.getHeight() > border_width - rect.getWidth()) - { - border_scale = (F32)rect.getHeight() / border_height; - } - else - { - border_scale = (F32)rect.getWidth() / border_width; - } - } - - LLUI::pushMatrix(); - { - LLVector3 rect_origin = origin_agent + (rect.mLeft * x_axis) + (rect.mBottom * y_axis); - LLUI::translate(rect_origin.mV[VX], - rect_origin.mV[VY], - rect_origin.mV[VZ]); - gGL.getTexUnit(0)->bind(getImage()); - gGL.color4fv(color.mV); - - LLRectf center_uv_rect(mClipRegion.mLeft + mScaleRegion.mLeft * mClipRegion.getWidth(), - mClipRegion.mBottom + mScaleRegion.mTop * mClipRegion.getHeight(), - mClipRegion.mLeft + mScaleRegion.mRight * mClipRegion.getWidth(), - mClipRegion.mBottom + mScaleRegion.mBottom * mClipRegion.getHeight()); - gl_segmented_rect_3d_tex(mClipRegion, - center_uv_rect, - LLRectf(border_width * border_scale * 0.5f / (F32)rect.getWidth(), - (rect.getHeight() - (border_height * border_scale * 0.5f)) / (F32)rect.getHeight(), - (rect.getWidth() - (border_width * border_scale * 0.5f)) / (F32)rect.getWidth(), - (border_height * border_scale * 0.5f) / (F32)rect.getHeight()), - rect.getWidth() * x_axis, - rect.getHeight() * y_axis); - - } LLUI::popMatrix(); -} - - -S32 LLUIImage::getWidth() const -{ - // return clipped dimensions of actual image area - return llround((F32)mImage->getWidth(0) * mClipRegion.getWidth()); -} - -S32 LLUIImage::getHeight() const -{ - // return clipped dimensions of actual image area - return llround((F32)mImage->getHeight(0) * mClipRegion.getHeight()); -} - -S32 LLUIImage::getTextureWidth() const -{ - return mImage->getWidth(0); -} - -S32 LLUIImage::getTextureHeight() const -{ - return mImage->getHeight(0); -} - -boost::signals2::connection LLUIImage::addLoadedCallback( const image_loaded_signal_t::slot_type& cb ) -{ - if (!mImageLoaded) - { - mImageLoaded = new image_loaded_signal_t(); - } - return mImageLoaded->connect(cb); -} - - -void LLUIImage::onImageLoaded() -{ - if (mImageLoaded) - { - (*mImageLoaded)(); - } -} - - -namespace LLInitParam -{ - void ParamValue<LLUIImage*>::updateValueFromBlock() - { - // The keyword "none" is specifically requesting a null image - // do not default to current value. Used to overwrite template images. - if (name() == "none") - { - updateValue(NULL); - return; - } - - LLUIImage* imagep = LLUI::getUIImage(name()); - if (imagep) - { - updateValue(imagep); - } - } - - void ParamValue<LLUIImage*>::updateBlockFromValue(bool make_block_authoritative) - { - if (getValue() == NULL) - { - name.set("none", make_block_authoritative); - } - else - { - name.set(getValue()->getName(), make_block_authoritative); - } - } - - - bool ParamCompare<LLUIImage*, false>::equals( - LLUIImage* const &a, - LLUIImage* const &b) - { - // force all LLUIImages for XML UI export to be "non-default" - if (!a && !b) - return false; - else - return (a == b); - } -} - diff --git a/indra/llui/lluiimage.h b/indra/llui/lluiimage.h deleted file mode 100644 index 7817ba1c7b..0000000000 --- a/indra/llui/lluiimage.h +++ /dev/null @@ -1,126 +0,0 @@ -/** - * @file lluiimage.h - * @brief wrapper for images used in the UI that handles smart scaling, etc. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLUIIMAGE_H -#define LL_LLUIIMAGE_H - -#include "v4color.h" -#include "llpointer.h" -#include "llrefcount.h" -#include "llrefcount.h" -#include "llrect.h" -#include <boost/function.hpp> -#include <boost/signals2.hpp> -#include "llinitparam.h" -#include "lltexture.h" - -extern const LLColor4 UI_VERTEX_COLOR; - -class LLUIImage : public LLRefCount -{ -public: - typedef boost::signals2::signal<void (void)> image_loaded_signal_t; - - LLUIImage(const std::string& name, LLPointer<LLTexture> image); - virtual ~LLUIImage(); - - void setClipRegion(const LLRectf& region); - void setScaleRegion(const LLRectf& region); - - LLPointer<LLTexture> getImage() { return mImage; } - const LLPointer<LLTexture>& getImage() const { return mImage; } - - void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR) const; - void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR) const; - void draw(const LLRect& rect, const LLColor4& color = UI_VERTEX_COLOR) const { draw(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color); } - - void drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const; - void drawSolid(const LLRect& rect, const LLColor4& color) const { drawSolid(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color); } - void drawSolid(S32 x, S32 y, const LLColor4& color) const { drawSolid(x, y, getWidth(), getHeight(), color); } - - void drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const; - void drawBorder(const LLRect& rect, const LLColor4& color, S32 border_width) const { drawBorder(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color, border_width); } - void drawBorder(S32 x, S32 y, const LLColor4& color, S32 border_width) const { drawBorder(x, y, getWidth(), getHeight(), color, border_width); } - - void draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, const LLVector3& y_axis, const LLRect& rect, const LLColor4& color); - - const std::string& getName() const { return mName; } - - virtual S32 getWidth() const; - virtual S32 getHeight() const; - - // returns dimensions of underlying textures, which might not be equal to ui image portion - S32 getTextureWidth() const; - S32 getTextureHeight() const; - - boost::signals2::connection addLoadedCallback( const image_loaded_signal_t::slot_type& cb ); - - void onImageLoaded(); - -protected: - image_loaded_signal_t* mImageLoaded; - - std::string mName; - LLRectf mScaleRegion; - LLRectf mClipRegion; - LLPointer<LLTexture> mImage; - BOOL mUniformScaling; - BOOL mNoClip; -}; - -namespace LLInitParam -{ - template<> - class ParamValue<LLUIImage*> - : public CustomParamValue<LLUIImage*> - { - typedef boost::add_reference<boost::add_const<LLUIImage*>::type>::type T_const_ref; - typedef CustomParamValue<LLUIImage*> super_t; - public: - Optional<std::string> name; - - ParamValue(LLUIImage* const& image = NULL) - : super_t(image) - { - updateBlockFromValue(false); - addSynonym(name, "name"); - } - - void updateValueFromBlock(); - void updateBlockFromValue(bool make_block_authoritative); - }; - - // Need custom comparison function for our test app, which only loads - // LLUIImage* as NULL. - template<> - struct ParamCompare<LLUIImage*, false> - { - static bool equals(LLUIImage* const &a, LLUIImage* const &b); - }; -} - -typedef LLPointer<LLUIImage> LLUIImagePtr; -#endif diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index c4e073ccdb..c4e073ccdb 100644..100755 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index cb40c85582..cb40c85582 100644..100755 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h diff --git a/indra/llui/llundo.cpp b/indra/llui/llundo.cpp index 06b0514223..06b0514223 100644..100755 --- a/indra/llui/llundo.cpp +++ b/indra/llui/llundo.cpp diff --git a/indra/llui/llundo.h b/indra/llui/llundo.h index a6da550126..a6da550126 100644..100755 --- a/indra/llui/llundo.h +++ b/indra/llui/llundo.h diff --git a/indra/llui/llurlaction.cpp b/indra/llui/llurlaction.cpp index f51aeaec13..f51aeaec13 100644..100755 --- a/indra/llui/llurlaction.cpp +++ b/indra/llui/llurlaction.cpp diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index e31cd71a20..e31cd71a20 100644..100755 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 99ee688888..99ee688888 100644..100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 8c6c32178a..8c6c32178a 100644..100755 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h diff --git a/indra/llui/llurlmatch.cpp b/indra/llui/llurlmatch.cpp index c1f1382a9f..c1f1382a9f 100644..100755 --- a/indra/llui/llurlmatch.cpp +++ b/indra/llui/llurlmatch.cpp diff --git a/indra/llui/llurlmatch.h b/indra/llui/llurlmatch.h index 2818f45207..2818f45207 100644..100755 --- a/indra/llui/llurlmatch.h +++ b/indra/llui/llurlmatch.h diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 523ee5d78c..523ee5d78c 100644..100755 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp diff --git a/indra/llui/llurlregistry.h b/indra/llui/llurlregistry.h index da16171a97..da16171a97 100644..100755 --- a/indra/llui/llurlregistry.h +++ b/indra/llui/llurlregistry.h diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 3613a40e2c..3613a40e2c 100644..100755 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 15b85a6418..15b85a6418 100644..100755 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp index 919267dcc6..919267dcc6 100644..100755 --- a/indra/llui/llviewborder.cpp +++ b/indra/llui/llviewborder.cpp diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h index 413ce39744..413ce39744 100644..100755 --- a/indra/llui/llviewborder.h +++ b/indra/llui/llviewborder.h diff --git a/indra/llui/llviewinject.cpp b/indra/llui/llviewinject.cpp index 46c5839f8e..46c5839f8e 100644..100755 --- a/indra/llui/llviewinject.cpp +++ b/indra/llui/llviewinject.cpp diff --git a/indra/llui/llviewinject.h b/indra/llui/llviewinject.h index 0de3d155c4..0de3d155c4 100644..100755 --- a/indra/llui/llviewinject.h +++ b/indra/llui/llviewinject.h diff --git a/indra/llui/llviewmodel.cpp b/indra/llui/llviewmodel.cpp index a9f8acc440..a9f8acc440 100644..100755 --- a/indra/llui/llviewmodel.cpp +++ b/indra/llui/llviewmodel.cpp diff --git a/indra/llui/llviewmodel.h b/indra/llui/llviewmodel.h index ef2e314799..ef2e314799 100644..100755 --- a/indra/llui/llviewmodel.h +++ b/indra/llui/llviewmodel.h diff --git a/indra/llui/llviewquery.cpp b/indra/llui/llviewquery.cpp index d0b78ba186..d0b78ba186 100644..100755 --- a/indra/llui/llviewquery.cpp +++ b/indra/llui/llviewquery.cpp diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h index 210f95162a..210f95162a 100644..100755 --- a/indra/llui/llviewquery.h +++ b/indra/llui/llviewquery.h diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index f5c463c961..f5c463c961 100644..100755 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h index 6d753d1161..6d753d1161 100644..100755 --- a/indra/llui/llwindowshade.h +++ b/indra/llui/llwindowshade.h diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 3ad5ad7d42..3ad5ad7d42 100644..100755 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h index e48663e5cc..e48663e5cc 100644..100755 --- a/indra/llui/llxuiparser.h +++ b/indra/llui/llxuiparser.h diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index 5d3f9ac327..5d3f9ac327 100644..100755 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 8f0a48018f..c3f0e92cb0 100644..100755 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -31,7 +31,7 @@ #include "llurlentry_stub.cpp" #include "lltut.h" #include "../lluicolortable.h" -#include "../lluiimage.h" +#include "../llrender/lluiimage.h" #include <boost/regex.hpp> diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp index 109d3ca7bb..55c1efefef 100644..100755 --- a/indra/llui/tests/llurlmatch_test.cpp +++ b/indra/llui/tests/llurlmatch_test.cpp @@ -28,7 +28,7 @@ #include "linden_common.h" #include "../llurlmatch.h" -#include "../lluiimage.h" +#include "../llrender/lluiimage.h" #include "lltut.h" // link seams |