# Conflicts:
#	indra/llrender/llfontgl.cpp
#	indra/llrender/llrender.cpp
#	indra/llui/llbutton.h
#	indra/llui/llscrolllistctrl.cpp
#	indra/llui/llscrolllistctrl.h
#	indra/newview/llhudtext.h
#	indra/newview/llinventorymodelbackgroundfetch.cpp
#	indra/newview/llviewermenu.cpp
#	indra/newview/skins/default/xui/en/menu_viewer.xml
master
Ansariel 2024-09-04 11:17:13 +02:00
commit a9b52b1f73
47 changed files with 1329 additions and 570 deletions

View File

@ -2386,11 +2386,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>archive</key> <key>archive</key>
<map> <map>
<key>hash</key> <key>hash</key>
<string>c16deaf773cb2a5d001732122ee3ec74db1dceeb</string> <string>76444e37be0cfccdbb5921370ba150ded2bf3c59</string>
<key>hash_algorithm</key> <key>hash_algorithm</key>
<string>sha1</string> <string>sha1</string>
<key>url</key> <key>url</key>
<string>https://github.com/secondlife/3p-openjpeg/releases/download/v2.5.0.ea12248/openjpeg-2.5.0.ea12248-darwin64-ea12248.tar.zst</string> <string>https://github.com/secondlife/3p-openjpeg/releases/download/v2.5.2-r1/openjpeg-2.5.2.10604495243-darwin64-10604495243.tar.zst</string>
</map> </map>
<key>name</key> <key>name</key>
<string>darwin64</string> <string>darwin64</string>
@ -2400,11 +2400,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>archive</key> <key>archive</key>
<map> <map>
<key>hash</key> <key>hash</key>
<string>8c277dde6076fb682cb07264dd70f6f2298b633f</string> <string>6bd289a9c4564b80369ce40ecbb24a213c2732ff</string>
<key>hash_algorithm</key> <key>hash_algorithm</key>
<string>sha1</string> <string>sha1</string>
<key>url</key> <key>url</key>
<string>https://github.com/secondlife/3p-openjpeg/releases/download/v2.5.0.ea12248/openjpeg-2.5.0.ea12248-linux64-ea12248.tar.zst</string> <string>https://github.com/secondlife/3p-openjpeg/releases/download/v2.5.2-r1/openjpeg-2.5.2.10604495243-linux64-10604495243.tar.zst</string>
</map> </map>
<key>name</key> <key>name</key>
<string>linux64</string> <string>linux64</string>
@ -2414,11 +2414,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>archive</key> <key>archive</key>
<map> <map>
<key>hash</key> <key>hash</key>
<string>2abf9535adf21ebdf2295f8a680300432abe6280</string> <string>5e6e0180adc01e07438cb98daec96543b5d85019</string>
<key>hash_algorithm</key> <key>hash_algorithm</key>
<string>sha1</string> <string>sha1</string>
<key>url</key> <key>url</key>
<string>https://github.com/secondlife/3p-openjpeg/releases/download/v2.5.0.ea12248/openjpeg-2.5.0.ea12248-windows64-ea12248.tar.zst</string> <string>https://github.com/secondlife/3p-openjpeg/releases/download/v2.5.2-r1/openjpeg-2.5.2.10604495243-windows64-10604495243.tar.zst</string>
</map> </map>
<key>name</key> <key>name</key>
<string>windows64</string> <string>windows64</string>

View File

@ -1216,6 +1216,7 @@ PanteraPolnocy
SL-18937 SL-18937
SL-19207 SL-19207
SL-19681 SL-19681
secondlife/viewer#2483
Parvati Silverweb Parvati Silverweb
Patric Mills Patric Mills
VWR-2645 VWR-2645

View File

@ -17,6 +17,7 @@ set(llrender_SOURCE_FILES
llfontfreetype.cpp llfontfreetype.cpp
llfontfreetypesvg.cpp llfontfreetypesvg.cpp
llfontgl.cpp llfontgl.cpp
llfontvertexbuffer.cpp
llfontregistry.cpp llfontregistry.cpp
llgl.cpp llgl.cpp
llglslshader.cpp llglslshader.cpp
@ -43,6 +44,7 @@ set(llrender_HEADER_FILES
llcubemap.h llcubemap.h
llcubemaparray.h llcubemaparray.h
llfontgl.h llfontgl.h
llfontvertexbuffer.h
llfontfreetype.h llfontfreetype.h
llfontfreetypesvg.h llfontfreetypesvg.h
llfontbitmapcache.h llfontbitmapcache.h

View File

@ -270,14 +270,14 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
const LLFontGlyphInfo* next_glyph = NULL; const LLFontGlyphInfo* next_glyph = NULL;
const S32 GLYPH_BATCH_SIZE = 30; static constexpr S32 GLYPH_BATCH_SIZE = 30;
// <FS:Ansariel> Remove QUADS rendering mode // <FS:Ansariel> Remove QUADS rendering mode
//LLVector3 vertices[GLYPH_BATCH_SIZE * 4]; //static thread_local LLVector3 vertices[GLYPH_BATCH_SIZE * 4];
//LLVector2 uvs[GLYPH_BATCH_SIZE * 4]; //static thread_local LLVector2 uvs[GLYPH_BATCH_SIZE * 4];
//LLColor4U colors[GLYPH_BATCH_SIZE * 4]; //static thread_local LLColor4U colors[GLYPH_BATCH_SIZE * 4];
LLVector3 vertices[GLYPH_BATCH_SIZE * 6]; static thread_local LLVector3 vertices[GLYPH_BATCH_SIZE * 6];
LLVector2 uvs[GLYPH_BATCH_SIZE * 6]; static thread_local LLVector2 uvs[GLYPH_BATCH_SIZE * 6];
LLColor4U colors[GLYPH_BATCH_SIZE * 6]; static thread_local LLColor4U colors[GLYPH_BATCH_SIZE * 6];
// </FS:Ansariel> // </FS:Ansariel>
LLColor4U text_color(color); LLColor4U text_color(color);
@ -428,7 +428,6 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (draw_ellipses) if (draw_ellipses)
{ {
// recursively render ellipses at end of string // recursively render ellipses at end of string
// we've already reserved enough room // we've already reserved enough room
gGL.pushUIMatrix(); gGL.pushUIMatrix();
@ -530,6 +529,7 @@ F32 LLFontGL::getWidthF32(const std::string& utf8text, S32 begin_offset, S32 max
F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars, bool no_padding) const F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars, bool no_padding) const
{ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL; const S32 LAST_CHARACTER = LLFontFreetype::LAST_CHAR_FULL;
F32 cur_x = 0; F32 cur_x = 0;

View File

@ -0,0 +1,209 @@
/**
* @file llfontvertexbuffer.cpp
* @brief Buffer storage for font rendering.
*
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2024, 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$
*/
#include "linden_common.h"
#include "llfontvertexbuffer.h"
#include "llvertexbuffer.h"
LLFontVertexBuffer::LLFontVertexBuffer()
{
}
LLFontVertexBuffer::~LLFontVertexBuffer()
{
reset();
}
void LLFontVertexBuffer::reset()
{
mBufferList.clear();
}
S32 LLFontVertexBuffer::render(
const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
LLRect rect,
const LLColor4& color,
LLFontGL::HAlign halign, LLFontGL::VAlign valign,
U8 style,
LLFontGL::ShadowType shadow,
S32 max_chars, S32 max_pixels,
F32* right_x,
bool use_ellipses,
bool use_color)
{
LLRectf rect_float((F32)rect.mLeft, (F32)rect.mTop, (F32)rect.mRight, (F32)rect.mBottom);
return render(fontp, text, begin_offset, rect_float, color, halign, valign, style, shadow, max_chars, right_x, use_ellipses, use_color);
}
S32 LLFontVertexBuffer::render(
const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
LLRectf rect,
const LLColor4& color,
LLFontGL::HAlign halign, LLFontGL::VAlign valign,
U8 style,
LLFontGL::ShadowType shadow,
S32 max_chars,
F32* right_x,
bool use_ellipses,
bool use_color)
{
F32 x = rect.mLeft;
F32 y = 0.f;
switch (valign)
{
case LLFontGL::TOP:
y = rect.mTop;
break;
case LLFontGL::VCENTER:
y = rect.getCenterY();
break;
case LLFontGL::BASELINE:
case LLFontGL::BOTTOM:
y = rect.mBottom;
break;
default:
y = rect.mBottom;
break;
}
return render(fontp, text, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, (S32)rect.getWidth(), right_x, use_ellipses, use_color);
}
S32 LLFontVertexBuffer::render(
const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
F32 x, F32 y,
const LLColor4& color,
LLFontGL::HAlign halign, LLFontGL::VAlign valign,
U8 style,
LLFontGL::ShadowType shadow,
S32 max_chars , S32 max_pixels,
F32* right_x,
bool use_ellipses,
bool use_color )
{
if (!LLFontGL::sDisplayFont) //do not display texts
{
return static_cast<S32>(text.length());
}
if (mBufferList.empty())
{
genBuffers(fontp, text, begin_offset, x, y, color, halign, valign,
style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color);
}
else if (mLastX != x
|| mLastY != y
|| mLastFont != fontp
|| mLastColor != color // alphas change often
|| mLastHalign != halign
|| mLastValign != valign
|| mLastOffset != begin_offset
|| mLastMaxChars != max_chars
|| mLastMaxPixels != max_pixels
|| mLastStyle != style
|| mLastShadow != shadow // ex: buttons change shadow state
|| mLastScaleX != LLFontGL::sScaleX
|| mLastScaleY != LLFontGL::sScaleY
|| mLastOrigin != LLFontGL::sCurOrigin)
{
genBuffers(fontp, text, begin_offset, x, y, color, halign, valign,
style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color);
}
else
{
renderBuffers();
if (right_x)
{
*right_x = mLastRightX;
}
}
return mChars;
}
void LLFontVertexBuffer::genBuffers(
const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
F32 x, F32 y,
const LLColor4& color,
LLFontGL::HAlign halign, LLFontGL::VAlign valign,
U8 style, LLFontGL::ShadowType shadow,
S32 max_chars, S32 max_pixels,
F32* right_x,
bool use_ellipses,
bool use_color)
{
// todo: add a debug build assert if this triggers too often for to long?
mBufferList.clear();
gGL.beginList(&mBufferList);
mChars = fontp->render(text, begin_offset, x, y, color, halign, valign,
style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color);
gGL.endList();
mLastFont = fontp;
mLastOffset = begin_offset;
mLastMaxChars = max_chars;
mLastMaxPixels = max_pixels;
mLastX = x;
mLastY = y;
mLastColor = color;
mLastHalign = halign;
mLastValign = valign;
mLastStyle = style;
mLastShadow = shadow;
mLastScaleX = LLFontGL::sScaleX;
mLastScaleY = LLFontGL::sScaleY;
mLastOrigin = LLFontGL::sCurOrigin;
if (right_x)
{
mLastRightX = *right_x;
}
}
void LLFontVertexBuffer::renderBuffers()
{
gGL.flush(); // deliberately empty pending verts
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
gGL.pushUIMatrix();
for (LLVertexBufferData& buffer : mBufferList)
{
buffer.draw();
}
gGL.popUIMatrix();
}

View File

@ -0,0 +1,119 @@
/**
* @file llfontgl.h
* @author Andrii Kleshchev
* @brief Buffer storage for font rendering.
*
* $LicenseInfo:firstyear=2001&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_LLFONTVERTEXBUFFER_H
#define LL_LLFONTVERTEXBUFFER_H
#include "llfontgl.h"
class LLVertexBufferData;
class LLFontVertexBuffer
{
public:
LLFontVertexBuffer();
~LLFontVertexBuffer();
void reset();
S32 render(const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
LLRect rect,
const LLColor4& color,
LLFontGL::HAlign halign = LLFontGL::LEFT, LLFontGL::VAlign valign = LLFontGL::BASELINE,
U8 style = LLFontGL::NORMAL,
LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW,
S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX,
F32* right_x = NULL,
bool use_ellipses = false,
bool use_color = true);
S32 render(const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
LLRectf rect,
const LLColor4& color,
LLFontGL::HAlign halign = LLFontGL::LEFT, LLFontGL::VAlign valign = LLFontGL::BASELINE,
U8 style = LLFontGL::NORMAL,
LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW,
S32 max_chars = S32_MAX,
F32* right_x = NULL,
bool use_ellipses = false,
bool use_color = true);
S32 render(const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
F32 x, F32 y,
const LLColor4& color,
LLFontGL::HAlign halign = LLFontGL::LEFT, LLFontGL::VAlign valign = LLFontGL::BASELINE,
U8 style = LLFontGL::NORMAL,
LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW,
S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX,
F32* right_x = NULL,
bool use_ellipses = false,
bool use_color = true);
private:
void genBuffers(const LLFontGL* fontp,
const LLWString& text,
S32 begin_offset,
F32 x, F32 y,
const LLColor4& color,
LLFontGL::HAlign halign, LLFontGL::VAlign valign,
U8 style,
LLFontGL::ShadowType shadow,
S32 max_chars, S32 max_pixels,
F32* right_x,
bool use_ellipses,
bool use_color);
void renderBuffers();
std::list<LLVertexBufferData> mBufferList;
S32 mChars = 0;
const LLFontGL *mLastFont = nullptr;
S32 mLastOffset = 0;
S32 mLastMaxChars = 0;
S32 mLastMaxPixels = 0;
F32 mLastX = 0.f;
F32 mLastY = 0.f;
LLColor4 mLastColor;
LLFontGL::HAlign mLastHalign = LLFontGL::LEFT;
LLFontGL::VAlign mLastValign = LLFontGL::BASELINE;
U8 mLastStyle = LLFontGL::NORMAL;
LLFontGL::ShadowType mLastShadow = LLFontGL::NO_SHADOW;
F32 mLastRightX = 0.f;
// LLFontGL's statics
F32 mLastScaleX = 1.f;
F32 mLastScaleY = 1.f;
LLCoordGL mLastOrigin;
};
#endif

View File

@ -77,6 +77,7 @@ struct LLVBCache
}; };
static std::unordered_map<U64, LLVBCache> sVBCache; static std::unordered_map<U64, LLVBCache> sVBCache;
static thread_local std::list<LLVertexBufferData> *sBufferDataList = nullptr;
static const GLenum sGLTextureType[] = static const GLenum sGLTextureType[] =
{ {
@ -1569,6 +1570,30 @@ void LLRender::clearErrors()
} }
} }
void LLRender::beginList(std::list<LLVertexBufferData> *list)
{
if (sBufferDataList)
{
LL_ERRS() << "beginList called while another list is open." << LL_ENDL;
}
llassert(LLGLSLShader::sCurBoundShaderPtr == &gUIProgram);
flush();
sBufferDataList = list;
}
void LLRender::endList()
{
if (sBufferDataList)
{
flush();
sBufferDataList = nullptr;
}
else
{
llassert(false); // endList called without an open list
}
}
void LLRender::begin(const GLuint& mode) void LLRender::begin(const GLuint& mode)
{ {
if (mode != mMode) if (mode != mMode)
@ -1613,6 +1638,7 @@ void LLRender::end()
flush(); flush();
} }
} }
void LLRender::flush() void LLRender::flush()
{ {
STOP_GLERROR; STOP_GLERROR;
@ -1663,9 +1689,45 @@ void LLRender::flush()
if (mBuffer) if (mBuffer)
{ {
HBXXH64 hash; LLVertexBuffer *vb;
U32 attribute_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask; U32 attribute_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask;
if (sBufferDataList)
{
vb = genBuffer(attribute_mask, count);
sBufferDataList->emplace_back(
vb,
mMode,
count,
gGL.getTexUnit(0)->mCurrTexture,
mMatrix[MM_MODELVIEW][mMatIdx[MM_MODELVIEW]],
mMatrix[MM_PROJECTION][mMatIdx[MM_PROJECTION]],
mMatrix[MM_TEXTURE0][mMatIdx[MM_TEXTURE0]]
);
}
else
{
vb = bufferfromCache(attribute_mask, count);
}
drawBuffer(vb, mMode, count);
}
else
{
// mBuffer is present in main thread and not present in an image thread
LL_ERRS() << "A flush call from outside main rendering thread" << LL_ENDL;
}
resetStriders(count);
}
}
LLVertexBuffer* LLRender::bufferfromCache(U32 attribute_mask, U32 count)
{
LLVertexBuffer *vb = nullptr;
HBXXH64 hash;
{ {
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache hash"); LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache hash");
@ -1683,7 +1745,6 @@ void LLRender::flush()
hash.finalize(); hash.finalize();
} }
U64 vhash = hash.digest(); U64 vhash = hash.digest();
// check the VB cache before making a new vertex buffer // check the VB cache before making a new vertex buffer
@ -1697,8 +1758,6 @@ void LLRender::flush()
// cache just before creating a vertex buffer in VRAM // cache just before creating a vertex buffer in VRAM
std::unordered_map<U64, LLVBCache>::iterator cache = sVBCache.find(vhash); std::unordered_map<U64, LLVBCache>::iterator cache = sVBCache.find(vhash);
LLPointer<LLVertexBuffer> vb;
if (cache != sVBCache.end()) if (cache != sVBCache.end())
{ {
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache hit"); LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache hit");
@ -1709,27 +1768,7 @@ void LLRender::flush()
else else
{ {
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache miss"); LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache miss");
vb = new LLVertexBuffer(attribute_mask); vb = genBuffer(attribute_mask, count);
vb->allocateBuffer(count, 0);
vb->setBuffer();
vb->setPositionData((LLVector4a*) mVerticesp.get());
if (attribute_mask & LLVertexBuffer::MAP_TEXCOORD0)
{
vb->setTexCoord0Data(mTexcoordsp.get());
}
if (attribute_mask & LLVertexBuffer::MAP_COLOR)
{
vb->setColorData(mColorsp.get());
}
#if LL_DARWIN
vb->unmapBuffer();
#endif
vb->unbind();
sVBCache[vhash] = { vb , std::chrono::steady_clock::now() }; sVBCache[vhash] = { vb , std::chrono::steady_clock::now() };
@ -1756,11 +1795,42 @@ void LLRender::flush()
} }
} }
} }
return vb;
}
LLVertexBuffer* LLRender::genBuffer(U32 attribute_mask, S32 count)
{
LLVertexBuffer * vb = new LLVertexBuffer(attribute_mask);
vb->allocateBuffer(count, 0);
vb->setBuffer(); vb->setBuffer();
vb->setPositionData((LLVector4a*)mVerticesp.get());
if (attribute_mask & LLVertexBuffer::MAP_TEXCOORD0)
{
vb->setTexCoord0Data(mTexcoordsp.get());
}
if (attribute_mask & LLVertexBuffer::MAP_COLOR)
{
vb->setColorData(mColorsp.get());
}
#if LL_DARWIN
vb->unmapBuffer();
#endif
vb->unbind();
return vb;
}
void LLRender::drawBuffer(LLVertexBuffer* vb, U32 mode, S32 count)
{
vb->setBuffer();
// <FS:Ansariel> Remove QUADS rendering mode // <FS:Ansariel> Remove QUADS rendering mode
//if (mMode == LLRender::QUADS && sGLCoreProfile) //if (mode == LLRender::QUADS && sGLCoreProfile)
//{ //{
// vb->drawArrays(LLRender::TRIANGLES, 0, count); // vb->drawArrays(LLRender::TRIANGLES, 0, count);
// mQuadCycle = 1; // mQuadCycle = 1;
@ -1768,23 +1838,18 @@ void LLRender::flush()
//else //else
// </FS:Ansariel> // </FS:Ansariel>
{ {
vb->drawArrays(mMode, 0, count); vb->drawArrays(mode, 0, count);
} }
} }
else
void LLRender::resetStriders(S32 count)
{ {
// mBuffer is present in main thread and not present in an image thread
LL_ERRS() << "A flush call from outside main rendering thread" << LL_ENDL;
}
mVerticesp[0] = mVerticesp[count]; mVerticesp[0] = mVerticesp[count];
mTexcoordsp[0] = mTexcoordsp[count]; mTexcoordsp[0] = mTexcoordsp[count];
mColorsp[0] = mColorsp[count]; mColorsp[0] = mColorsp[count];
mCount = 0; mCount = 0;
} }
}
void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
{ {

View File

@ -55,12 +55,14 @@
#endif #endif
#include <array> #include <array>
#include <list>
class LLVertexBuffer; class LLVertexBuffer;
class LLCubeMap; class LLCubeMap;
class LLImageGL; class LLImageGL;
class LLRenderTarget; class LLRenderTarget;
class LLTexture; class LLTexture;
class LLVertexBufferData;
#define LL_MATRIX_STACK_DEPTH 32 #define LL_MATRIX_STACK_DEPTH 32
@ -426,8 +428,15 @@ public:
void flush(); void flush();
// if list is set, will store buffers in list for later use, if list isn't set, will use cache
void beginList(std::list<LLVertexBufferData> *list);
void endList();
void begin(const GLuint& mode); void begin(const GLuint& mode);
void end(); void end();
U8 getMode() const { return mMode; }
void vertex2i(const GLint& x, const GLint& y); void vertex2i(const GLint& x, const GLint& y);
void vertex2f(const GLfloat& x, const GLfloat& y); void vertex2f(const GLfloat& x, const GLfloat& y);
void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z); void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z);
@ -498,6 +507,11 @@ public:
private: private:
friend class LLLightState; friend class LLLightState;
LLVertexBuffer* bufferfromCache(U32 attribute_mask, U32 count);
LLVertexBuffer* genBuffer(U32 attribute_mask, S32 count);
void drawBuffer(LLVertexBuffer* vb, U32 mode, S32 count);
void resetStriders(S32 count);
eMatrixMode mMatrixMode; eMatrixMode mMatrixMode;
U32 mMatIdx[NUM_MATRIX_MODES]; U32 mMatIdx[NUM_MATRIX_MODES];
U32 mMatHash[NUM_MATRIX_MODES]; U32 mMatHash[NUM_MATRIX_MODES];
@ -534,7 +548,6 @@ private:
std::vector<LLVector3> mUIOffset; std::vector<LLVector3> mUIOffset;
std::vector<LLVector3> mUIScale; std::vector<LLVector3> mUIScale;
}; };
extern F32 gGLModelView[16]; extern F32 gGLModelView[16];

View File

@ -571,6 +571,56 @@ public:
static LLVBOPool* sVBOPool = nullptr; static LLVBOPool* sVBOPool = nullptr;
void LLVertexBufferData::draw()
{
if (!mVB)
{
llassert(false);
// Not supposed to happen, check buffer generation
return;
}
if (mTexName)
{
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTexName);
}
else
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
gGL.loadMatrix(mModelView.m);
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
gGL.loadMatrix(mProjection.m);
gGL.matrixMode(LLRender::MM_TEXTURE0);
gGL.pushMatrix();
gGL.loadMatrix(mTexture0.m);
mVB->setBuffer();
// <FS:Ansariel> Remove QUADS rendering mode
//if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
//{
// mVB->drawArrays(LLRender::TRIANGLES, 0, mCount);
//}
//else
// </FS:Ansariel>
{
mVB->drawArrays(mMode, 0, mCount);
}
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
}
//============================================================================
//static //static
U64 LLVertexBuffer::getBytesAllocated() U64 LLVertexBuffer::getBytesAllocated()
{ {

View File

@ -53,6 +53,37 @@
//============================================================================ //============================================================================
// base class // base class
class LLPrivateMemoryPool; class LLPrivateMemoryPool;
class LLVertexBuffer;
class LLVertexBufferData
{
public:
LLVertexBufferData()
: mVB(nullptr)
, mMode(0)
, mCount(0)
, mTexName(0)
{}
LLVertexBufferData(LLVertexBuffer* buffer, U8 mode, U32 count, U32 tex_name, glh::matrix4f model_view, glh::matrix4f projection, glh::matrix4f texture0)
: mVB(buffer)
, mMode(mode)
, mCount(count)
, mTexName(tex_name)
, mProjection(model_view)
, mModelView(projection)
, mTexture0(texture0)
{}
void draw();
LLPointer<LLVertexBuffer> mVB;
U8 mMode;
U32 mCount;
U32 mTexName;
glh::matrix4f mProjection;
glh::matrix4f mModelView;
glh::matrix4f mTexture0;
};
typedef std::list<LLVertexBufferData> buffer_data_list_t;
class LLVertexBuffer final : public LLRefCount class LLVertexBuffer final : public LLRefCount
{ {
public: public:

View File

@ -27,6 +27,8 @@
#define LLBADGE_CPP #define LLBADGE_CPP
#include "llbadge.h" #include "llbadge.h"
#include "llfontgl.h"
#include "llfontvertexbuffer.h"
#include "llscrollcontainer.h" #include "llscrollcontainer.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
@ -363,8 +365,8 @@ void LLBadge::draw()
// //
// Draw the label // Draw the label
// //
mFontBuffer.render(mGLFont,
mGLFont->render(mLabel.getWString(), mLabel.getWString(),
badge_label_begin_offset, badge_label_begin_offset,
badge_center_x + mLabelOffsetHoriz, badge_center_x + mLabelOffsetHoriz,
badge_center_y + mLabelOffsetVert, badge_center_y + mLabelOffsetVert,

View File

@ -34,12 +34,14 @@
#include "llstring.h" #include "llstring.h"
#include "lluiimage.h" #include "lluiimage.h"
#include "llview.h" #include "llview.h"
#include "llfontvertexbuffer.h"
// //
// Declarations // Declarations
// //
class LLFontGL; class LLFontGL;
class LLFontVertexBuffer;
class LLScrollContainer; class LLScrollContainer;
class LLUICtrlFactory; class LLUICtrlFactory;
@ -144,6 +146,7 @@ private:
LLUIColor mBorderColor; LLUIColor mBorderColor;
const LLFontGL* mGLFont; const LLFontGL* mGLFont;
LLFontVertexBuffer mFontBuffer;
LLPointer< LLUIImage > mImage; LLPointer< LLUIImage > mImage;
LLUIColor mImageColor; LLUIColor mImageColor;

View File

@ -43,6 +43,8 @@
#include "llfloater.h" #include "llfloater.h"
#include "llfloaterreg.h" #include "llfloaterreg.h"
#include "llfocusmgr.h" #include "llfocusmgr.h"
#include "llfontgl.h"
#include "llfontvertexbuffer.h"
#include "llwindow.h" #include "llwindow.h"
#include "llnotificationsutil.h" #include "llnotificationsutil.h"
#include "llrender.h" #include "llrender.h"
@ -131,7 +133,6 @@ LLButton::LLButton(const LLButton::Params& p)
LLBadgeOwner(getHandle()), LLBadgeOwner(getHandle()),
mMouseDownFrame(0), mMouseDownFrame(0),
mMouseHeldDownCount(0), mMouseHeldDownCount(0),
mBorderEnabled( false ),
mFlashing( false ), mFlashing( false ),
mCurGlowStrength(0.f), mCurGlowStrength(0.f),
mNeedsHighlight(false), mNeedsHighlight(false),
@ -349,6 +350,30 @@ void LLButton::onCommit()
LLUICtrl::onCommit(); LLUICtrl::onCommit();
} }
void LLButton::setUnselectedLabelColor(const LLUIColor& c)
{
mUnselectedLabelColor = c;
mFontBuffer.reset();
}
void LLButton::setSelectedLabelColor(const LLUIColor& c)
{
mSelectedLabelColor = c;
mFontBuffer.reset();
}
void LLButton::setUseEllipses(bool use_ellipses)
{
mUseEllipses = use_ellipses;
mFontBuffer.reset();
}
void LLButton::setUseFontColor(bool use_font_color)
{
mUseFontColor = use_font_color;
mFontBuffer.reset();
}
boost::signals2::connection LLButton::setClickedCallback(const CommitCallbackParam& cb) boost::signals2::connection LLButton::setClickedCallback(const CommitCallbackParam& cb)
{ {
return setClickedCallback(initCommitCallback(cb)); return setClickedCallback(initCommitCallback(cb));
@ -453,6 +478,18 @@ bool LLButton::postBuild()
return LLUICtrl::postBuild(); return LLUICtrl::postBuild();
} }
void LLButton::onVisibilityChange(bool new_visibility)
{
mFontBuffer.reset();
return LLUICtrl::onVisibilityChange(new_visibility);
}
void LLButton::dirtyRect()
{
LLUICtrl::dirtyRect();
mFontBuffer.reset();
}
bool LLButton::handleUnicodeCharHere(llwchar uni_char) bool LLButton::handleUnicodeCharHere(llwchar uni_char)
{ {
bool handled = false; bool handled = false;
@ -639,19 +676,25 @@ void LLButton::onMouseLeave(S32 x, S32 y, MASK mask)
{ {
LLUICtrl::onMouseLeave(x, y, mask); LLUICtrl::onMouseLeave(x, y, mask);
mNeedsHighlight = false; setHighlight(false);
} }
void LLButton::setHighlight(bool b) void LLButton::setHighlight(bool b)
{
if (mNeedsHighlight != b)
{ {
mNeedsHighlight = b; mNeedsHighlight = b;
mFontBuffer.reset();
}
} }
bool LLButton::handleHover(S32 x, S32 y, MASK mask) bool LLButton::handleHover(S32 x, S32 y, MASK mask)
{ {
if (isInEnabledChain() if (isInEnabledChain()
&& (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() == this)) && (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() == this))
mNeedsHighlight = true; {
setHighlight(true);
}
if (!childrenHandleHover(x, y, mask)) if (!childrenHandleHover(x, y, mask))
{ {
@ -1020,7 +1063,7 @@ void LLButton::draw()
// LLFontGL::render expects S32 max_chars variable but process in a separate way -1 value. // LLFontGL::render expects S32 max_chars variable but process in a separate way -1 value.
// Due to U32_MAX is equal to S32 -1 value I have rest this value for non-ellipses mode. // Due to U32_MAX is equal to S32 -1 value I have rest this value for non-ellipses mode.
// Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars. // Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars.
mLastDrawCharsCount = mGLFont->render(label, 0, mLastDrawCharsCount = mFontBuffer.render(mGLFont, label, 0,
(F32)x, (F32)x,
(F32)(getRect().getHeight() / 2 + mBottomVPad), (F32)(getRect().getHeight() / 2 + mBottomVPad),
label_color % alpha, label_color % alpha,
@ -1071,6 +1114,7 @@ void LLButton::setToggleState(bool b)
setFlashing(false); // stop flash state whenever the selected/unselected state if reset setFlashing(false); // stop flash state whenever the selected/unselected state if reset
// Unselected label assignments // Unselected label assignments
autoResize(); autoResize();
mFontBuffer.reset();
} }
} }
@ -1100,11 +1144,13 @@ bool LLButton::toggleState()
void LLButton::setLabel( const std::string& label ) void LLButton::setLabel( const std::string& label )
{ {
mUnselectedLabel = mSelectedLabel = label; mUnselectedLabel = mSelectedLabel = label;
mFontBuffer.reset();
} }
void LLButton::setLabel( const LLUIString& label ) void LLButton::setLabel( const LLUIString& label )
{ {
mUnselectedLabel = mSelectedLabel = label; mUnselectedLabel = mSelectedLabel = label;
mFontBuffer.reset();
} }
void LLButton::setLabel( const LLStringExplicit& label ) void LLButton::setLabel( const LLStringExplicit& label )
@ -1118,17 +1164,32 @@ bool LLButton::setLabelArg( const std::string& key, const LLStringExplicit& text
{ {
mUnselectedLabel.setArg(key, text); mUnselectedLabel.setArg(key, text);
mSelectedLabel.setArg(key, text); mSelectedLabel.setArg(key, text);
mFontBuffer.reset();
return true; return true;
} }
void LLButton::setLabelUnselected( const LLStringExplicit& label ) void LLButton::setLabelUnselected( const LLStringExplicit& label )
{ {
mUnselectedLabel = label; mUnselectedLabel = label;
mFontBuffer.reset();
} }
void LLButton::setLabelSelected( const LLStringExplicit& label ) void LLButton::setLabelSelected( const LLStringExplicit& label )
{ {
mSelectedLabel = label; mSelectedLabel = label;
mFontBuffer.reset();
}
void LLButton::setDisabledLabelColor(const LLUIColor& c)
{
mDisabledLabelColor = c;
mFontBuffer.reset();
}
void LLButton::setFont(const LLFontGL* font)
{
mGLFont = (font ? font : LLFontGL::getFontSansSerif());
mFontBuffer.reset();
} }
bool LLButton::labelIsTruncated() const bool LLButton::labelIsTruncated() const
@ -1141,6 +1202,12 @@ const LLUIString& LLButton::getCurrentLabel() const
return getToggleState() ? mSelectedLabel : mUnselectedLabel; return getToggleState() ? mSelectedLabel : mUnselectedLabel;
} }
void LLButton::setDropShadowedText(bool b)
{
mDropShadowedText = b;
mFontBuffer.reset();
}
void LLButton::setImageUnselected(LLPointer<LLUIImage> image) void LLButton::setImageUnselected(LLPointer<LLUIImage> image)
{ {
mImageUnselected = image; mImageUnselected = image;
@ -1224,6 +1291,7 @@ void LLButton::setImageDisabledSelected(LLPointer<LLUIImage> image)
mImageDisabledSelected = image; mImageDisabledSelected = image;
mDisabledImageColor = mImageColor; mDisabledImageColor = mImageColor;
mFadeWhenDisabled = true; mFadeWhenDisabled = true;
mFontBuffer.reset();
} }
void LLButton::setImagePressed(LLPointer<LLUIImage> image) void LLButton::setImagePressed(LLPointer<LLUIImage> image)

View File

@ -34,7 +34,6 @@
#include "lluictrl.h" #include "lluictrl.h"
#include "v4color.h" #include "v4color.h"
#include "llframetimer.h" #include "llframetimer.h"
#include "llfontgl.h"
#include "lluiimage.h" #include "lluiimage.h"
#include "lluistring.h" #include "lluistring.h"
@ -55,6 +54,8 @@ S32 round_up(S32 grid, S32 value);
class LLUICtrlFactory; class LLUICtrlFactory;
class LLFontGL;
class LLFontVertexBuffer;
// //
// Classes // Classes
@ -160,26 +161,29 @@ public:
void addImageAttributeToXML(LLXMLNodePtr node, const std::string& imageName, void addImageAttributeToXML(LLXMLNodePtr node, const std::string& imageName,
const LLUUID& imageID,const std::string& xmlTagName) const; const LLUUID& imageID,const std::string& xmlTagName) const;
virtual bool handleUnicodeCharHere(llwchar uni_char); virtual bool handleUnicodeCharHere(llwchar uni_char) override;
virtual bool handleKeyHere(KEY key, MASK mask); virtual bool handleKeyHere(KEY key, MASK mask) override;
virtual bool handleMouseDown(S32 x, S32 y, MASK mask); virtual bool handleMouseDown(S32 x, S32 y, MASK mask) override;
virtual bool handleMouseUp(S32 x, S32 y, MASK mask); virtual bool handleMouseUp(S32 x, S32 y, MASK mask) override;
virtual bool handleHover(S32 x, S32 y, MASK mask); virtual bool handleHover(S32 x, S32 y, MASK mask) override;
virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask) override;
virtual bool handleRightMouseUp(S32 x, S32 y, MASK mask); virtual bool handleRightMouseUp(S32 x, S32 y, MASK mask) override;
virtual bool handleDoubleClick(S32 x, S32 y, MASK mask); virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) override;
virtual void draw(); virtual void draw() override;
/*virtual*/ bool postBuild(); /*virtual*/ bool postBuild() override;
virtual void onMouseLeave(S32 x, S32 y, MASK mask); void onVisibilityChange(bool visible) override;
virtual void onMouseCaptureLost(); void dirtyRect() override;
virtual void onCommit(); virtual void onMouseLeave(S32 x, S32 y, MASK mask) override;
virtual void onMouseCaptureLost() override;
void setUnselectedLabelColor( const LLUIColor& c ) { mUnselectedLabelColor = c; } virtual void onCommit() override;
void setSelectedLabelColor( const LLUIColor& c ) { mSelectedLabelColor = c; }
void setUseEllipses( bool use_ellipses ) { mUseEllipses = use_ellipses; } void setUnselectedLabelColor(const LLUIColor& c);
void setUseFontColor( bool use_font_color) { mUseFontColor = use_font_color; } void setSelectedLabelColor(const LLUIColor& c);
void setUseEllipses(bool use_ellipses);
void setUseFontColor(bool use_font_color);
boost::signals2::connection setClickedCallback(const CommitCallbackParam& cb); boost::signals2::connection setClickedCallback(const CommitCallbackParam& cb);
@ -231,9 +235,8 @@ public:
const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); } const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); }
const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); } const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); }
void setImageColor(const std::string& color_control);
void setImageColor(const LLUIColor& c); void setImageColor(const LLUIColor& c);
/*virtual*/ void setColor(const LLUIColor& c); /*virtual*/ void setColor(const LLUIColor& c) override;
void setImages(const std::string &image_name, const std::string &selected_name); void setImages(const std::string &image_name, const std::string &selected_name);
@ -253,15 +256,14 @@ public:
void setLabel(const std::string& label); void setLabel(const std::string& label);
void setLabel(const LLUIString& label); void setLabel(const LLUIString& label);
void setLabel( const LLStringExplicit& label); void setLabel( const LLStringExplicit& label);
virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ) override;
void setLabelUnselected(const LLStringExplicit& label); void setLabelUnselected(const LLStringExplicit& label);
void setLabelSelected(const LLStringExplicit& label); void setLabelSelected(const LLStringExplicit& label);
void setDisabledLabelColor( const LLUIColor& c ) { mDisabledLabelColor = c; } void setDisabledLabelColor(const LLUIColor& c);
void setFont(const LLFontGL *font) void setFont(const LLFontGL* font);
{ mGLFont = ( font ? font : LLFontGL::getFontSansSerif()); } const LLFontGL* getFont() const override { return mGLFont; }
const LLFontGL* getFont() const { return mGLFont; } const std::string& getText() const override { return getCurrentLabel().getString(); }
const std::string& getText() const { return getCurrentLabel().getString(); }
S32 getLastDrawCharsCount() const { return mLastDrawCharsCount; } S32 getLastDrawCharsCount() const { return mLastDrawCharsCount; }
bool labelIsTruncated() const; bool labelIsTruncated() const;
@ -270,9 +272,7 @@ public:
void setScaleImage(bool scale) { mScaleImage = scale; } void setScaleImage(bool scale) { mScaleImage = scale; }
bool getScaleImage() const { return mScaleImage; } bool getScaleImage() const { return mScaleImage; }
void setDropShadowedText(bool b) { mDropShadowedText = b; } void setDropShadowedText(bool b);
void setBorderEnabled(bool b) { mBorderEnabled = b; }
void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; } void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; }
@ -288,7 +288,6 @@ public:
void setCommitOnReturn(bool commit) { mCommitOnReturn = commit; } void setCommitOnReturn(bool commit) { mCommitOnReturn = commit; }
bool getCommitOnReturn() const { return mCommitOnReturn; } bool getCommitOnReturn() const { return mCommitOnReturn; }
static void onHeldDown(void *userdata); // to be called by gIdleCallbacks
static void toggleFloaterAndSetToggleState(LLUICtrl* ctrl, const LLSD& sdname); static void toggleFloaterAndSetToggleState(LLUICtrl* ctrl, const LLSD& sdname);
static void setFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname); static void setFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname);
static void setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname); static void setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname);
@ -322,8 +321,6 @@ protected:
enable_signal_t* mIsToggledSignal; // <FS:Ansariel> Toggle callback check enable_signal_t* mIsToggledSignal; // <FS:Ansariel> Toggle callback check
const LLFontGL* mGLFont;
S32 mMouseDownFrame; S32 mMouseDownFrame;
S32 mMouseHeldDownCount; // Counter for parameter passed to held-down callback S32 mMouseHeldDownCount; // Counter for parameter passed to held-down callback
F32 mHeldDownDelay; // seconds, after which held-down callbacks get called F32 mHeldDownDelay; // seconds, after which held-down callbacks get called
@ -375,7 +372,6 @@ protected:
bool mAutoResize; bool mAutoResize;
bool mUseEllipses; bool mUseEllipses;
bool mUseFontColor; bool mUseFontColor;
bool mBorderEnabled;
bool mFlashing; bool mFlashing;
LLFontGL::HAlign mHAlign; LLFontGL::HAlign mHAlign;
@ -412,8 +408,12 @@ protected:
LLPanel* mCheckboxControlPanel; LLPanel* mCheckboxControlPanel;
// </FS:Zi> // </FS:Zi>
private:
const LLFontGL* mGLFont;
LLFontVertexBuffer mFontBuffer;
protected: protected:
virtual std::string _getSearchText() const virtual std::string _getSearchText() const override
{ {
return getLabelUnselected() + getToolTip(); return getLabelUnselected() + getToolTip();
} }

View File

@ -210,14 +210,27 @@ void LLComboBox::clear()
void LLComboBox::onCommit() void LLComboBox::onCommit()
{ {
if (mAllowTextEntry && getCurrentIndex() != -1) if (LLScrollListItem* item = mList->getFirstSelected())
{
if (mAllowTextEntry && mTextEntry)
{ {
// we have selected an existing item, blitz the manual text entry with // we have selected an existing item, blitz the manual text entry with
// the properly capitalized item // the properly capitalized item
mTextEntry->setValue(getSimple()); LLSD label = item->getColumn(0)->getValue();
mTextEntry->setValue(label);
mTextEntry->setTentative(false); mTextEntry->setTentative(false);
} }
setControlValue(getValue()); setControlValue(item->getValue());
}
else if (mAllowTextEntry)
{
setControlValue(mTextEntry->getValue());
}
else
{
setControlValue(LLSD());
}
LLUICtrl::onCommit(); LLUICtrl::onCommit();
} }
@ -364,6 +377,13 @@ bool LLComboBox::setSimple(const LLStringExplicit& name)
// virtual // virtual
void LLComboBox::setValue(const LLSD& value) void LLComboBox::setValue(const LLSD& value)
{ {
if (LLScrollListItem* item = mList->getFirstSelected())
{
LLSD item_value = item->getValue();
if (item_value.asStringRef() == value.asStringRef())
return;
}
bool found = mList->selectByValue(value); bool found = mList->selectByValue(value);
if (found) if (found)
{ {
@ -387,11 +407,9 @@ const std::string LLComboBox::getSimple() const
{ {
return mTextEntry->getText(); return mTextEntry->getText();
} }
else
{
return res; return res;
} }
}
const std::string LLComboBox::getSelectedItemLabel(S32 column) const const std::string LLComboBox::getSelectedItemLabel(S32 column) const
{ {
@ -401,20 +419,18 @@ const std::string LLComboBox::getSelectedItemLabel(S32 column) const
// virtual // virtual
LLSD LLComboBox::getValue() const LLSD LLComboBox::getValue() const
{ {
LLScrollListItem* item = mList->getFirstSelected(); if (LLScrollListItem* item = mList->getFirstSelected())
if( item )
{ {
return item->getValue(); return item->getValue();
} }
else if (mAllowTextEntry)
if (mAllowTextEntry)
{ {
return mTextEntry->getValue(); return mTextEntry->getValue();
} }
else
{
return LLSD(); return LLSD();
} }
}
void LLComboBox::setLabel(const LLStringExplicit& name) void LLComboBox::setLabel(const LLStringExplicit& name)
{ {
@ -515,25 +531,74 @@ void LLComboBox::setButtonVisible(bool visible)
bool LLComboBox::setCurrentByIndex(S32 index) bool LLComboBox::setCurrentByIndex(S32 index)
{ {
bool found = mList->selectNthItem( index ); if (LLScrollListItem* item = mList->getItemByIndex(index))
if (found)
{ {
setLabel(getSelectedItemLabel()); if (item->getEnabled())
mLastSelectedIndex = index; {
mList->selectItem(item, -1, true);
if (mTextEntry)
{
LLSD::String label = item->getColumn(0)->getValue().asString();
mTextEntry->setText(label);
mTextEntry->setTentative(false);
} }
return found; mLastSelectedIndex = index;
return true;
}
}
return false;
} }
S32 LLComboBox::getCurrentIndex() const S32 LLComboBox::getCurrentIndex() const
{ {
LLScrollListItem* item = mList->getFirstSelected(); if (LLScrollListItem* item = mList->getFirstSelected())
if( item )
{ {
return mList->getItemIndex(item); return mList->getItemIndex(item);
} }
return -1; return -1;
} }
bool LLComboBox::selectNextItem()
{
S32 last_index = getItemCount() - 1;
if (last_index < 0)
return false;
S32 current_index = getCurrentIndex();
if (current_index >= last_index)
return false;
S32 new_index = llmax(current_index, -1);
while (++new_index <= last_index)
{
if (setCurrentByIndex(new_index))
return true;
}
return false;
}
bool LLComboBox::selectPrevItem()
{
S32 last_index = getItemCount() - 1;
if (last_index < 0)
return false;
S32 current_index = getCurrentIndex();
if (!current_index)
return false;
S32 new_index = current_index > 0 ? current_index : last_index + 1;
while (--new_index >= 0)
{
if (setCurrentByIndex(new_index))
return true;
}
return false;
}
void LLComboBox::setEnabledByValue(const LLSD& value, bool enabled) void LLComboBox::setEnabledByValue(const LLSD& value, bool enabled)
{ {
LLScrollListItem *found = mList->getItem(value); LLScrollListItem *found = mList->getItem(value);
@ -903,17 +968,48 @@ bool LLComboBox::handleUnicodeCharHere(llwchar uni_char)
// virtual // virtual
bool LLComboBox::handleScrollWheel(S32 x, S32 y, S32 clicks) bool LLComboBox::handleScrollWheel(S32 x, S32 y, S32 clicks)
{ {
if (mList->getVisible()) return mList->handleScrollWheel(x, y, clicks); if (mList->getVisible())
if (mAllowTextEntry) // We might be editable {
if (!mList->getFirstSelected()) // We aren't in the list, don't kill their text return mList->handleScrollWheel(x, y, clicks);
return false; }
setCurrentByIndex(llclamp(getCurrentIndex() + clicks, 0, getItemCount() - 1)); if (mAllowTextEntry) // We might be editable
{
if (!mList->getFirstSelected()) // We aren't in the list, don't kill their text
{
return false;
}
}
S32 current_index = getCurrentIndex();
if (clicks > 0)
{
for (S32 i = 0; i < clicks; ++i)
{
if (!selectNextItem())
break;
}
}
else
{
for (S32 i = 0; i < -clicks; ++i)
{
if (!selectPrevItem())
break;
}
}
S32 new_index = getCurrentIndex();
if (new_index != current_index)
{
prearrangeList(); prearrangeList();
onCommit(); onCommit();
return true; return true;
} }
return false;
}
void LLComboBox::setTextEntry(const LLStringExplicit& text) void LLComboBox::setTextEntry(const LLStringExplicit& text)
{ {
if (mTextEntry) if (mTextEntry)

View File

@ -168,6 +168,9 @@ public:
bool setCurrentByIndex(S32 index); bool setCurrentByIndex(S32 index);
S32 getCurrentIndex() const; S32 getCurrentIndex() const;
bool selectNextItem();
bool selectPrevItem();
void setEnabledByValue(const LLSD& value, bool enabled); void setEnabledByValue(const LLSD& value, bool enabled);
void createLineEditor(const Params&); void createLineEditor(const Params&);

View File

@ -2210,21 +2210,6 @@ void LLFloater::draw()
LLPanel::updateDefaultBtn(); LLPanel::updateDefaultBtn();
if( getDefaultButton() )
{
if (hasFocus() && getDefaultButton()->getEnabled())
{
LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
// is this button a direct descendent and not a nested widget (e.g. checkbox)?
bool focus_is_child_button = dynamic_cast<LLButton*>(focus_ctrl) != NULL && dynamic_cast<LLButton*>(focus_ctrl)->getParent() == this;
// only enable default button when current focus is not a button
getDefaultButton()->setBorderEnabled(!focus_is_child_button);
}
else
{
getDefaultButton()->setBorderEnabled(false);
}
}
if (isMinimized()) if (isMinimized())
{ {
for (S32 i = 0; i < BUTTON_COUNT; i++) for (S32 i = 0; i < BUTTON_COUNT; i++)

View File

@ -242,20 +242,6 @@ void LLPanel::draw()
void LLPanel::updateDefaultBtn() void LLPanel::updateDefaultBtn()
{ {
if( mDefaultBtn)
{
if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled())
{
LLButton* buttonp = dynamic_cast<LLButton*>(gFocusMgr.getKeyboardFocus());
bool focus_is_child_button = buttonp && buttonp->getCommitOnReturn();
// only enable default button when current focus is not a return-capturing button
mDefaultBtn->setBorderEnabled(!focus_is_child_button);
}
else
{
mDefaultBtn->setBorderEnabled(false);
}
}
} }
void LLPanel::refresh() void LLPanel::refresh()
@ -266,15 +252,7 @@ void LLPanel::refresh()
void LLPanel::setDefaultBtn(LLButton* btn) void LLPanel::setDefaultBtn(LLButton* btn)
{ {
if (mDefaultBtn && mDefaultBtn->getEnabled())
{
mDefaultBtn->setBorderEnabled(false);
}
mDefaultBtn = btn; mDefaultBtn = btn;
if (mDefaultBtn)
{
mDefaultBtn->setBorderEnabled(true);
}
} }
void LLPanel::setDefaultBtn(std::string_view id) void LLPanel::setDefaultBtn(std::string_view id)

View File

@ -30,6 +30,7 @@
#include "llscrolllistcell.h" #include "llscrolllistcell.h"
#include "llcheckboxctrl.h" #include "llcheckboxctrl.h"
#include "llfontvertexbuffer.h"
#include "llui.h" // LLUIImage #include "llui.h" // LLUIImage
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
@ -156,7 +157,7 @@ S32 LLScrollListIcon::getWidth() const
} }
void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_color) const void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_color)
{ {
if (mIcon) if (mIcon)
{ {
@ -236,7 +237,7 @@ S32 LLScrollListBar::getWidth() const
} }
void LLScrollListBar::draw(const LLColor4& color, const LLColor4& highlight_color) const void LLScrollListBar::draw(const LLColor4& color, const LLColor4& highlight_color)
{ {
S32 bar_width = getWidth() - mLeftPad - mRightPad; S32 bar_width = getWidth() - mLeftPad - mRightPad;
S32 left = (S32)(bar_width - bar_width * mRatio); S32 left = (S32)(bar_width - bar_width * mRatio);
@ -308,6 +309,19 @@ bool LLScrollListText::needsToolTip() const
return mFont->getWidth(mText.getWString().c_str()) > getWidth(); return mFont->getWidth(mText.getWString().c_str()) > getWidth();
} }
void LLScrollListText::setTextWidth(S32 value)
{
mTextWidth = value;
mFontBuffer.reset();
}
void LLScrollListText::setWidth(S32 width)
{
LLScrollListCell::setWidth(width);
mTextWidth = width;
mFontBuffer.reset();
}
//virtual //virtual
bool LLScrollListText::getVisible() const bool LLScrollListText::getVisible() const
{ {
@ -341,6 +355,7 @@ void LLScrollListText::setColor(const LLColor4& color)
void LLScrollListText::setText(const LLStringExplicit& text) void LLScrollListText::setText(const LLStringExplicit& text)
{ {
mText = text; mText = text;
mFontBuffer.reset();
} }
void LLScrollListText::setFontStyle(const U8 font_style) void LLScrollListText::setFontStyle(const U8 font_style)
@ -348,6 +363,13 @@ void LLScrollListText::setFontStyle(const U8 font_style)
LLFontDescriptor new_desc(mFont->getFontDesc()); LLFontDescriptor new_desc(mFont->getFontDesc());
new_desc.setStyle(font_style); new_desc.setStyle(font_style);
mFont = LLFontGL::getFont(new_desc); mFont = LLFontGL::getFont(new_desc);
mFontBuffer.reset();
}
void LLScrollListText::setAlignment(LLFontGL::HAlign align)
{
mFontAlignment = align;
mFontBuffer.reset();
} }
//virtual //virtual
@ -375,7 +397,7 @@ const LLSD LLScrollListText::getAltValue() const
} }
void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color)
{ {
LLColor4 display_color; LLColor4 display_color;
if (mUseColor) if (mUseColor)
@ -426,7 +448,8 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
start_x = (F32)getWidth() * 0.5f; start_x = (F32)getWidth() * 0.5f;
break; break;
} }
mFont->render(mText.getWString(), 0, mFontBuffer.render(mFont,
mText.getWString(), 0,
start_x, 0.f, start_x, 0.f,
display_color, display_color,
mFontAlignment, mFontAlignment,
@ -475,7 +498,7 @@ LLScrollListCheck::~LLScrollListCheck()
mCheckBox = NULL; mCheckBox = NULL;
} }
void LLScrollListCheck::draw(const LLColor4& color, const LLColor4& highlight_color) const void LLScrollListCheck::draw(const LLColor4& color, const LLColor4& highlight_color)
{ {
mCheckBox->draw(); mCheckBox->draw();
} }
@ -592,7 +615,7 @@ void LLScrollListIconText::setWidth(S32 width)
} }
void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight_color) const void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight_color)
{ {
LLColor4 display_color; LLColor4 display_color;
if (mUseColor) if (mUseColor)
@ -650,7 +673,9 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight
start_icon_x = (S32)(center - (((F32)icon_space + mFont->getWidth(mText.getWString().c_str())) * 0.5f)); start_icon_x = (S32)(center - (((F32)icon_space + mFont->getWidth(mText.getWString().c_str())) * 0.5f));
break; break;
} }
mFont->render(mText.getWString(), 0, mFontBuffer.render(
mFont,
mText.getWString(), 0,
start_text_x, 0.f, start_text_x, 0.f,
display_color, display_color,
mFontAlignment, mFontAlignment,

View File

@ -29,6 +29,7 @@
#define LLSCROLLLISTCELL_H #define LLSCROLLLISTCELL_H
#include "llfontgl.h" // HAlign #include "llfontgl.h" // HAlign
#include "llfontvertexbuffer.h" // HAlign
#include "llpointer.h" // LLPointer<> #include "llpointer.h" // LLPointer<>
#include "lluistring.h" #include "lluistring.h"
#include "v4color.h" #include "v4color.h"
@ -96,7 +97,7 @@ public:
LLScrollListCell(const LLScrollListCell::Params&); LLScrollListCell(const LLScrollListCell::Params&);
virtual ~LLScrollListCell() {}; virtual ~LLScrollListCell() {};
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const {}; // truncate to given width, if possible virtual void draw(const LLColor4& color, const LLColor4& highlight_color) {}; // truncate to given width, if possible
virtual S32 getWidth() const {return mWidth;} virtual S32 getWidth() const {return mWidth;}
virtual S32 getContentWidth() const { return 0; } virtual S32 getContentWidth() const { return 0; }
virtual S32 getHeight() const { return 0; } virtual S32 getHeight() const { return 0; }
@ -127,7 +128,7 @@ class LLScrollListSpacer : public LLScrollListCell
public: public:
LLScrollListSpacer(const LLScrollListCell::Params& p) : LLScrollListCell(p) {} LLScrollListSpacer(const LLScrollListCell::Params& p) : LLScrollListCell(p) {}
/*virtual*/ ~LLScrollListSpacer() {}; /*virtual*/ ~LLScrollListSpacer() {};
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const {} /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) {}
}; };
/* /*
@ -139,7 +140,7 @@ public:
LLScrollListText(const LLScrollListCell::Params&); LLScrollListText(const LLScrollListCell::Params&);
/*virtual*/ ~LLScrollListText(); /*virtual*/ ~LLScrollListText();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const; /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
/*virtual*/ S32 getContentWidth() const; /*virtual*/ S32 getContentWidth() const;
/*virtual*/ S32 getHeight() const; /*virtual*/ S32 getHeight() const;
/*virtual*/ void setValue(const LLSD& value); /*virtual*/ void setValue(const LLSD& value);
@ -155,18 +156,20 @@ public:
/*virtual*/ bool needsToolTip() const; /*virtual*/ bool needsToolTip() const;
S32 getTextWidth() const { return mTextWidth;} S32 getTextWidth() const { return mTextWidth;}
void setTextWidth(S32 value) { mTextWidth = value;} void setTextWidth(S32 value);
virtual void setWidth(S32 width) { LLScrollListCell::setWidth(width); mTextWidth = width; } virtual void setWidth(S32 width);
void setText(const LLStringExplicit& text); void setText(const LLStringExplicit& text);
void setFontStyle(const U8 font_style); void setFontStyle(const U8 font_style);
void setAlignment(LLFontGL::HAlign align) { mFontAlignment = align; } void setAlignment(LLFontGL::HAlign align);
protected: protected:
LLUIString mText; LLUIString mText;
LLUIString mAltText; LLUIString mAltText;
S32 mTextWidth; S32 mTextWidth;
const LLFontGL* mFont; const LLFontGL* mFont;
LLFontVertexBuffer mFontBuffer;
LLColor4 mColor; LLColor4 mColor;
LLColor4 mHighlightColor; LLColor4 mHighlightColor;
U8 mUseColor; U8 mUseColor;
@ -188,7 +191,7 @@ class LLScrollListIcon : public LLScrollListCell
public: public:
LLScrollListIcon(const LLScrollListCell::Params& p); LLScrollListIcon(const LLScrollListCell::Params& p);
/*virtual*/ ~LLScrollListIcon(); /*virtual*/ ~LLScrollListIcon();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const; /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
/*virtual*/ S32 getWidth() const; /*virtual*/ S32 getWidth() const;
/*virtual*/ S32 getHeight() const; /*virtual*/ S32 getHeight() const;
/*virtual*/ const LLSD getValue() const; /*virtual*/ const LLSD getValue() const;
@ -207,7 +210,7 @@ class LLScrollListBar : public LLScrollListCell
public: public:
LLScrollListBar(const LLScrollListCell::Params& p); LLScrollListBar(const LLScrollListCell::Params& p);
/*virtual*/ ~LLScrollListBar(); /*virtual*/ ~LLScrollListBar();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const; /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
/*virtual*/ S32 getWidth() const; /*virtual*/ S32 getWidth() const;
/*virtual*/ S32 getHeight() const; /*virtual*/ S32 getHeight() const;
/*virtual*/ const LLSD getValue() const; /*virtual*/ const LLSD getValue() const;
@ -229,7 +232,7 @@ class LLScrollListCheck : public LLScrollListCell
public: public:
LLScrollListCheck( const LLScrollListCell::Params&); LLScrollListCheck( const LLScrollListCell::Params&);
/*virtual*/ ~LLScrollListCheck(); /*virtual*/ ~LLScrollListCheck();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const; /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
/*virtual*/ S32 getHeight() const { return 0; } /*virtual*/ S32 getHeight() const { return 0; }
/*virtual*/ const LLSD getValue() const; /*virtual*/ const LLSD getValue() const;
/*virtual*/ void setValue(const LLSD& value); /*virtual*/ void setValue(const LLSD& value);
@ -264,13 +267,11 @@ class LLScrollListIconText : public LLScrollListText
public: public:
LLScrollListIconText(const LLScrollListCell::Params& p); LLScrollListIconText(const LLScrollListCell::Params& p);
/*virtual*/ ~LLScrollListIconText(); /*virtual*/ ~LLScrollListIconText();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const; /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color);
/*virtual*/ const LLSD getValue() const; /*virtual*/ const LLSD getValue() const;
/*virtual*/ void setValue(const LLSD& value); /*virtual*/ void setValue(const LLSD& value);
/*virtual*/ void setWidth(S32 width);
S32 getIconWidth() const;
/*virtual*/ void setWidth(S32 width);/* { LLScrollListCell::setWidth(width); mTextWidth = width - ; }*/
private: private:
LLPointer<LLUIImage> mIcon; LLPointer<LLUIImage> mIcon;

View File

@ -494,10 +494,8 @@ void LLScrollListCtrl::clearRows()
LLScrollListItem* LLScrollListCtrl::getFirstSelected() const LLScrollListItem* LLScrollListCtrl::getFirstSelected() const
{ {
item_list::const_iterator iter; for (LLScrollListItem* item : mItemList)
for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter;
if (item->getSelected()) if (item->getSelected())
{ {
return item; return item;
@ -509,10 +507,8 @@ LLScrollListItem* LLScrollListCtrl::getFirstSelected() const
std::vector<LLScrollListItem*> LLScrollListCtrl::getAllSelected() const std::vector<LLScrollListItem*> LLScrollListCtrl::getAllSelected() const
{ {
std::vector<LLScrollListItem*> ret; std::vector<LLScrollListItem*> ret;
item_list::const_iterator iter; for (LLScrollListItem* item : mItemList)
for(iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter;
if (item->getSelected()) if (item->getSelected())
{ {
ret.push_back(item); ret.push_back(item);
@ -525,9 +521,8 @@ S32 LLScrollListCtrl::getNumSelected() const
{ {
S32 numSelected = 0; S32 numSelected = 0;
for(item_list::const_iterator iter = mItemList.begin(); iter != mItemList.end(); ++iter) for (LLScrollListItem* item : mItemList)
{ {
LLScrollListItem* item = *iter;
if (item->getSelected()) if (item->getSelected())
{ {
++numSelected; ++numSelected;
@ -544,10 +539,8 @@ S32 LLScrollListCtrl::getFirstSelectedIndex() const
// make sure sort is up to date before returning an index // make sure sort is up to date before returning an index
updateSort(); updateSort();
item_list::const_iterator iter; for (LLScrollListItem* item : mItemList)
for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter;
// <FS:Ansariel> Fix for FS-specific people list (radar) // <FS:Ansariel> Fix for FS-specific people list (radar)
if (isFiltered(item)) if (isFiltered(item))
{ {
@ -566,29 +559,19 @@ S32 LLScrollListCtrl::getFirstSelectedIndex() const
LLScrollListItem* LLScrollListCtrl::getFirstData() const LLScrollListItem* LLScrollListCtrl::getFirstData() const
{ {
if (mItemList.size() == 0) return mItemList.empty() ? NULL : mItemList.front();
{
return NULL;
}
return mItemList[0];
} }
LLScrollListItem* LLScrollListCtrl::getLastData() const LLScrollListItem* LLScrollListCtrl::getLastData() const
{ {
if (mItemList.size() == 0) return mItemList.empty() ? NULL : mItemList.back();
{
return NULL;
}
return mItemList[mItemList.size() - 1];
} }
std::vector<LLScrollListItem*> LLScrollListCtrl::getAllData() const std::vector<LLScrollListItem*> LLScrollListCtrl::getAllData() const
{ {
std::vector<LLScrollListItem*> ret; std::vector<LLScrollListItem*> ret;
item_list::const_iterator iter; for (LLScrollListItem* item : mItemList)
for(iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter;
ret.push_back(item); ret.push_back(item);
} }
return ret; return ret;
@ -597,22 +580,20 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllData() const
// returns first matching item // returns first matching item
LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const
{ {
std::string string_val = sd.asString(); const std::string& string_val = sd.asStringRef();
item_list::const_iterator iter; for (LLScrollListItem* item : mItemList)
for(iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter;
// assumes string representation is good enough for comparison // assumes string representation is good enough for comparison
if (item->getValue().asString() == string_val) if (item->getValue().asStringRef() == string_val)
{ {
return item; return item;
} }
} }
return NULL; return NULL;
} }
void LLScrollListCtrl::reshape( S32 width, S32 height, bool called_from_parent ) void LLScrollListCtrl::reshape( S32 width, S32 height, bool called_from_parent )
{ {
LLUICtrl::reshape( width, height, called_from_parent ); LLUICtrl::reshape( width, height, called_from_parent );
@ -658,14 +639,15 @@ void LLScrollListCtrl::fitContents(S32 max_width, S32 max_height)
{ {
S32 height = llmin( getRequiredRect().getHeight(), max_height ); S32 height = llmin( getRequiredRect().getHeight(), max_height );
if (mPageLines) if (mPageLines)
{
height = llmin(mPageLines * mLineHeight + 2 * mBorderThickness + (mDisplayColumnHeaders ? mHeadingHeight : 0), height); height = llmin(mPageLines * mLineHeight + 2 * mBorderThickness + (mDisplayColumnHeaders ? mHeadingHeight : 0), height);
}
S32 width = getRect().getWidth(); S32 width = getRect().getWidth();
reshape( width, height ); reshape( width, height );
} }
LLRect LLScrollListCtrl::getRequiredRect() LLRect LLScrollListCtrl::getRequiredRect()
{ {
S32 heading_size = (mDisplayColumnHeaders ? mHeadingHeight : 0); S32 heading_size = (mDisplayColumnHeaders ? mHeadingHeight : 0);
@ -717,7 +699,8 @@ bool LLScrollListCtrl::addItem( LLScrollListItem* item, EAddPosition pos, bool r
S32 i = 0; S32 i = 0;
for (LLScrollListCell* cell = item->getColumn(i); i < num_cols; cell = item->getColumn(++i)) for (LLScrollListCell* cell = item->getColumn(i); i < num_cols; cell = item->getColumn(++i))
{ {
if (i >= (S32)mColumnsIndexed.size()) break; if (i >= (S32)mColumnsIndexed.size())
break;
cell->setWidth(mColumnsIndexed[i]->getWidth()); cell->setWidth(mColumnsIndexed[i]->getWidth());
} }
@ -740,25 +723,23 @@ S32 LLScrollListCtrl::calcMaxContentWidth()
S32 max_item_width = 0; S32 max_item_width = 0;
ordered_columns_t::iterator column_itor; for (LLScrollListColumn* column : mColumnsIndexed)
for (column_itor = mColumnsIndexed.begin(); column_itor != mColumnsIndexed.end(); ++column_itor)
{ {
LLScrollListColumn* column = *column_itor; if (!column)
if (!column) continue; continue;
if (mColumnWidthsDirty) if (mColumnWidthsDirty)
{ {
// update max content width for this column, by looking at all items // update max content width for this column, by looking at all items
column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel.getWString().c_str()) + mColumnPadding + HEADING_TEXT_PADDING : 0; column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel.getWString().c_str()) + mColumnPadding + HEADING_TEXT_PADDING : 0;
item_list::iterator iter; for (LLScrollListItem* item : mItemList)
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) {
if (LLScrollListCell* cellp = item->getColumn(column->mIndex))
{ {
LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex);
if (!cellp) continue;
column->mMaxContentWidth = llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth); column->mMaxContentWidth = llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth);
} }
} }
}
max_item_width += column->mMaxContentWidth; max_item_width += column->mMaxContentWidth;
} }
mColumnWidthsDirty = false; mColumnWidthsDirty = false;
@ -773,7 +754,8 @@ bool LLScrollListCtrl::updateColumnWidths()
for (column_itor = mColumnsIndexed.begin(); column_itor != mColumnsIndexed.end(); ++column_itor) for (column_itor = mColumnsIndexed.begin(); column_itor != mColumnsIndexed.end(); ++column_itor)
{ {
LLScrollListColumn* column = *column_itor; LLScrollListColumn* column = *column_itor;
if (!column) continue; if (!column)
continue;
// update column width // update column width
S32 new_width = 0; S32 new_width = 0;
@ -827,7 +809,6 @@ void LLScrollListCtrl::updateLineHeightInsert(LLScrollListItem* itemp)
} }
} }
void LLScrollListCtrl::updateColumns(bool force_update) void LLScrollListCtrl::updateColumns(bool force_update)
{ {
if (!mColumnsDirty && !force_update) if (!mColumnsDirty && !force_update)
@ -902,7 +883,8 @@ void LLScrollListCtrl::updateColumns(bool force_update)
S32 i = 0; S32 i = 0;
for (LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i)) for (LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i))
{ {
if (i >= (S32)mColumnsIndexed.size()) break; if (i >= (S32)mColumnsIndexed.size())
break;
cell->setWidth(mColumnsIndexed[i]->getWidth()); cell->setWidth(mColumnsIndexed[i]->getWidth());
} }
@ -929,8 +911,8 @@ void LLScrollListCtrl::setHeadingHeight(S32 heading_height)
mHeadingHeight = heading_height; mHeadingHeight = heading_height;
updateLayout(); updateLayout();
} }
void LLScrollListCtrl::setPageLines(S32 new_page_lines) void LLScrollListCtrl::setPageLines(S32 new_page_lines)
{ {
mPageLines = new_page_lines; mPageLines = new_page_lines;
@ -972,6 +954,7 @@ bool LLScrollListCtrl::selectFirstItem()
} }
first_item = false; first_item = false;
} }
if (mCommitOnSelectionChange) if (mCommitOnSelectionChange)
{ {
commitIfChanged(); commitIfChanged();
@ -999,13 +982,9 @@ bool LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index )
// make sure sort is up to date // make sure sort is up to date
updateSort(); updateSort();
S32 listlen = (S32)mItemList.size(); S32 bottom = (S32)mItemList.size() - 1;
first_index = llclamp(first_index, 0, listlen-1); first_index = llclamp(first_index, 0, bottom);
last_index = last_index < 0 ? bottom : llclamp(last_index, first_index, bottom);
if (last_index < 0)
last_index = listlen-1;
else
last_index = llclamp(last_index, first_index, listlen-1);
bool success = false; bool success = false;
S32 index = 0; S32 index = 0;
@ -1281,7 +1260,6 @@ void LLScrollListCtrl::selectPrevItem( bool extend_selection)
mSearchString.clear(); mSearchString.clear();
} }
void LLScrollListCtrl::selectNextItem( bool extend_selection) void LLScrollListCtrl::selectNextItem( bool extend_selection)
{ {
LLScrollListItem* next_item = NULL; LLScrollListItem* next_item = NULL;
@ -1325,8 +1303,6 @@ void LLScrollListCtrl::selectNextItem( bool extend_selection)
mSearchString.clear(); mSearchString.clear();
} }
void LLScrollListCtrl::deselectAllItems(bool no_commit_on_change) void LLScrollListCtrl::deselectAllItems(bool no_commit_on_change)
{ {
item_list::iterator iter; item_list::iterator iter;
@ -1406,10 +1382,8 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, boo
LLStringUtil::toLower(target_text); LLStringUtil::toLower(target_text);
} }
item_list::iterator iter; for (LLScrollListItem* item : mItemList)
for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter;
std::string item_text = item->getColumn(column)->getValue().asString(); // Only select enabled items with matching names std::string item_text = item->getColumn(column)->getValue().asString(); // Only select enabled items with matching names
if (!case_sensitive) if (!case_sensitive)
{ {
@ -1423,6 +1397,15 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, boo
return NULL; return NULL;
} }
LLScrollListItem* LLScrollListCtrl::getItemByIndex(S32 index)
{
if (index >= 0 && index < (S32)mItemList.size())
{
return mItemList[index];
}
return NULL;
}
bool LLScrollListCtrl::selectItemByPrefix(const std::string& target, bool case_sensitive, S32 column) bool LLScrollListCtrl::selectItemByPrefix(const std::string& target, bool case_sensitive, S32 column)
{ {
@ -1620,7 +1603,7 @@ bool LLScrollListCtrl::selectItemBySubstring(const LLWString& target, bool case_
} }
// </FS:Ansariel> // </FS:Ansariel>
const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const
{ {
LLScrollListItem* item; LLScrollListItem* item;
@ -1664,7 +1647,10 @@ bool LLScrollListCtrl::setSelectedByValue(const LLSD& value, bool selected)
{ {
bool found = false; bool found = false;
if (selected && !mAllowMultipleSelection) deselectAllItems(true); if (selected && !mAllowMultipleSelection)
{
deselectAllItems(true);
}
item_list::iterator iter; item_list::iterator iter;
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
@ -3036,9 +3022,7 @@ bool LLScrollListCtrl::isRepeatedChars(const LLWString& string) const
void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, S32 cell, bool select_single_item) void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, S32 cell, bool select_single_item)
{ {
if (!itemp) return; if (itemp && !itemp->getSelected())
if (!itemp->getSelected())
{ {
if (mLastSelected) if (mLastSelected)
{ {
@ -3072,9 +3056,7 @@ void LLScrollListCtrl::selectItem(LLScrollListItem* itemp, S32 cell, bool select
void LLScrollListCtrl::deselectItem(LLScrollListItem* itemp) void LLScrollListCtrl::deselectItem(LLScrollListItem* itemp)
{ {
if (!itemp) return; if (itemp && itemp->getSelected())
if (itemp->getSelected())
{ {
if (mLastSelected == itemp) if (mLastSelected == itemp)
{ {

View File

@ -278,7 +278,8 @@ public:
bool selectItemByStringMatch(const LLWString& target, bool prefix_match, bool case_sensitive = true, S32 column = -1); bool selectItemByStringMatch(const LLWString& target, bool prefix_match, bool case_sensitive = true, S32 column = -1);
// </FS:Ansariel> // </FS:Ansariel>
LLScrollListItem* getItemByLabel(const std::string& item, bool case_sensitive = true, S32 column = 0); LLScrollListItem* getItemByLabel(const std::string& item, bool case_sensitive = true, S32 column = 0);
const std::string getSelectedItemLabel(S32 column = 0) const; LLScrollListItem* getItemByIndex(S32 index);
std::string getSelectedItemLabel(S32 column = 0) const;
LLSD getSelectedValue(); LLSD getSelectedValue();
// If multi select is on, select all element that include substring, // If multi select is on, select all element that include substring,
@ -615,6 +616,8 @@ private:
sort_signal_t* mSortCallback; sort_signal_t* mSortCallback;
is_friend_signal_t* mIsFriendSignal; is_friend_signal_t* mIsFriendSignal;
friend class LLComboBox;
}; // end class LLScrollListCtrl }; // end class LLScrollListCtrl
#endif // LL_SCROLLLISTCTRL_H #endif // LL_SCROLLLISTCTRL_H

View File

@ -3791,6 +3791,10 @@ S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 t
// //
// "This is why I'm doing it this way, instead of what you would think would be more obvious..." // "This is why I'm doing it this way, instead of what you would think would be more obvious..."
// (C) Nat Goodspeed // (C) Nat Goodspeed
if (!IsWindow(sWindowHandleForMessageBox))
{
sWindowHandleForMessageBox = NULL;
}
int retval_win = MessageBoxW(sWindowHandleForMessageBox, // HWND int retval_win = MessageBoxW(sWindowHandleForMessageBox, // HWND
ll_convert_string_to_wide(text).c_str(), ll_convert_string_to_wide(text).c_str(),
ll_convert_string_to_wide(caption).c_str(), ll_convert_string_to_wide(caption).c_str(),

View File

@ -51,6 +51,7 @@
<string>RenderHeroProbeConservativeUpdateMultiplier</string> <string>RenderHeroProbeConservativeUpdateMultiplier</string>
<string>RenderLocalLightCount</string> <string>RenderLocalLightCount</string>
<string>RenderMaxPartCount</string> <string>RenderMaxPartCount</string>
<string>RenderMaxTextureResolution</string>
<string>RenderMaxVRAMBudget</string> <string>RenderMaxVRAMBudget</string>
<string>RenderMirrors</string> <string>RenderMirrors</string>
<string>RenderQualityPerformance</string> <string>RenderQualityPerformance</string>
@ -91,7 +92,8 @@
<string>RenderTerrainPBRPlanarSampleCount</string> <string>RenderTerrainPBRPlanarSampleCount</string>
<string>RenderTerrainPBRTriplanarBlendFactor</string> <string>RenderTerrainPBRTriplanarBlendFactor</string>
<string>RenderTerrainScale</string> <string>RenderTerrainScale</string>
<string>RenderMaxTextureResolution</string> <string>RenderTonemapMix</string>
<string>RenderTonemapType</string>
<string>RenderTreeLODFactor</string> <string>RenderTreeLODFactor</string>
<string>RenderTransparentWater</string> <string>RenderTransparentWater</string>
<string>RenderUnloadedAvatar</string> <string>RenderUnloadedAvatar</string>

View File

@ -13372,6 +13372,28 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key> <key>Value</key>
<real>0.4</real> <real>0.4</real>
</map> </map>
<key>RenderTonemapMix</key>
<map>
<key>Comment</key>
<string>Mix between linear and tonemapped colors (0.0(Linear) - 1.0(Tonemapped)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>RenderTonemapType</key>
<map>
<key>Comment</key>
<string>What tonemapper to use: 0 = Khronos Neutral, 1 = ACES</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>ReplaySession</key> <key>ReplaySession</key>
<map> <map>
<key>Comment</key> <key>Comment</key>

View File

@ -29,9 +29,7 @@ out vec4 frag_color;
uniform sampler2D diffuseRect; uniform sampler2D diffuseRect;
uniform float exposure;
uniform float gamma; uniform float gamma;
uniform float aces_mix;
uniform vec2 screen_res; uniform vec2 screen_res;
in vec2 vary_fragcoord; in vec2 vary_fragcoord;

View File

@ -95,9 +95,33 @@ vec3 toneMapACES_Hill(vec3 color)
return color; return color;
} }
// Khronos Neutral tonemapping
// https://github.com/KhronosGroup/ToneMapping/tree/main
// Input color is non-negative and resides in the Linear Rec. 709 color space.
// Output color is also Linear Rec. 709, but in the [0, 1] range.
vec3 PBRNeutralToneMapping( vec3 color )
{
const float startCompression = 0.8 - 0.04;
const float desaturation = 0.15;
float x = min(color.r, min(color.g, color.b));
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
color -= offset;
float peak = max(color.r, max(color.g, color.b));
if (peak < startCompression) return color;
const float d = 1. - startCompression;
float newPeak = 1. - d * d / (peak + d - startCompression);
color *= newPeak / peak;
float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
return mix(color, newPeak * vec3(1, 1, 1), g);
}
uniform float exposure; uniform float exposure;
uniform float gamma; uniform float tonemap_mix;
uniform float aces_mix; uniform int tonemap_type;
vec3 toneMap(vec3 color) vec3 toneMap(vec3 color)
{ {
@ -106,8 +130,20 @@ vec3 toneMap(vec3 color)
color *= exposure * exp_scale; color *= exposure * exp_scale;
// mix ACES and Linear here as a compromise to avoid over-darkening legacy content vec3 clamped_color = clamp(color.rgb, vec3(0.0), vec3(1.0));
color = mix(toneMapACES_Hill(color), color, aces_mix);
switch(tonemap_type)
{
case 0:
color = PBRNeutralToneMapping(color);
break;
case 1:
color = toneMapACES_Hill(color);
break;
}
// mix tonemapped and linear here to provide adjustment
color = mix(clamped_color, color, tonemap_mix);
#endif #endif
return color; return color;
@ -125,14 +161,6 @@ void debugExposure(inout vec3 color)
} }
} }
vec3 legacyGamma(vec3 color)
{
vec3 c = 1. - clamp(color, vec3(0.), vec3(1.));
c = 1. - pow(c, vec3(gamma)); // s/b inverted already CPU-side
return c;
}
void main() void main()
{ {
//this is the one of the rare spots where diffuseRect contains linear color values (not sRGB) //this is the one of the rare spots where diffuseRect contains linear color values (not sRGB)

View File

@ -62,8 +62,9 @@ void LLDrawPoolGLTFPBR::renderDeferred(S32 pass)
gDeferredPBROpaqueProgram.bind(); gDeferredPBROpaqueProgram.bind();
pushGLTFBatches(mRenderType); pushGLTFBatches(mRenderType);
gDeferredPBROpaqueProgram.bind(true);
LL::GLTFSceneManager::instance().render(true, true); LL::GLTFSceneManager::instance().render(true, true);
gDeferredPBROpaqueProgram.bind(true);
pushRiggedGLTFBatches(mRenderType + 1); pushRiggedGLTFBatches(mRenderType + 1);
} }

View File

@ -403,7 +403,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
bool got_bytes = previewp && previewp->getDataSize() > 0; bool got_bytes = previewp && previewp->getDataSize() > 0;
bool got_snap = previewp && previewp->getSnapshotUpToDate(); bool got_snap = previewp && previewp->getSnapshotUpToDate();
// *TODO: Separate maximum size for Web images from postcards
LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL;
// <FS:Ansariel> Use user-default locale from operating system // <FS:Ansariel> Use user-default locale from operating system
@ -425,7 +424,8 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
image_res_tb->setTextArg("[HEIGHT]", llformat("%d", previewp->getEncodedImageHeight())); image_res_tb->setTextArg("[HEIGHT]", llformat("%d", previewp->getEncodedImageHeight()));
} }
floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown")); LLTextBox* file_size_label = floater->getChild<LLTextBox>("file_size_label");
file_size_label->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
LLUIColor color = LLUIColorTable::instance().getColor( "LabelTextColor" ); LLUIColor color = LLUIColorTable::instance().getColor( "LabelTextColor" );
if (shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD if (shot_type == LLSnapshotModel::SNAPSHOT_POSTCARD
@ -441,7 +441,8 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
color = LLUIColor(LLColor4::red); color = LLUIColor(LLColor4::red);
} }
floater->getChild<LLUICtrl>("file_size_label")->setColor(color); file_size_label->setColor(color);
file_size_label->setReadOnlyColor(color); // field gets disabled during upload
// Update the width and height spinners based on the corresponding resolution combos. (?) // Update the width and height spinners based on the corresponding resolution combos. (?)
switch(shot_type) switch(shot_type)

View File

@ -706,7 +706,7 @@ void LLHUDEffectLookAt::render()
} }
gGL.pushMatrix(); gGL.pushMatrix();
hud_render_utf8text(name, position, *fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * fontp->getWidthF32(name), 3.0f, lookAtColor, false); hud_render_utf8text(name, position, nullptr, *fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * fontp->getWidthF32(name), 3.0f, lookAtColor, false);
gGL.popMatrix(); gGL.popMatrix();
} }

View File

@ -291,6 +291,15 @@ void LLHUDNameTag::renderText()
LLVector3 render_position = mPositionAgent LLVector3 render_position = mPositionAgent
+ (x_pixel_vec * screen_offset.mV[VX]) + (x_pixel_vec * screen_offset.mV[VX])
+ (y_pixel_vec * screen_offset.mV[VY]); + (y_pixel_vec * screen_offset.mV[VY]);
bool reset_buffers = false;
const F32 treshold = 0.000001f;
if (abs(mLastRenderPosition.mV[VX] - render_position.mV[VX]) > treshold
|| abs(mLastRenderPosition.mV[VY] - render_position.mV[VY]) > treshold
|| abs(mLastRenderPosition.mV[VZ] - render_position.mV[VZ]) > treshold)
{
reset_buffers = true;
mLastRenderPosition = render_position;
}
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
LLRect screen_rect; LLRect screen_rect;
@ -317,6 +326,11 @@ void LLHUDNameTag::renderText()
for(std::vector<LLHUDTextSegment>::iterator segment_iter = mLabelSegments.begin(); for(std::vector<LLHUDTextSegment>::iterator segment_iter = mLabelSegments.begin();
segment_iter != mLabelSegments.end(); ++segment_iter ) segment_iter != mLabelSegments.end(); ++segment_iter )
{ {
if (reset_buffers)
{
segment_iter->mFontBufferLabel.reset();
}
// Label segments use default font // Label segments use default font
const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp; const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp;
y_offset -= fontp->getLineHeight(); y_offset -= fontp->getLineHeight();
@ -332,7 +346,7 @@ void LLHUDNameTag::renderText()
} }
LLColor4 label_color(0.f, 0.f, 0.f, alpha_factor); LLColor4 label_color(0.f, 0.f, 0.f, alpha_factor);
hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false); hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferLabel, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false);
} }
} }
@ -354,6 +368,11 @@ void LLHUDNameTag::renderText()
for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment; for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment;
segment_iter != mTextSegments.end(); ++segment_iter ) segment_iter != mTextSegments.end(); ++segment_iter )
{ {
if (reset_buffers)
{
segment_iter->mFontBufferText.reset();
}
const LLFontGL* fontp = segment_iter->mFont; const LLFontGL* fontp = segment_iter->mFont;
y_offset -= fontp->getLineHeight(); y_offset -= fontp->getLineHeight();
y_offset -= LINE_PADDING; y_offset -= LINE_PADDING;
@ -377,7 +396,7 @@ void LLHUDNameTag::renderText()
text_color = segment_iter->mColor; text_color = segment_iter->mColor;
text_color.mV[VALPHA] *= alpha_factor; text_color.mV[VALPHA] *= alpha_factor;
hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, false); hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferText, *fontp, style, shadow, x_offset, y_offset, text_color, false);
} }
} }
/// Reset the default color to white. The renderer expects this to be the default. /// Reset the default color to white. The renderer expects this to be the default.

View File

@ -37,6 +37,7 @@
#include "llrect.h" #include "llrect.h"
//#include "llframetimer.h" //#include "llframetimer.h"
#include "llfontgl.h" #include "llfontgl.h"
#include "llfontvertexbuffer.h"
#include <set> #include <set>
#include <vector> #include <vector>
@ -67,6 +68,8 @@ protected:
LLColor4 mColor; LLColor4 mColor;
LLFontGL::StyleFlags mStyle; LLFontGL::StyleFlags mStyle;
const LLFontGL* mFont; const LLFontGL* mFont;
LLFontVertexBuffer mFontBufferLabel;
LLFontVertexBuffer mFontBufferText;
private: private:
LLWString mText; LLWString mText;
std::map<const LLFontGL*, F32> mFontWidthMap; std::map<const LLFontGL*, F32> mFontWidthMap;
@ -174,6 +177,7 @@ private:
S32 mMaxLines; S32 mMaxLines;
S32 mOffsetY; S32 mOffsetY;
F32 mRadius; F32 mRadius;
LLVector3 mLastRenderPosition;
std::vector<LLHUDTextSegment> mTextSegments; std::vector<LLHUDTextSegment> mTextSegments;
std::vector<LLHUDTextSegment> mLabelSegments; std::vector<LLHUDTextSegment> mLabelSegments;
// LLFrameTimer mResizeTimer; // LLFrameTimer mResizeTimer;

View File

@ -39,6 +39,7 @@
#include "llui.h" #include "llui.h"
void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent,
LLFontVertexBuffer *font_buffer,
const LLFontGL &font, const LLFontGL &font,
const U8 style, const U8 style,
const LLFontGL::ShadowType shadow, const LLFontGL::ShadowType shadow,
@ -47,10 +48,11 @@ void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent,
const bool orthographic) const bool orthographic)
{ {
LLWString wstr(utf8str_to_wstring(str)); LLWString wstr(utf8str_to_wstring(str));
hud_render_text(wstr, pos_agent, font, style, shadow, x_offset, y_offset, color, orthographic); hud_render_text(wstr, pos_agent, font_buffer, font, style, shadow, x_offset, y_offset, color, orthographic);
} }
void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
LLFontVertexBuffer *font_buffer,
const LLFontGL &font, const LLFontGL &font,
const U8 style, const U8 style,
const LLFontGL::ShadowType shadow, const LLFontGL::ShadowType shadow,
@ -138,7 +140,14 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
F32 right_x; F32 right_x;
if (font_buffer)
{
font_buffer->render(&font, wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast<S32>(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true);
}
else
{
font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast<S32>(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast<S32>(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true);
}
LLUI::popMatrix(); LLUI::popMatrix();
gGL.popMatrix(); gGL.popMatrix();

View File

@ -28,6 +28,7 @@
#define LL_LLHUDRENDER_H #define LL_LLHUDRENDER_H
#include "llfontgl.h" #include "llfontgl.h"
#include "llfontvertexbuffer.h"
class LLVector3; class LLVector3;
class LLFontGL; class LLFontGL;
@ -35,6 +36,7 @@ class LLFontGL;
// Utility classes for rendering HUD elements // Utility classes for rendering HUD elements
void hud_render_text(const LLWString &wstr, void hud_render_text(const LLWString &wstr,
const LLVector3 &pos_agent, const LLVector3 &pos_agent,
LLFontVertexBuffer *font_buffer,
const LLFontGL &font, const LLFontGL &font,
const U8 style, const U8 style,
const LLFontGL::ShadowType, const LLFontGL::ShadowType,
@ -46,6 +48,7 @@ void hud_render_text(const LLWString &wstr,
// Legacy, slower // Legacy, slower
void hud_render_utf8text(const std::string &str, void hud_render_utf8text(const std::string &str,
const LLVector3 &pos_agent, const LLVector3 &pos_agent,
LLFontVertexBuffer *font_buffer,
const LLFontGL &font, const LLFontGL &font,
const U8 style, const U8 style,
const LLFontGL::ShadowType, const LLFontGL::ShadowType,

View File

@ -241,7 +241,7 @@ void LLHUDText::renderText()
} }
text_color.mV[VALPHA] *= alpha_factor; text_color.mV[VALPHA] *= alpha_factor;
hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); hud_render_text(segment_iter->getText(), render_position, &mFontBuffer, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment);
} }
} }
/// Reset the default color to white. The renderer expects this to be the default. /// Reset the default color to white. The renderer expects this to be the default.

View File

@ -35,6 +35,7 @@
#include "v2math.h" #include "v2math.h"
#include "llrect.h" #include "llrect.h"
#include "llfontgl.h" #include "llfontgl.h"
#include "llfontvertexbuffer.h"
#include <set> #include <set>
#include <vector> #include <vector>
@ -172,6 +173,7 @@ private:
ETextAlignment mTextAlignment; ETextAlignment mTextAlignment;
EVertAlignment mVertAlignment; EVertAlignment mVertAlignment;
bool mHidden; bool mHidden;
LLFontVertexBuffer mFontBuffer;
// [RLVa:KB] - Checked: RLVa-1.0.0 // [RLVa:KB] - Checked: RLVa-1.0.0
std::string mObjText; std::string mObjText;
// [/RLVa:KB] // [/RLVa:KB]

View File

@ -205,7 +205,7 @@ LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch():
LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch() LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
{ {
gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const
@ -263,11 +263,11 @@ void LLInventoryModelBackgroundFetch::addRequestAtFront(const LLUUID & id, bool
EFetchType recursion_type = recursive ? FT_RECURSIVE : FT_DEFAULT; EFetchType recursion_type = recursive ? FT_RECURSIVE : FT_DEFAULT;
if (is_category) if (is_category)
{ {
mFetchFolderQueue.push_front(FetchQueueInfo(id, recursion_type, is_category)); mFetchFolderQueue.emplace_front(id, recursion_type, is_category);
} }
else else
{ {
mFetchItemQueue.push_front(FetchQueueInfo(id, recursion_type, is_category)); mFetchItemQueue.emplace_front(id, recursion_type, is_category);
} }
} }
@ -276,11 +276,11 @@ void LLInventoryModelBackgroundFetch::addRequestAtBack(const LLUUID & id, bool r
EFetchType recursion_type = recursive ? FT_RECURSIVE : FT_DEFAULT; EFetchType recursion_type = recursive ? FT_RECURSIVE : FT_DEFAULT;
if (is_category) if (is_category)
{ {
mFetchFolderQueue.push_back(FetchQueueInfo(id, recursion_type, is_category)); mFetchFolderQueue.emplace_back(id, recursion_type, is_category);
} }
else else
{ {
mFetchItemQueue.push_back(FetchQueueInfo(id, recursion_type, is_category)); mFetchItemQueue.emplace_back(id, recursion_type, is_category);
} }
} }
@ -306,19 +306,19 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
// Not only root folder can be massive, but // Not only root folder can be massive, but
// most system folders will be requested independently // most system folders will be requested independently
// so request root folder and content separately // so request root folder and content separately
mFetchFolderQueue.push_front(FetchQueueInfo(gInventory.getRootFolderID(), FT_FOLDER_AND_CONTENT)); mFetchFolderQueue.emplace_front(gInventory.getRootFolderID(), FT_FOLDER_AND_CONTENT);
} }
else else
{ {
mFetchFolderQueue.push_back(FetchQueueInfo(gInventory.getRootFolderID(), recursion_type)); mFetchFolderQueue.emplace_back(gInventory.getRootFolderID(), recursion_type);
} }
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
if (!mRecursiveLibraryFetchStarted) if (!mRecursiveLibraryFetchStarted)
{ {
mRecursiveLibraryFetchStarted |= recursive; mRecursiveLibraryFetchStarted |= recursive;
mFetchFolderQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursion_type)); mFetchFolderQueue.emplace_back(gInventory.getLibraryRootFolderID(), recursion_type);
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
} }
else if (recursive && cat && cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS) else if (recursive && cat && cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS)
@ -328,13 +328,13 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
if (recursive && AISAPI::isAvailable()) if (recursive && AISAPI::isAvailable())
{ {
// Request marketplace folder and content separately // Request marketplace folder and content separately
mFetchFolderQueue.push_front(FetchQueueInfo(id, FT_FOLDER_AND_CONTENT)); mFetchFolderQueue.emplace_front(id, FT_FOLDER_AND_CONTENT);
} }
else else
{ {
mFetchFolderQueue.push_front(FetchQueueInfo(id, recursion_type)); mFetchFolderQueue.emplace_front(id, recursion_type);
} }
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
mRecursiveMarketplaceFetchStarted = true; mRecursiveMarketplaceFetchStarted = true;
} }
} }
@ -346,15 +346,15 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
{ {
// On AIS make sure root goes to the top and follow up recursive // On AIS make sure root goes to the top and follow up recursive
// fetches, not individual requests // fetches, not individual requests
mFetchFolderQueue.push_back(FetchQueueInfo(id, recursion_type)); mFetchFolderQueue.emplace_back(id, recursion_type);
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
} }
else if (mFetchFolderQueue.empty() || mFetchFolderQueue.front().mUUID != id) else if (mFetchFolderQueue.empty() || mFetchFolderQueue.front().mUUID != id)
{ {
// Specific folder requests go to front of queue. // Specific folder requests go to front of queue.
mFetchFolderQueue.push_front(FetchQueueInfo(id, recursion_type)); mFetchFolderQueue.emplace_front(id, recursion_type);
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
if (id == gInventory.getLibraryRootFolderID()) if (id == gInventory.getLibraryRootFolderID())
@ -388,18 +388,18 @@ void LLInventoryModelBackgroundFetch::scheduleFolderFetch(const LLUUID& cat_id,
// check if already requested // check if already requested
if (mForceFetchSet.find(cat_id) == mForceFetchSet.end()) if (mForceFetchSet.find(cat_id) == mForceFetchSet.end())
{ {
mForceFetchSet.insert(cat_id); mForceFetchSet.emplace(cat_id);
mFetchFolderQueue.emplace_front(FetchQueueInfo(cat_id, FT_FORCED)); mFetchFolderQueue.emplace_front(cat_id, FT_FORCED);
} }
} }
else else
{ {
// Specific folder requests go to front of queue. // Specific folder requests go to front of queue.
// version presence acts as dupplicate prevention for normal fetches // version presence acts as duplicate prevention for normal fetches
mFetchFolderQueue.emplace_front(FetchQueueInfo(cat_id, FT_DEFAULT)); mFetchFolderQueue.emplace_front(cat_id, FT_DEFAULT);
} }
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
} }
@ -413,17 +413,17 @@ void LLInventoryModelBackgroundFetch::scheduleItemFetch(const LLUUID& item_id, b
// check if already requested // check if already requested
if (mForceFetchSet.find(item_id) == mForceFetchSet.end()) if (mForceFetchSet.find(item_id) == mForceFetchSet.end())
{ {
mForceFetchSet.insert(item_id); mForceFetchSet.emplace(item_id);
mFetchItemQueue.emplace_front(FetchQueueInfo(item_id, FT_FORCED, false)); mFetchItemQueue.emplace_front(item_id, FT_FORCED, false);
} }
} }
else else
{ {
// 'isFinished' being set acts as dupplicate prevention for normal fetches // 'isFinished' being set acts as duplicate prevention for normal fetches
mFetchItemQueue.emplace_front(FetchQueueInfo(item_id, FT_DEFAULT, false)); mFetchItemQueue.emplace_front(item_id, FT_DEFAULT, false);
} }
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
} }
@ -436,7 +436,7 @@ void LLInventoryModelBackgroundFetch::fetchFolderAndLinks(const LLUUID& cat_id,
cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE);
} }
incrFetchFolderCount(1); incrFetchFolderCount(1);
mExpectedFolderIds.push_back(cat_id); mExpectedFolderIds.emplace_back(cat_id);
// Assume that we have no relevant cache. Fetch folder, and items folder's links point to. // Assume that we have no relevant cache. Fetch folder, and items folder's links point to.
AISAPI::FetchCategoryLinks(cat_id, AISAPI::FetchCategoryLinks(cat_id,
@ -453,7 +453,7 @@ void LLInventoryModelBackgroundFetch::fetchFolderAndLinks(const LLUUID& cat_id,
// start idle loop to track completion // start idle loop to track completion
mBackgroundFetchActive = true; mBackgroundFetchActive = true;
mFolderFetchActive = true; mFolderFetchActive = true;
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
void LLInventoryModelBackgroundFetch::fetchCOF(nullary_func_t callback) void LLInventoryModelBackgroundFetch::fetchCOF(nullary_func_t callback)
@ -466,7 +466,7 @@ void LLInventoryModelBackgroundFetch::fetchCOF(nullary_func_t callback)
cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE);
} }
incrFetchFolderCount(1); incrFetchFolderCount(1);
mExpectedFolderIds.push_back(cat_id); mExpectedFolderIds.emplace_back(cat_id);
// For reliability assume that we have no relevant cache, so // For reliability assume that we have no relevant cache, so
// fetch cof along with items cof's links point to. // fetch cof along with items cof's links point to.
AISAPI::FetchCOF([callback](const LLUUID& id) AISAPI::FetchCOF([callback](const LLUUID& id)
@ -479,15 +479,15 @@ void LLInventoryModelBackgroundFetch::fetchCOF(nullary_func_t callback)
// start idle loop to track completion // start idle loop to track completion
mBackgroundFetchActive = true; mBackgroundFetchActive = true;
mFolderFetchActive = true; mFolderFetchActive = true;
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
void LLInventoryModelBackgroundFetch::findLostItems() void LLInventoryModelBackgroundFetch::findLostItems()
{ {
mBackgroundFetchActive = true; mBackgroundFetchActive = true;
mFolderFetchActive = true; mFolderFetchActive = true;
mFetchFolderQueue.push_back(FetchQueueInfo(LLUUID::null, FT_RECURSIVE)); mFetchFolderQueue.emplace_back(LLUUID::null, FT_RECURSIVE);
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
void LLInventoryModelBackgroundFetch::setAllFoldersFetched() void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
@ -731,7 +731,7 @@ void LLInventoryModelBackgroundFetch::onAISContentCalback(
const LLUUID& response_id, const LLUUID& response_id,
EFetchType fetch_type) EFetchType fetch_type)
{ {
// Don't push_front on failure - there is a chance it was fired from inside bulkFetchViaAis // Don't emplace_front on failure - there is a chance it was fired from inside bulkFetchViaAis
incrFetchFolderCount(-1); incrFetchFolderCount(-1);
uuid_vec_t::const_iterator folder_iter = content_ids.begin(); uuid_vec_t::const_iterator folder_iter = content_ids.begin();
@ -752,7 +752,7 @@ void LLInventoryModelBackgroundFetch::onAISContentCalback(
if (response_id.isNull()) if (response_id.isNull())
{ {
// Failed to fetch, get it individually // Failed to fetch, get it individually
mFetchFolderQueue.push_back(FetchQueueInfo(*folder_iter, FT_RECURSIVE)); mFetchFolderQueue.emplace_back(*folder_iter, FT_RECURSIVE);
} }
else else
{ {
@ -766,7 +766,7 @@ void LLInventoryModelBackgroundFetch::onAISContentCalback(
it != categories->end(); it != categories->end();
++it) ++it)
{ {
mFetchFolderQueue.push_back(FetchQueueInfo((*it)->getUUID(), FT_RECURSIVE)); mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE);
} }
} }
} }
@ -778,12 +778,12 @@ void LLInventoryModelBackgroundFetch::onAISContentCalback(
{ {
mBackgroundFetchActive = true; mBackgroundFetchActive = true;
mFolderFetchActive = true; mFolderFetchActive = true;
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
} }
void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID& request_id, const LLUUID& response_id, EFetchType fetch_type) void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID& request_id, const LLUUID& response_id, EFetchType fetch_type)
{ {
// Don't push_front on failure - there is a chance it was fired from inside bulkFetchViaAis // Don't emplace_front on failure - there is a chance it was fired from inside bulkFetchViaAis
incrFetchFolderCount(-1); incrFetchFolderCount(-1);
std::list<LLUUID>::const_iterator found = std::find(mExpectedFolderIds.begin(), mExpectedFolderIds.end(), request_id); std::list<LLUUID>::const_iterator found = std::find(mExpectedFolderIds.begin(), mExpectedFolderIds.end(), request_id);
if (found != mExpectedFolderIds.end()) if (found != mExpectedFolderIds.end())
@ -799,7 +799,7 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i
if (request_id.isNull()) if (request_id.isNull())
{ {
// orhans, no other actions needed // orphans, no other actions needed
return; return;
} }
@ -812,12 +812,12 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i
{ {
// A full recursive request failed. // A full recursive request failed.
// Try requesting folder and nested content separately // Try requesting folder and nested content separately
mFetchFolderQueue.push_back(FetchQueueInfo(request_id, FT_FOLDER_AND_CONTENT)); mFetchFolderQueue.emplace_back(request_id, FT_FOLDER_AND_CONTENT);
} }
else if (fetch_type == FT_FOLDER_AND_CONTENT) else if (fetch_type == FT_FOLDER_AND_CONTENT)
{ {
LL_WARNS() << "Failed to download folder: " << request_id << " Requesting known content separately" << LL_ENDL; LL_WARNS() << "Failed to download folder: " << request_id << " Requesting known content separately" << LL_ENDL;
mFetchFolderQueue.push_back(FetchQueueInfo(request_id, FT_CONTENT_RECURSIVE)); mFetchFolderQueue.emplace_back(request_id, FT_CONTENT_RECURSIVE);
// set folder's version to prevent viewer from trying to request folder indefinetely // set folder's version to prevent viewer from trying to request folder indefinetely
LLViewerInventoryCategory* cat(gInventory.getCategory(request_id)); LLViewerInventoryCategory* cat(gInventory.getCategory(request_id));
@ -835,15 +835,15 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i
{ {
// Got the folder and content, now verify content // Got the folder and content, now verify content
// Request content even for FT_RECURSIVE in case of changes, failures // Request content even for FT_RECURSIVE in case of changes, failures
// or if depth limit gets imlemented. // or if depth limit gets implemented.
// This shouldn't redownload folders if they already have version // This shouldn't redownload folders if they already have version
request_descendants = true; request_descendants = true;
LL_DEBUGS(LOG_INV, "AIS3") << "Got folder " << request_id << ". Requesting content" << LL_ENDL; LL_DEBUGS(LOG_INV, "AIS3") << "Got folder " << request_id << ". Requesting content" << LL_ENDL;
} }
else if (fetch_type == FT_FOLDER_AND_CONTENT) else if (fetch_type == FT_FOLDER_AND_CONTENT)
{ {
// readd folder for content request // read folder for content request
mFetchFolderQueue.push_front(FetchQueueInfo(request_id, FT_CONTENT_RECURSIVE)); mFetchFolderQueue.emplace_front(request_id, FT_CONTENT_RECURSIVE);
} }
else else
{ {
@ -863,7 +863,7 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i
it != categories->end(); it != categories->end();
++it) ++it)
{ {
mFetchFolderQueue.push_back(FetchQueueInfo((*it)->getUUID(), FT_RECURSIVE)); mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE);
} }
} }
} }
@ -872,7 +872,7 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i
{ {
mBackgroundFetchActive = true; mBackgroundFetchActive = true;
mFolderFetchActive = true; mFolderFetchActive = true;
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, nullptr);
} }
// done // done
@ -922,7 +922,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis()
// Ideally we shouldn't fetch items if recursive fetch isn't done, // Ideally we shouldn't fetch items if recursive fetch isn't done,
// but there is a chance some request will start timeouting and recursive // but there is a chance some request will start timeouting and recursive
// fetch will get stuck on a signle folder, don't block item fetch in such case // fetch will get stuck on a single folder, don't block item fetch in such case
while (!mFetchItemQueue.empty() && (U32)mFetchCount < max_concurrent_fetches && curent_time < end_time) while (!mFetchItemQueue.empty() && (U32)mFetchCount < max_concurrent_fetches && curent_time < end_time)
{ {
const FetchQueueInfo& fetch_info(mFetchItemQueue.front()); const FetchQueueInfo& fetch_info(mFetchItemQueue.front());
@ -980,7 +980,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis()
const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
if (marketplacelistings_id.notNull()) if (marketplacelistings_id.notNull())
{ {
mFetchFolderQueue.push_front(FetchQueueInfo(marketplacelistings_id, FT_FOLDER_AND_CONTENT)); mFetchFolderQueue.emplace_front(marketplacelistings_id, FT_FOLDER_AND_CONTENT);
} }
else else
{ {
@ -1004,7 +1004,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
if (cat_id.isNull()) if (cat_id.isNull())
{ {
incrFetchFolderCount(1); incrFetchFolderCount(1);
mExpectedFolderIds.push_back(cat_id); mExpectedFolderIds.emplace_back(cat_id);
// Lost and found // Lost and found
// Should it actually be recursive? // Should it actually be recursive?
AISAPI::FetchOrphans([](const LLUUID& response_id) AISAPI::FetchOrphans([](const LLUUID& response_id)
@ -1051,8 +1051,8 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
continue; continue;
} }
children.push_back(child_cat->getUUID()); children.emplace_back(child_cat->getUUID());
mExpectedFolderIds.push_back(child_cat->getUUID()); mExpectedFolderIds.emplace_back(child_cat->getUUID());
child_cat->setFetching(target_state); child_cat->setFetching(target_state);
if (children.size() >= batch_limit) if (children.size() >= batch_limit)
@ -1086,7 +1086,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
if (content_done) if (content_done)
{ {
// This will have a bit of overlap with onAISContentCalback, // This will have a bit of overlap with onAISContentCalback,
// but something else might have dowloaded folders, so verify // but something else might have downloaded folders, so verify
// every child that is complete has it's children done as well // every child that is complete has it's children done as well
for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); for (LLInventoryModel::cat_array_t::iterator it = categories->begin();
it != categories->end(); it != categories->end();
@ -1095,14 +1095,14 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
LLViewerInventoryCategory* child_cat = (*it); LLViewerInventoryCategory* child_cat = (*it);
if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion()) if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion())
{ {
mFetchFolderQueue.push_back(FetchQueueInfo(child_cat->getUUID(), FT_RECURSIVE)); mFetchFolderQueue.emplace_back(child_cat->getUUID(), FT_RECURSIVE);
} }
} }
} }
else else
{ {
// send it back to get the rest // send it back to get the rest
mFetchFolderQueue.push_back(FetchQueueInfo(cat_id, FT_CONTENT_RECURSIVE)); mFetchFolderQueue.emplace_back(cat_id, FT_CONTENT_RECURSIVE);
} }
} }
else if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion() else if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()
@ -1119,7 +1119,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
// increment before call in case of immediate callback // increment before call in case of immediate callback
incrFetchFolderCount(1); incrFetchFolderCount(1);
cat->setFetching(target_state); cat->setFetching(target_state);
mExpectedFolderIds.push_back(cat_id); mExpectedFolderIds.emplace_back(cat_id);
EFetchType type = fetch_info.mFetchType; EFetchType type = fetch_info.mFetchType;
LLUUID cat_cb_id = cat_id; LLUUID cat_cb_id = cat_id;
@ -1150,8 +1150,8 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
it != categories->end(); it != categories->end();
++it) ++it)
{ {
// not push_front to not cause an infinite loop // not emplace_front to not cause an infinite loop
mFetchFolderQueue.push_back(FetchQueueInfo((*it)->getUUID(), FT_RECURSIVE)); mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE);
} }
} }
} }
@ -1218,7 +1218,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
// Just processed a bunch of items. // Just processed a bunch of items.
// Note: do we really need notifyObservers() here? // Note: do we really need notifyObservers() here?
// OnIdle it will be called anyway due to Add flag for processed item. // OnIdle it will be called anyway due to Add flag for processed item.
// It seems like in some cases we are updaiting on fail (no flag), // It seems like in some cases we are updating on fail (no flag),
// but is there anything to update? // but is there anything to update?
// <FS:Ansariel> FIRE-21376: Inventory not loading properly on OpenSim // <FS:Ansariel> FIRE-21376: Inventory not loading properly on OpenSim
//gInventory.notifyObservers(); //gInventory.notifyObservers();
@ -1242,7 +1242,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
// *TODO: Think I'd like to get a shared pointer to this and share it // *TODO: Think I'd like to get a shared pointer to this and share it
// among all the folder requests. // among all the folder requests.
uuid_vec_t recursive_cats; uuid_vec_t recursive_cats;
uuid_vec_t all_cats; // dupplicate avoidance uuid_vec_t all_cats; // duplicate avoidance
LLSD folder_request_body; LLSD folder_request_body;
LLSD folder_request_body_lib; LLSD folder_request_body_lib;
@ -1313,7 +1313,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
it != categories->end(); it != categories->end();
++it) ++it)
{ {
mFetchFolderQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mFetchType)); mFetchFolderQueue.emplace_back((*it)->getUUID(), fetch_info.mFetchType);
} }
} }
} }
@ -1321,9 +1321,9 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
} }
if (fetch_info.mFetchType >= FT_CONTENT_RECURSIVE) if (fetch_info.mFetchType >= FT_CONTENT_RECURSIVE)
{ {
recursive_cats.push_back(cat_id); recursive_cats.emplace_back(cat_id);
} }
all_cats.push_back(cat_id); all_cats.emplace_back(cat_id);
} }
mFetchFolderQueue.pop_front(); mFetchFolderQueue.pop_front();
@ -1566,7 +1566,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res
LLInventoryModel::update_list_t update; LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1); LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1);
update.push_back(new_folder); update.emplace_back(new_folder);
gInventory.accountForUpdate(update); gInventory.accountForUpdate(update);
titem->setParent(lost_uuid); titem->setParent(lost_uuid);
@ -1702,7 +1702,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http
LLUUID folder_id = iter->get("folder_id").asUUID(); LLUUID folder_id = iter->get("folder_id").asUUID();
if (std::find(mRecursiveCatUUIDs.begin(), mRecursiveCatUUIDs.end(), folder_id) != mRecursiveCatUUIDs.end()) if (std::find(mRecursiveCatUUIDs.begin(), mRecursiveCatUUIDs.end(), folder_id) != mRecursiveCatUUIDs.end())
{ {
recursive_cats.push_back(folder_id); recursive_cats.emplace_back(folder_id);
} }
if (folders.size() == (size / 2)) if (folders.size() == (size / 2))
{ {
@ -1733,7 +1733,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http
// request which tested on HTTP_INTERNAL_ERROR status. This // request which tested on HTTP_INTERNAL_ERROR status. This
// retry logic was unbounded and lacked discrimination as to the // retry logic was unbounded and lacked discrimination as to the
// cause of the retry. The new http library should be doing // cause of the retry. The new http library should be doing
// adquately on retries but I want to keep the structure of a // adequately on retries but I want to keep the structure of a
// retry for reference. // retry for reference.
LLInventoryModelBackgroundFetch* fetcher = LLInventoryModelBackgroundFetch::getInstance(); LLInventoryModelBackgroundFetch* fetcher = LLInventoryModelBackgroundFetch::getInstance();
if (false) if (false)

View File

@ -54,7 +54,7 @@ public:
void scheduleItemFetch(const LLUUID& item_id, bool forced = false); void scheduleItemFetch(const LLUUID& item_id, bool forced = false);
typedef boost::function<void()> nullary_func_t; typedef boost::function<void()> nullary_func_t;
// AIS3 only, Fetches folder and everithing links inside the folder point to // AIS3 only, Fetches folder and everything links inside the folder point to
// Intended for outfits // Intended for outfits
void fetchFolderAndLinks(const LLUUID& cat_id, nullary_func_t callback); void fetchFolderAndLinks(const LLUUID& cat_id, nullary_func_t callback);
// AIS3 only // AIS3 only

View File

@ -575,9 +575,9 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons
LLColor4 shadow_color = LLColor4::black; LLColor4 shadow_color = LLColor4::black;
shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f; shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f;
gViewerWindow->setup3DViewport(1, -1); gViewerWindow->setup3DViewport(1, -1);
hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); hud_render_utf8text(text, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
gViewerWindow->setup3DViewport(); gViewerWindow->setup3DViewport();
hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); hud_render_utf8text(text, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
gGL.popMatrix(); gGL.popMatrix();
} }
@ -639,12 +639,12 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
{ {
fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str()); fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str());
hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); hud_render_utf8text(val_string, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, 1.f, 3.f, color, hud_selection); hud_render_utf8text(fraction_string, render_pos, nullptr, *small_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, 1.f, 3.f, color, hud_selection);
} }
else else
{ {
hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); hud_render_utf8text(val_string, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection);
} }
} }
gGL.popMatrix(); gGL.popMatrix();

View File

@ -1169,10 +1169,10 @@ void LLManipRotate::renderSnapGuides()
std::string help_text = LLTrans::getString("manip_hint1"); std::string help_text = LLTrans::getString("manip_hint1");
LLColor4 help_text_color = LLColor4::white; LLColor4 help_text_color = LLColor4::white;
help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f); help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
help_text = LLTrans::getString("manip_hint2"); help_text = LLTrans::getString("manip_hint2");
help_text_pos -= offset_dir * mRadiusMeters * 0.4f; help_text_pos -= offset_dir * mRadiusMeters * 0.4f;
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
} }
} }
} }

View File

@ -1905,10 +1905,10 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
std::string help_text = LLTrans::getString("manip_hint1"); std::string help_text = LLTrans::getString("manip_hint1");
LLColor4 help_text_color = LLColor4::white; LLColor4 help_text_color = LLColor4::white;
help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f); help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f);
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
help_text = LLTrans::getString("manip_hint2"); help_text = LLTrans::getString("manip_hint2");
help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f; help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f;
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
} }
} }
} }

View File

@ -1477,10 +1477,10 @@ void LLManipTranslate::renderSnapGuides()
std::string help_text = LLTrans::getString("manip_hint1"); std::string help_text = LLTrans::getString("manip_hint1");
LLColor4 help_text_color = LLColor4::white; LLColor4 help_text_color = LLColor4::white;
help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f); help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
help_text = LLTrans::getString("manip_hint2"); help_text = LLTrans::getString("manip_hint2");
help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapOffsetMeters * 0.2f; help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapOffsetMeters * 0.2f;
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
} }
} }
} }

View File

@ -52,6 +52,8 @@ LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
, mInboxButton(NULL) , mInboxButton(NULL)
, mInventoryPanel(NULL) , mInventoryPanel(NULL)
, mSavedFolderState(NULL) , mSavedFolderState(NULL)
, mLastItemCount(-1)
, mLastFreshItemCount(-1)
{ {
mSavedFolderState = new LLSaveFolderState(); mSavedFolderState = new LLSaveFolderState();
mSavedFolderState->setApply(false); mSavedFolderState->setApply(false);
@ -262,22 +264,17 @@ void LLPanelMarketplaceInbox::draw()
llassert(mFreshCountCtrl != NULL); llassert(mFreshCountCtrl != NULL);
if (mLastItemCount != item_count)
{
mLastItemCount = item_count;
if (item_count > 0) if (item_count > 0)
{ {
std::string item_count_str = llformat("%d", item_count); std::string item_count_str = llformat("%d", item_count);
LLStringUtil::format_map_t args; LLStringUtil::format_map_t args;
args["[NUM]"] = item_count_str; args["[NUM]"] = item_count_str;
// setLabel is expensive, causes buffer regeneration
mInboxButton->setLabel(getString("InboxLabelWithArg", args)); mInboxButton->setLabel(getString("InboxLabelWithArg", args));
// set green text to fresh item count
U32 fresh_item_count = getFreshItemCount();
mFreshCountCtrl->setVisible((fresh_item_count > 0));
if (fresh_item_count > 0)
{
mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count));
}
} }
else else
{ {
@ -285,6 +282,23 @@ void LLPanelMarketplaceInbox::draw()
mFreshCountCtrl->setVisible(false); mFreshCountCtrl->setVisible(false);
} }
}
if (item_count > 0)
{
// set green text to fresh item count
U32 fresh_item_count = getFreshItemCount();
if (mLastFreshItemCount != fresh_item_count)
{
mLastFreshItemCount = fresh_item_count;
mFreshCountCtrl->setVisible((fresh_item_count > 0));
if (fresh_item_count > 0)
{
mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count));
}
}
}
LLPanel::draw(); LLPanel::draw();
} }

View File

@ -78,6 +78,8 @@ private:
LLButton * mInboxButton; LLButton * mInboxButton;
LLInventoryPanel * mInventoryPanel; LLInventoryPanel * mInventoryPanel;
LLSaveFolderState* mSavedFolderState; LLSaveFolderState* mSavedFolderState;
S32 mLastItemCount;
S32 mLastFreshItemCount;
}; };

View File

@ -8288,16 +8288,7 @@ class LLAvatarResetSkeleton: public view_listener_t
{ {
bool handleEvent(const LLSD& userdata) bool handleEvent(const LLSD& userdata)
{ {
// <FS:Ansariel> Fix reset skeleton not working if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()))
//LLVOAvatar* avatar = NULL;
//LLViewerObject *obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
//if (obj)
//{
// avatar = obj->getAvatar();
//}
LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
// </FS:Ansariel>
if(avatar)
{ {
avatar->resetSkeleton(false); avatar->resetSkeleton(false);
} }
@ -8309,8 +8300,7 @@ class LLAvatarEnableResetSkeleton: public view_listener_t
{ {
bool handleEvent(const LLSD& userdata) bool handleEvent(const LLSD& userdata)
{ {
LLViewerObject *obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()))
if (obj && obj->getAvatar())
{ {
return true; return true;
} }
@ -8318,13 +8308,11 @@ class LLAvatarEnableResetSkeleton: public view_listener_t
} }
}; };
class LLAvatarResetSkeletonAndAnimations : public view_listener_t class LLAvatarResetSkeletonAndAnimations : public view_listener_t
{ {
bool handleEvent(const LLSD& userdata) bool handleEvent(const LLSD& userdata)
{ {
LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()))
if (avatar)
{ {
avatar->resetSkeleton(true); avatar->resetSkeleton(true);
} }
@ -8332,12 +8320,27 @@ class LLAvatarResetSkeletonAndAnimations : public view_listener_t
} }
}; };
class LLAvatarResetSelfSkeleton : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()))
{
avatar->resetSkeleton(false);
}
else
{
gAgentAvatarp->resetSkeleton(false);
}
return true;
}
};
class LLAvatarResetSelfSkeletonAndAnimations : public view_listener_t class LLAvatarResetSelfSkeletonAndAnimations : public view_listener_t
{ {
bool handleEvent(const LLSD& userdata) bool handleEvent(const LLSD& userdata)
{ {
LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()))
if (avatar)
{ {
avatar->resetSkeleton(true); avatar->resetSkeleton(true);
} }
@ -8349,7 +8352,6 @@ class LLAvatarResetSelfSkeletonAndAnimations : public view_listener_t
} }
}; };
class LLAvatarAddContact : public view_listener_t class LLAvatarAddContact : public view_listener_t
{ {
bool handleEvent(const LLSD& userdata) bool handleEvent(const LLSD& userdata)
@ -12983,6 +12985,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLAvatarResetSkeleton(), "Avatar.ResetSkeleton"); view_listener_t::addMenu(new LLAvatarResetSkeleton(), "Avatar.ResetSkeleton");
view_listener_t::addMenu(new LLAvatarEnableResetSkeleton(), "Avatar.EnableResetSkeleton"); view_listener_t::addMenu(new LLAvatarEnableResetSkeleton(), "Avatar.EnableResetSkeleton");
view_listener_t::addMenu(new LLAvatarResetSkeletonAndAnimations(), "Avatar.ResetSkeletonAndAnimations"); view_listener_t::addMenu(new LLAvatarResetSkeletonAndAnimations(), "Avatar.ResetSkeletonAndAnimations");
view_listener_t::addMenu(new LLAvatarResetSelfSkeleton(), "Avatar.ResetSelfSkeleton");
view_listener_t::addMenu(new LLAvatarResetSelfSkeletonAndAnimations(), "Avatar.ResetSelfSkeletonAndAnimations"); view_listener_t::addMenu(new LLAvatarResetSelfSkeletonAndAnimations(), "Avatar.ResetSelfSkeletonAndAnimations");
enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible)); enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible));
enable.add("Avatar.IsPicksTabOpen", boost::bind(&picks_tab_visible)); enable.add("Avatar.IsPicksTabOpen", boost::bind(&picks_tab_visible));

View File

@ -133,12 +133,12 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin
if (!status) if (!status)
{ {
LL_WARNS("Snapshots") << "Failed to get image upload config" << LL_ENDL;
LLWebProfile::reportImageUploadStatus(false);
if (image->getDataSize() > MAX_WEB_DATASIZE) if (image->getDataSize() > MAX_WEB_DATASIZE)
{ {
LLNotificationsUtil::add("CannotUploadSnapshotWebTooBig"); LLNotificationsUtil::add("CannotUploadSnapshotWebTooBig");
} }
LL_WARNS("Snapshots") << "Failed to get image upload config" << LL_ENDL;
LLWebProfile::reportImageUploadStatus(false);
return; return;
} }
@ -166,6 +166,10 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin
{ {
LL_WARNS("Snapshots") << "Failed to upload image data." << LL_ENDL; LL_WARNS("Snapshots") << "Failed to upload image data." << LL_ENDL;
LLWebProfile::reportImageUploadStatus(false); LLWebProfile::reportImageUploadStatus(false);
if (image->getDataSize() > MAX_WEB_DATASIZE)
{
LLNotificationsUtil::add("CannotUploadSnapshotWebTooBig");
}
return; return;
} }
@ -193,6 +197,10 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin
{ {
LL_WARNS("Snapshots") << "Failed to upload image." << LL_ENDL; LL_WARNS("Snapshots") << "Failed to upload image." << LL_ENDL;
LLWebProfile::reportImageUploadStatus(false); LLWebProfile::reportImageUploadStatus(false);
if (image->getDataSize() > MAX_WEB_DATASIZE)
{
LLNotificationsUtil::add("CannotUploadSnapshotWebTooBig");
}
return; return;
} }
@ -201,8 +209,6 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin
LL_INFOS("Snapshots") << "Image uploaded." << LL_ENDL; LL_INFOS("Snapshots") << "Image uploaded." << LL_ENDL;
//LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << raw.asString() << "]" << LL_ENDL; //LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << raw.asString() << "]" << LL_ENDL;
LLWebProfile::reportImageUploadStatus(true); LLWebProfile::reportImageUploadStatus(true);
} }
/*static*/ /*static*/

View File

@ -7243,10 +7243,16 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst)
F32 e = llclamp(exposure(), 0.5f, 4.f); F32 e = llclamp(exposure(), 0.5f, 4.f);
static LLStaticHashedString s_exposure("exposure"); static LLStaticHashedString s_exposure("exposure");
static LLStaticHashedString aces_mix("aces_mix"); static LLStaticHashedString tonemap_mix("tonemap_mix");
static LLStaticHashedString tonemap_type("tonemap_type");
shader.uniform1f(s_exposure, e); shader.uniform1f(s_exposure, e);
shader.uniform1f(aces_mix, gEXRImage.notNull() ? 0.f : 0.3f);
static LLCachedControl<U32> tonemap_type_setting(gSavedSettings, "RenderTonemapType", 0U);
shader.uniform1i(tonemap_type, tonemap_type_setting);
static LLCachedControl<F32> tonemap_mix_setting(gSavedSettings, "RenderTonemapMix", 1.f);
shader.uniform1f(tonemap_mix, tonemap_mix_setting);
mScreenTriangleVB->setBuffer(); mScreenTriangleVB->setBuffer();
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
@ -8080,7 +8086,6 @@ void LLPipeline::renderFinalize()
renderDoF(&mPostMap, &mRT->screen); renderDoF(&mPostMap, &mRT->screen);
LLRenderTarget* finalBuffer = &mRT->screen; LLRenderTarget* finalBuffer = &mRT->screen;
static LLCachedControl<U32> aa_type(gSavedSettings, "RenderFSAAType", 2U);
if (RenderFSAAType == 1) if (RenderFSAAType == 1)
{ {
applyFXAA(&mRT->screen, &mPostMap); applyFXAA(&mRT->screen, &mPostMap);
@ -8105,7 +8110,6 @@ void LLPipeline::renderFinalize()
// </FS:Beq> // </FS:Beq>
if (RenderBufferVisualization > -1) if (RenderBufferVisualization > -1)
{ {
finalBuffer = &mPostMap;
switch (RenderBufferVisualization) switch (RenderBufferVisualization)
{ {
case 0: case 0:
@ -8116,6 +8120,7 @@ void LLPipeline::renderFinalize()
break; break;
case 4: case 4:
visualizeBuffers(&mLuminanceMap, finalBuffer, 0); visualizeBuffers(&mLuminanceMap, finalBuffer, 0);
break;
case 5: case 5:
{ {
if (RenderFSAAType > 0) if (RenderFSAAType > 0)