summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorKitty Barnett <develop@catznip.com>2022-08-29 00:00:31 +0200
committerKitty Barnett <develop@catznip.com>2022-08-29 00:01:43 +0200
commitbab70f6f152952ce755188d29bea1cfd8821a4be (patch)
tree164391dd9ecf0ef7df853ecb73c75db8e4a8545b /indra/llrender
parent5440464a9cbff6f64f79667ac026a7a1983b28b4 (diff)
Review + resolve minor issues
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llfontbitmapcache.cpp29
-rw-r--r--indra/llrender/llfontbitmapcache.h12
-rw-r--r--indra/llrender/llfontregistry.cpp4
3 files changed, 19 insertions, 26 deletions
diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp
index 754adb14cb..2d65ec47c6 100644
--- a/indra/llrender/llfontbitmapcache.cpp
+++ b/indra/llrender/llfontbitmapcache.cpp
@@ -31,17 +31,7 @@
LLFontBitmapCache::LLFontBitmapCache()
: LLTrace::MemTrackable<LLFontBitmapCache>("LLFontBitmapCache")
- , mBitmapWidth(0)
- , mBitmapHeight(0)
- , mMaxCharWidth(0)
- , mMaxCharHeight(0)
{
- // *TODO: simplify with initializer after VS2017
- for (U32 idx = 0, cnt = static_cast<U32>(EFontGlyphType::Count); idx < cnt; idx++)
- {
- mCurrentOffsetX[idx] = 1;
- mCurrentOffsetY[idx] = 1;
- }
}
LLFontBitmapCache::~LLFontBitmapCache()
@@ -123,6 +113,9 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp
// Attach corresponding GL texture. (*TODO: is this needed?)
gGL.getTexUnit(0)->bind(image_gl);
image_gl->setFilteringOption(LLTexUnit::TFO_POINT); // was setMipFilterNearest(TRUE, TRUE);
+
+ claimMem(image_raw);
+ claimMem(image_gl);
}
else
{
@@ -145,29 +138,29 @@ void LLFontBitmapCache::destroyGL()
{
for (U32 idx = 0, cnt = static_cast<U32>(EFontGlyphType::Count); idx < cnt; idx++)
{
- for (std::vector<LLPointer<LLImageGL> >::iterator it = mImageGLVec[idx].begin(); it != mImageGLVec[idx].end(); ++it)
+ for (LLImageGL* image_gl : mImageGLVec[idx])
{
- (*it)->destroyGLTexture();
+ image_gl->destroyGLTexture();
}
}
}
void LLFontBitmapCache::reset()
{
- for (U32 idx = 0, cnt = static_cast<U32>(EFontGlyphType::Count); idx < cnt; idx++)
+ for (U32 kitty = 0, cnt = static_cast<U32>(EFontGlyphType::Count); kitty < cnt; kitty++)
{
- for (std::vector<LLPointer<LLImageRaw> >::iterator it = mImageRawVec[idx].begin(), end_it = mImageRawVec[idx].end(); it != end_it; ++it)
+ for (LLImageRaw* image_raw : mImageRawVec[kitty])
{
- disclaimMem(**it);
+ disclaimMem(image_raw);
}
- mImageRawVec[idx].clear();
+ mImageRawVec[kitty].clear();
}
for (U32 idx = 0, cnt = static_cast<U32>(EFontGlyphType::Count); idx < cnt; idx++)
{
- for (std::vector<LLPointer<LLImageGL> >::iterator it = mImageGLVec[idx].begin(), end_it = mImageGLVec[idx].end(); it != end_it; ++it)
+ for (LLImageGL* image_gl : mImageGLVec[idx])
{
- disclaimMem(**it);
+ disclaimMem(image_gl);
}
mImageGLVec[idx].clear();
mCurrentOffsetX[idx] = 1;
diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h
index 5d0094fd69..6b339e9afd 100644
--- a/indra/llrender/llfontbitmapcache.h
+++ b/indra/llrender/llfontbitmapcache.h
@@ -68,12 +68,12 @@ protected:
static U32 getNumComponents(EFontGlyphType bitmap_type);
private:
- S32 mBitmapWidth;
- S32 mBitmapHeight;
- S32 mCurrentOffsetX[static_cast<U32>(EFontGlyphType::Count)];
- S32 mCurrentOffsetY[static_cast<U32>(EFontGlyphType::Count)];
- S32 mMaxCharWidth;
- S32 mMaxCharHeight;
+ S32 mBitmapWidth = 0;
+ S32 mBitmapHeight = 0;
+ S32 mCurrentOffsetX[static_cast<U32>(EFontGlyphType::Count)] = { 1 };
+ S32 mCurrentOffsetY[static_cast<U32>(EFontGlyphType::Count)] = { 1 };
+ S32 mMaxCharWidth = 0;
+ S32 mMaxCharHeight = 0;
std::vector<LLPointer<LLImageRaw>> mImageRawVec[static_cast<U32>(EFontGlyphType::Count)];
std::vector<LLPointer<LLImageGL>> mImageGLVec[static_cast<U32>(EFontGlyphType::Count)];
};
diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp
index f2dc5771e9..1d7d930e6f 100644
--- a/indra/llrender/llfontregistry.cpp
+++ b/indra/llrender/llfontregistry.cpp
@@ -482,6 +482,8 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc)
font_search_paths.push_back(LLFontGL::getFontPathSystem());
#if LL_DARWIN
font_search_paths.push_back(MACOSX_FONT_PATH_LIBRARY);
+ font_search_paths.push_back(MACOSX_FONT_PATH_LIBRARY + MACOSX_FONT_SUPPLEMENTAL);
+ font_search_paths.push_back(sys_path + MACOSX_FONT_SUPPLEMENTAL);
#endif
// The fontname string may contain multiple font file names separated by semicolons.
@@ -491,8 +493,6 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc)
++font_file_it)
{
LLFontGL *fontp = NULL;
- font_paths.push_back(MACOSX_FONT_PATH_LIBRARY + MACOSX_FONT_SUPPLEMENTAL + *file_name_it);
- font_paths.push_back(sys_path + MACOSX_FONT_SUPPLEMENTAL + *file_name_it);
bool is_ft_collection = (std::find_if(font_collection_files.begin(), font_collection_files.end(),
[&font_file_it](const LLFontFileInfo& ffi) { return font_file_it->FileName == ffi.FileName; }) != font_collection_files.end());