BitmapGlyphLayoutTpl(BitmapGlyphLayoutTpl&& tmp) : _parent(tmp._parent) , _font(std::move(tmp._font)) , _data(std::move(tmp._data)) , _pages(std::move(tmp._pages)) { tmp._data._storage = nullptr; assert(_is_ok()); }
BitmapGlyphLayoutTpl(const BitmapGlyphLayoutTpl& other) : _parent(other._parent) , _font(other._font) , _data(other._data._capacity) , _pages(other._pages) { BitmapGlyphAllocateLayoutData(_parent, _data); assert(_is_ok()); }
BitmapGlyphLayoutTpl( BitmapGlyphRenderingBase& parent, const BitmapFont& font, SizeType max_len) : _parent(parent) , _font(font) , _data(max_len) { BitmapGlyphAllocateLayoutData(_parent, _data); assert(_is_ok()); }
void Set(const CodePoint* cps, SizeType size) { assert(_is_ok()); assert(size <= Capacity()); // update the list of referenced font pages _pages.clear(); for(GLsizei cp = 0; cp != size; ++cp) { GLuint page = BitmapGlyphPageOfCP(_parent, cps[cp]); auto i = _pages.begin(), e = _pages.end(); if(std::find(i, e, page) == e) { _pages.push_back(page); } } _font._essence->LoadPages(_pages.data(), _pages.size()); // initialize the layout data BitmapGlyphInitializeLayoutData(_parent, _data, _font, cps, size); }
// Swaps the specified page into a frame // Use only if the page is not already swapped in void SwapPageIn(GLint frame, GLint page) { assert(_is_ok()); _replace_page(frame, page); assert(_frames_consistent()); }
void Update(void) { assert(_is_ok()); for(auto i=_ages.begin(), e=_ages.end(); i!=e; ++i) *i >>= 1; }
std::size_t FrameCount(void) const { assert(_is_ok()); return _frames.size(); }