summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-09-18 16:57:57 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-09-18 17:27:12 +0300
commit0d7f6d917af2e0b19a32a925ded6fab4b1a6725e (patch)
treebf99cbd68261b3b4c61b1f3d042044eb76db6fa2 /indra
parenta5c8b1cbe20c2ccd609f550ff4983741f622fc27 (diff)
SL-13729 Performance of LLUI and LLRender2D #3
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llaccordionctrltab.cpp2
-rw-r--r--indra/llui/llconsole.cpp2
-rw-r--r--indra/llui/llfolderview.cpp2
-rw-r--r--indra/llui/llfolderviewmodel.cpp2
-rw-r--r--indra/llui/lltooltip.cpp2
-rw-r--r--indra/llui/llui.cpp14
-rw-r--r--indra/llui/llui.h4
-rw-r--r--indra/llui/llview.cpp14
-rw-r--r--indra/llui/llview.h3
-rw-r--r--indra/newview/llviewerdisplay.cpp33
-rw-r--r--indra/newview/llviewerwindow.cpp2
11 files changed, 37 insertions, 43 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 1034a21905..16ca578111 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -977,7 +977,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
LLRect screen_rect;
localRectToScreen(child->getRect(),&screen_rect);
- if ( root_rect.overlaps(screen_rect) && LLUI::getInstance()->mDirtyRect.overlaps(screen_rect))
+ if ( root_rect.overlaps(screen_rect) && sDirtyRect.overlaps(screen_rect))
{
gGL.matrixMode(LLRender::MM_MODELVIEW);
LLUI::pushMatrix();
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index de09fdbafd..8fc2978bdd 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -181,7 +181,7 @@ void LLConsole::draw()
LLUIImagePtr imagep = LLUI::getUIImage("transparent");
static LLCachedControl<F32> console_bg_opacity(*LLUI::getInstance()->mSettingGroups["config"], "ConsoleBackgroundOpacity", 0.7f);
- F32 console_opacity = llclamp((F32)console_bg_opacity, 0.f, 1.f);
+ F32 console_opacity = llclamp(console_bg_opacity(), 0.f, 1.f);
LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground");
color.mV[VALPHA] *= console_opacity;
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 483862298c..622c9edba7 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -344,7 +344,7 @@ void LLFolderView::filter( LLFolderViewFilter& filter )
LL_RECORD_BLOCK_TIME(FTM_FILTER);
static LLCachedControl<S32> time_visible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10);
static LLCachedControl<S32> time_invisible(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameUnvisible", 1);
- filter.resetTime(llclamp((S32)(mParentPanel.get()->getVisible() ? time_visible : time_invisible), 1, 100));
+ filter.resetTime(llclamp((mParentPanel.get()->getVisible() ? time_visible() : time_invisible()), 1, 100));
// Note: we filter the model, not the view
getViewModelItem()->filter(filter);
diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp
index a91c3e07d4..93122503d1 100644
--- a/indra/llui/llfolderviewmodel.cpp
+++ b/indra/llui/llfolderviewmodel.cpp
@@ -49,7 +49,7 @@ std::string LLFolderViewModelCommon::getStatusText()
void LLFolderViewModelCommon::filter()
{
static LLCachedControl<S32> max_time(*LLUI::getInstance()->mSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible", 10);
- getFilter().resetTime(llclamp((S32)max_time, 1, 100));
+ getFilter().resetTime(llclamp(max_time(), 1, 100));
mFolderView->getViewModelItem()->filter(getFilter());
}
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index 1262e8a820..2f56a8b1d0 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -359,7 +359,7 @@ void LLToolTip::draw()
if (mFadeTimer.getStarted())
{
static LLCachedControl<F32> tool_tip_fade_time(*LLUI::getInstance()->mSettingGroups["config"], "ToolTipFadeTime", 0.2f);
- alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, (F32)tool_tip_fade_time, 1.f, 0.f);
+ alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, tool_tip_fade_time(), 1.f, 0.f);
if (alpha == 0.f)
{
// finished fading out, so hide ourselves
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 77b59e5bc5..6f16745bd3 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -154,7 +154,6 @@ mAudioCallback(audio_callback),
mDeferredAudioCallback(deferred_audio_callback),
mWindow(NULL), // set later in startup
mRootView(NULL),
-mDirty(FALSE),
mHelpImpl(NULL)
{
LLRender2D::initParamSingleton(image_provider);
@@ -203,19 +202,6 @@ void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& rem
mClearPopupsFunc = clear_popups;
}
-void LLUI::dirtyRect(LLRect rect)
-{
- if (!mDirty)
- {
- mDirtyRect = rect;
- mDirty = TRUE;
- }
- else
- {
- mDirtyRect.unionWith(rect);
- }
-}
-
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
#if defined(LL_DARWIN)
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 238bef3bf8..30dbd7248f 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -245,10 +245,6 @@ public:
void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& );
- LLRect mDirtyRect;
- BOOL mDirty;
- void dirtyRect(LLRect rect);
-
// Return the ISO639 language name ("en", "ko", etc.) for the viewer UI.
// http://www.loc.gov/standards/iso639-2/php/code_list.php
std::string getUILanguage();
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 8b889376b8..f8686018b8 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -60,6 +60,8 @@ static const S32 LINE_HEIGHT = 15;
S32 LLView::sDepth = 0;
bool LLView::sDebugRects = false;
+bool LLView::sIsRectDirty = false;
+LLRect LLView::sDirtyRect;
bool LLView::sDebugRectsShowNames = true;
bool LLView::sDebugKeys = false;
bool LLView::sDebugMouseHandling = false;
@@ -1181,7 +1183,7 @@ void LLView::drawChildren()
if (viewp->getVisible() && viewp->getRect().isValid())
{
LLRect screen_rect = viewp->calcScreenRect();
- if ( rootp->getLocalRect().overlaps(screen_rect) && LLUI::getInstance()->mDirtyRect.overlaps(screen_rect))
+ if ( rootp->getLocalRect().overlaps(screen_rect) && sDirtyRect.overlaps(screen_rect))
{
LLUI::pushMatrix();
{
@@ -1223,7 +1225,15 @@ void LLView::dirtyRect()
parent = parent->getParent();
}
- LLUI::getInstance()->dirtyRect(cur->calcScreenRect());
+ if (!sIsRectDirty)
+ {
+ sDirtyRect = cur->calcScreenRect();
+ sIsRectDirty = true;
+ }
+ else
+ {
+ sDirtyRect.unionWith(cur->calcScreenRect());
+ }
}
//Draw a box for debugging.
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index db81900aaf..7c90794ddb 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -656,6 +656,9 @@ public:
// Draw debug rectangles around widgets to help with alignment and spacing
static bool sDebugRects;
+ static bool sIsRectDirty;
+ static LLRect sDirtyRect;
+
// Draw widget names and sizes when drawing debug rectangles, turning this
// off is useful to make the rectangles themselves easier to see.
static bool sDebugRectsShowNames;
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index f025863072..b4361b3968 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1524,10 +1524,9 @@ void render_ui_2d()
if (gSavedSettings.getBOOL("RenderUIBuffer"))
{
- LLUI* ui_inst = LLUI::getInstance();
- if (ui_inst->mDirty)
+ if (LLView::sIsRectDirty)
{
- ui_inst->mDirty = FALSE;
+ LLView::sIsRectDirty = false;
LLRect t_rect;
gPipeline.mUIScreen.bindTarget();
@@ -1535,25 +1534,25 @@ void render_ui_2d()
{
static const S32 pad = 8;
- ui_inst->mDirtyRect.mLeft -= pad;
- ui_inst->mDirtyRect.mRight += pad;
- ui_inst->mDirtyRect.mBottom -= pad;
- ui_inst->mDirtyRect.mTop += pad;
+ LLView::sDirtyRect.mLeft -= pad;
+ LLView::sDirtyRect.mRight += pad;
+ LLView::sDirtyRect.mBottom -= pad;
+ LLView::sDirtyRect.mTop += pad;
LLGLEnable scissor(GL_SCISSOR_TEST);
- static LLRect last_rect = ui_inst->mDirtyRect;
+ static LLRect last_rect = LLView::sDirtyRect;
//union with last rect to avoid mouse poop
- last_rect.unionWith(ui_inst->mDirtyRect);
+ last_rect.unionWith(LLView::sDirtyRect);
- t_rect = ui_inst->mDirtyRect;
- ui_inst->mDirtyRect = last_rect;
+ t_rect = LLView::sDirtyRect;
+ LLView::sDirtyRect = last_rect;
last_rect = t_rect;
-
- last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / ui_inst->getScaleFactor().mV[0]);
- last_rect.mRight = LLRect::tCoordType(last_rect.mRight / ui_inst->getScaleFactor().mV[0]);
- last_rect.mTop = LLRect::tCoordType(last_rect.mTop / ui_inst->getScaleFactor().mV[1]);
- last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / ui_inst->getScaleFactor().mV[1]);
+
+ last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::getScaleFactor().mV[0]);
+ last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::getScaleFactor().mV[0]);
+ last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::getScaleFactor().mV[1]);
+ last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::getScaleFactor().mV[1]);
LLRect clip_rect(last_rect);
@@ -1565,7 +1564,7 @@ void render_ui_2d()
gPipeline.mUIScreen.flush();
gGL.setColorMask(true, false);
- ui_inst->mDirtyRect = t_rect;
+ LLView::sDirtyRect = t_rect;
}
LLGLDisable cull(GL_CULL_FACE);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 0cc1e0df06..85c8b42da9 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2580,7 +2580,7 @@ void LLViewerWindow::draw()
if (!gSavedSettings.getBOOL("RenderUIBuffer"))
{
- LLUI::getInstance()->mDirtyRect = getWindowRectScaled();
+ LLView::sDirtyRect = getWindowRectScaled();
}
// HACK for timecode debugging