2222864eed
* the previous AGG implementation is superfluous * the new implementation is based on that one, but in a way that allows read/write locking to the list of cache entries (fonts) as well as read/write locking to the cached glyphs per individual font cache entry * new GlyphLayoutEngine.h, which is to be the central place for layouting glyphs along the baseline. It handles the locking for getting the font cache entries. It works by giving it a template class GlyphConsumer which does the actual work. * changed AGGTextRenderer to use the new font cache * changed ServerFont::StringWidth(), and the bounding box stuff to use it * changed DrawingEngine, it doesn't need the global font lock anymore * our BFont thought that GetBoundingBoxesAsGlyphs and GetBoundingBoxesAsString is the same, which of course it isn't, hence the two separate functions... AsGlyphs just gets the bounding box of each glyph in a string, not treating the string as an actual word AsString adds the offset of the glyph in the word to the bounding box * changed ServerProtocol.h accordingly for the different bounding box meaning git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21797 a95241bf-73f2-0310-859d-f6bbb57e9c96
41 lines
787 B
C++
41 lines
787 B
C++
/*
|
|
* Copyright 2007, Haiku. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
*/
|
|
|
|
#ifndef FONT_CACHE_H
|
|
#define FONT_CACHE_H
|
|
|
|
#include "FontCacheEntry.h"
|
|
#include "HashMap.h"
|
|
#include "HashString.h"
|
|
#include "MultiLocker.h"
|
|
#include "ServerFont.h"
|
|
|
|
|
|
class FontCache : public MultiLocker {
|
|
public:
|
|
FontCache();
|
|
virtual ~FontCache();
|
|
|
|
// global instance
|
|
static FontCache* Default();
|
|
|
|
FontCacheEntry* FontCacheEntryFor(const ServerFont& font);
|
|
void Recycle(FontCacheEntry* entry);
|
|
|
|
private:
|
|
void _ConstrainEntryCount();
|
|
|
|
static FontCache sDefaultInstance;
|
|
|
|
typedef HashMap<HashString, FontCacheEntry*> FontMap;
|
|
|
|
FontMap fFontCacheEntries;
|
|
};
|
|
|
|
#endif // FONT_CACHE_H
|