Skip to content
Snippets Groups Projects
Commit b2f89040 authored by Andrey Kleshchev's avatar Andrey Kleshchev Committed by akleshchev
Browse files

SL-19089 Changing UI scale crashes viewer

This makes no sense, trying to add a glyph now will have no width or height set, neither character width or heigh, yet release viewer does that. Fixed code to match release and set width and height despite char width not being up to date.
parent 6f31fabb
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -92,6 +92,20 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp
{
// We're out of space in the current image, or no image
// has been allocated yet. Make a new one.
S32 image_width = mMaxCharWidth * 20;
S32 pow_iw = 2;
while (pow_iw < image_width)
{
pow_iw *= 2;
}
image_width = pow_iw;
image_width = llmin(512, image_width); // Don't make bigger than 512x512, ever.
S32 image_height = image_width;
mBitmapWidth = image_width;
mBitmapHeight = image_height;
S32 num_components = getNumComponents(bitmap_type);
mImageRawVec[bitmap_idx].push_back(new LLImageRaw(mBitmapWidth, mBitmapHeight, num_components));
bitmap_num = mImageRawVec[bitmap_idx].size() - 1;
......
......@@ -798,11 +798,11 @@ void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32
llassert(!mIsFallback);
llassert(image_raw && (image_raw->getComponents() == 2));
U8 *target = image_raw->getData();
llassert(target);
if (!data)
if (!data || !target)
{
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment