summaryrefslogtreecommitdiff
path: root/indra/llrender/llfontbitmapcache.h
diff options
context:
space:
mode:
authorVir Linden <60274682+vir-linden@users.noreply.github.com>2024-04-24 16:02:42 -0400
committerGitHub <noreply@github.com>2024-04-24 16:02:42 -0400
commita3602d660c89a10126946d9c789e454fbfbc34bd (patch)
tree1cd70015b45a432f599036f181dd93c53c59393a /indra/llrender/llfontbitmapcache.h
parent6ca4dfdb56d0107368a09af2b089c24d32e7108d (diff)
parentd98fc504a1d4bc292ba86acdda053c8b4598a193 (diff)
Merge pull request #1323 from secondlife/main
Update from main
Diffstat (limited to 'indra/llrender/llfontbitmapcache.h')
-rw-r--r--indra/llrender/llfontbitmapcache.h42
1 files changed, 25 insertions, 17 deletions
diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h
index 7de3a6b56f..c63281ab70 100644
--- a/indra/llrender/llfontbitmapcache.h
+++ b/indra/llrender/llfontbitmapcache.h
@@ -30,6 +30,14 @@
#include <vector>
#include "lltrace.h"
+enum class EFontGlyphType : U32
+{
+ Grayscale = 0,
+ Color,
+ Count,
+ Unspecified,
+};
+
// Maintain a collection of bitmaps containing rendered glyphs.
// Generalizes the single-bitmap logic from LLFontFreetype and LLFontGL.
class LLFontBitmapCache
@@ -39,35 +47,35 @@ public:
~LLFontBitmapCache();
// Need to call this once, before caching any glyphs.
- void init(S32 num_components,
- S32 max_char_width,
+ void init(S32 max_char_width,
S32 max_char_height);
void reset();
- BOOL nextOpenPos(S32 width, S32 &posX, S32 &posY, S32 &bitmapNum);
+ BOOL nextOpenPos(S32 width, S32& posX, S32& posY, EFontGlyphType bitmapType, U32& bitmapNum);
void destroyGL();
- LLImageRaw *getImageRaw(U32 bitmapNum = 0) const;
- LLImageGL *getImageGL(U32 bitmapNum = 0) const;
-
+ LLImageRaw* getImageRaw(EFontGlyphType bitmapType, U32 bitmapNum) const;
+ LLImageGL* getImageGL(EFontGlyphType bitmapType, U32 bitmapNum) const;
+
S32 getMaxCharWidth() const { return mMaxCharWidth; }
- S32 getNumComponents() const { return mNumComponents; }
+ U32 getNumBitmaps(EFontGlyphType bitmapType) const { return (bitmapType < EFontGlyphType::Count) ? mImageRawVec[static_cast<U32>(bitmapType)].size() : 0; }
S32 getBitmapWidth() const { return mBitmapWidth; }
S32 getBitmapHeight() const { return mBitmapHeight; }
+protected:
+ static U32 getNumComponents(EFontGlyphType bitmap_type);
+
private:
- S32 mNumComponents;
- S32 mBitmapWidth;
- S32 mBitmapHeight;
- S32 mBitmapNum;
- S32 mMaxCharWidth;
- S32 mMaxCharHeight;
- S32 mCurrentOffsetX;
- S32 mCurrentOffsetY;
- std::vector<LLPointer<LLImageRaw> > mImageRawVec;
- std::vector<LLPointer<LLImageGL> > mImageGLVec;
+ 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)];
};
#endif //LL_LLFONTBITMAPCACHE_H