summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-09-07 20:20:18 +0300
committerGitHub <noreply@github.com>2024-09-07 20:20:18 +0300
commit2e886b7cfef14d087c2167e3384e9e19dcb3ff63 (patch)
tree69c67eec8a621b04cf15f04b86b16b33baebe079 /indra
parent9ce23ccc5ea75442fd44173befdadaf6cc9d2ec2 (diff)
parent4a00280b892ea82d2c0732ab52778a2c19bdc810 (diff)
Merge pull request #2521 from secondlife/andreyk/viewer_2411
viewer#2411 Use font buffer for inventory
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfolderviewitem.cpp10
-rw-r--r--indra/llui/llfolderviewitem.h4
-rw-r--r--indra/llui/lltextbase.cpp11
-rw-r--r--indra/llui/lltextbase.h3
-rw-r--r--indra/llui/lltexteditor.h2
-rw-r--r--indra/newview/llfloaterimcontainer.cpp10
-rw-r--r--indra/newview/llfloaterimcontainer.h1
7 files changed, 29 insertions, 12 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index e4f5664908..2879f0354f 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -307,6 +307,7 @@ void LLFolderViewItem::refresh()
LLFolderViewModelItem& vmi = *getViewModelItem();
mLabel = utf8str_to_wstring(vmi.getDisplayName());
+ mLabelFontBuffer.reset();
setToolTip(vmi.getName());
// icons are slightly expensive to get, can be optimized
// see LLInventoryIcon::getIcon()
@@ -320,6 +321,7 @@ void LLFolderViewItem::refresh()
// Can do a number of expensive checks, like checking active motions, wearables or friend list
mLabelStyle = vmi.getLabelStyle();
mLabelSuffix = utf8str_to_wstring(vmi.getLabelSuffix());
+ mSuffixFontBuffer.reset();
}
// Dirty the filter flag of the model from the view (CHUI-849)
@@ -890,7 +892,7 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y
//--------------------------------------------------------------------------------//
// Draw the actual label text
//
- font->render(mLabel, 0, x, y, color,
+ mLabelFontBuffer.render(font, mLabel, 0, x, y, color,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/true);
}
@@ -999,9 +1001,9 @@ void LLFolderViewItem::draw()
//
if (!mLabelSuffix.empty())
{
- suffix_font->render( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : sSuffixColor.get(),
- LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
- S32_MAX, S32_MAX, &right_x);
+ mSuffixFontBuffer.render(suffix_font, mLabelSuffix, 0, right_x, y, isFadeItem() ? color : sSuffixColor.get(),
+ LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
+ S32_MAX, S32_MAX, &right_x);
}
//--------------------------------------------------------------------------------//
diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h
index 60cdac3ab9..c37bf64dee 100644
--- a/indra/llui/llfolderviewitem.h
+++ b/indra/llui/llfolderviewitem.h
@@ -29,6 +29,7 @@
#include "llflashtimer.h"
#include "llview.h"
#include "lluiimage.h"
+#include "llfontvertexbuffer.h"
class LLFolderView;
class LLFolderViewModelItem;
@@ -307,6 +308,9 @@ public:
private:
static std::map<U8, LLFontGL*> sFonts; // map of styles to fonts
+
+ LLFontVertexBuffer mLabelFontBuffer;
+ LLFontVertexBuffer mSuffixFontBuffer;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 615619d244..e2d31085c4 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -3342,7 +3342,6 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
const LLWString& text = getWText();
S32 text_gen = mEditor.getTextGeneration();
- bool is_text_read_only = mEditor.getReadOnly();
if (text_gen != mLastGeneration)
{
@@ -3354,8 +3353,8 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
}
const LLFontGL* font = mStyle->getFont();
-
- LLColor4 color = (is_text_read_only ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha());
+ LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha());
+ bool use_font_buffers = useFontBuffers();
if( selection_start > seg_start )
{
@@ -3363,7 +3362,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
S32 start = seg_start;
S32 end = llmin( selection_start, seg_end );
S32 length = end - start;
- if (is_text_read_only)
+ if (use_font_buffers)
{
mFontBufferPreSelection.render(
font,
@@ -3407,7 +3406,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
S32 end = llmin( selection_end, seg_end );
S32 length = end - start;
- if (is_text_read_only)
+ if (use_font_buffers)
{
mFontBufferSelection.render(
font,
@@ -3444,7 +3443,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
S32 start = llmax( selection_end, seg_start );
S32 end = seg_end;
S32 length = end - start;
- if (is_text_read_only)
+ if (use_font_buffers)
{
mFontBufferPostSelection.render(
font,
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index e2981c2637..eb4697da15 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -151,6 +151,7 @@ public:
/*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask);
protected:
+ virtual bool useFontBuffers() const { return true; }
F32 drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRectf rect);
virtual const LLWString& getWText() const;
@@ -484,7 +485,7 @@ public:
LLRect getDocRectFromDocIndex(S32 pos) const;
void setReadOnly(bool read_only) { mReadOnly = read_only; }
- bool getReadOnly() { return mReadOnly; }
+ bool getReadOnly() const { return mReadOnly; }
void setSkipLinkUnderline(bool skip_link_underline) { mSkipLinkUnderline = skip_link_underline; }
bool getSkipLinkUnderline() { return mSkipLinkUnderline; }
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 0b5acf19a1..e9e7070414 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -271,6 +271,8 @@ protected:
virtual bool getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const;
virtual S32 getPreeditFontSize() const;
virtual LLWString getPreeditString() const { return getWText(); }
+
+ virtual bool useFontBuffers() const { return getReadOnly(); }
//
// Protected data
//
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index abf15ea9cf..e55bf50724 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -306,6 +306,9 @@ bool LLFloaterIMContainer::postBuild()
mParticipantRefreshTimer.setTimerExpirySec(0);
mParticipantRefreshTimer.start();
+ mGeneralTitleInUse = true; // avoid reseting strings on idle
+ setTitle(mGeneralTitle);
+
return true;
}
@@ -521,7 +524,12 @@ void LLFloaterIMContainer::idleUpdate()
// Update floater's title as required by the currently selected session or use the default title
LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(current_session->getUUID());
- setTitle(conversation_floaterp && conversation_floaterp->needsTitleOverwrite() ? conversation_floaterp->getTitle() : mGeneralTitle);
+ bool needs_override = conversation_floaterp && conversation_floaterp->needsTitleOverwrite();
+ if (mGeneralTitleInUse == needs_override)
+ {
+ mGeneralTitleInUse = !needs_override;
+ setTitle(needs_override ? conversation_floaterp->getTitle() : mGeneralTitle);
+ }
}
mParticipantRefreshTimer.setTimerExpirySec(1.0f);
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index d1cfd3442c..e5486e67da 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -234,6 +234,7 @@ private:
conversations_items_deque mConversationEventQueue;
LLTimer mParticipantRefreshTimer;
+ bool mGeneralTitleInUse = true;
};
#endif // LL_LLFLOATERIMCONTAINER_H