PageRenderTime 46ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llrender/llfontbitmapcache.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 72 lines | 33 code | 11 blank | 28 comment | 0 complexity | 9cae316ca98260f683e5d2f47b5de4f3 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llfontbitmapcache.h
  3. * @brief Storage for previously rendered glyphs.
  4. *
  5. * $LicenseInfo:firstyear=2008&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLFONTBITMAPCACHE_H
  27. #define LL_LLFONTBITMAPCACHE_H
  28. #include <vector>
  29. // Maintain a collection of bitmaps containing rendered glyphs.
  30. // Generalizes the single-bitmap logic from LLFontFreetype and LLFontGL.
  31. class LLFontBitmapCache: public LLRefCount
  32. {
  33. public:
  34. LLFontBitmapCache();
  35. ~LLFontBitmapCache();
  36. // Need to call this once, before caching any glyphs.
  37. void init(S32 num_components,
  38. S32 max_char_width,
  39. S32 max_char_height);
  40. void reset();
  41. BOOL nextOpenPos(S32 width, S32 &posX, S32 &posY, S32 &bitmapNum);
  42. void destroyGL();
  43. LLImageRaw *getImageRaw(U32 bitmapNum = 0) const;
  44. LLImageGL *getImageGL(U32 bitmapNum = 0) const;
  45. S32 getMaxCharWidth() const { return mMaxCharWidth; }
  46. S32 getNumComponents() const { return mNumComponents; }
  47. S32 getBitmapWidth() const { return mBitmapWidth; }
  48. S32 getBitmapHeight() const { return mBitmapHeight; }
  49. private:
  50. S32 mNumComponents;
  51. S32 mBitmapWidth;
  52. S32 mBitmapHeight;
  53. S32 mBitmapNum;
  54. S32 mMaxCharWidth;
  55. S32 mMaxCharHeight;
  56. S32 mCurrentOffsetX;
  57. S32 mCurrentOffsetY;
  58. std::vector<LLPointer<LLImageRaw> > mImageRawVec;
  59. std::vector<LLPointer<LLImageGL> > mImageGLVec;
  60. };
  61. #endif //LL_LLFONTBITMAPCACHE_H