diff options
author | Kitty Barnett <develop@catznip.com> | 2019-10-28 23:40:41 +0200 |
---|---|---|
committer | Kitty Barnett <develop@catznip.com> | 2019-10-28 23:40:41 +0200 |
commit | 9cfdb278de30e4a22d5d38fd08305fd40a905d80 (patch) | |
tree | e0f69acc1f102108be1cf2a89fa84c120833a798 /indra/llrender/llfontbitmapcache.h | |
parent | 05566ce7a7e1895a5b3ab2f9df2587dac63429e1 (diff) |
Support for COLR/CPAL fonts
Diffstat (limited to 'indra/llrender/llfontbitmapcache.h')
-rw-r--r-- | indra/llrender/llfontbitmapcache.h | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index 7e0e905756..f68af0d2b6 100644 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -30,6 +30,13 @@ #include <vector> #include "lltrace.h" +enum class EFontGlyphType : U32 +{ + Grayscale = 0, + Color, + Count +}; + // Maintain a collection of bitmaps containing rendered glyphs. // Generalizes the single-bitmap logic from LLFontFreetype and LLFontGL. class LLFontBitmapCache : public LLTrace::MemTrackable<LLFontBitmapCache> @@ -39,36 +46,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 getNumBitmaps() const { return mImageRawVec.size(); } - 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 mCurrentOffsetX[static_cast<U32>(EFontGlyphType::Count)]; + S32 mCurrentOffsetY[static_cast<U32>(EFontGlyphType::Count)]; S32 mMaxCharWidth; S32 mMaxCharHeight; - S32 mCurrentOffsetX; - S32 mCurrentOffsetY; - std::vector<LLPointer<LLImageRaw> > mImageRawVec; - std::vector<LLPointer<LLImageGL> > mImageGLVec; + std::vector<LLPointer<LLImageRaw>> mImageRawVec[static_cast<U32>(EFontGlyphType::Count)]; + std::vector<LLPointer<LLImageGL>> mImageGLVec[static_cast<U32>(EFontGlyphType::Count)]; }; #endif //LL_LLFONTBITMAPCACHE_H |