viewer#2411 Use font buffer for inventory

master
Andrey Kleshchev 2024-09-06 20:13:17 +03:00
parent 6af471482d
commit 4a00280b89
7 changed files with 29 additions and 12 deletions

View File

@ -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);
}
//--------------------------------------------------------------------------------//

View File

@ -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;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -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,

View File

@ -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; }

View File

@ -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
//

View File

@ -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);

View File

@ -234,6 +234,7 @@ private:
conversations_items_deque mConversationEventQueue;
LLTimer mParticipantRefreshTimer;
bool mGeneralTitleInUse = true;
};
#endif // LL_LLFLOATERIMCONTAINER_H