diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-03-02 08:55:04 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-03-02 08:55:04 +0800 |
commit | 64a181fdde219328560eee0ff5b87f02ba36a65f (patch) | |
tree | 285437f75513ef47639ee9f3f8d47a5dc1b0ef8c /indra/llrender/llfontbitmapcache.h | |
parent | 60592ae0d7a98e071e516fcac70c5bf1427f20be (diff) | |
parent | 1204468415dd5248bbd01d7aaede520ede3b9d36 (diff) |
Merge tag '7.1.3-release'
source for viewer 7.1.3.7878383867
Diffstat (limited to 'indra/llrender/llfontbitmapcache.h')
-rw-r--r-- | indra/llrender/llfontbitmapcache.h | 42 |
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 |