LibreOffice Module vcl (master) 1
|
A cache for SalLayoutGlyphs objects. More...
#include <glyphitemcache.hxx>
Classes | |
struct | CachedGlyphsHash |
struct | CachedGlyphsKey |
struct | GlyphsCost |
Public Member Functions | |
const SalLayoutGlyphs * | GetLayoutGlyphs (VclPtr< const OutputDevice > outputDevice, const OUString &text, const vcl::text::TextLayoutCache *layoutCache=nullptr) |
const SalLayoutGlyphs * | GetLayoutGlyphs (VclPtr< const OutputDevice > outputDevice, const OUString &text, sal_Int32 nIndex, sal_Int32 nLen, tools::Long nLogicWidth=0, const vcl::text::TextLayoutCache *layoutCache=nullptr) |
void | clear () |
void | SetCacheGlyphsWhenDoingFallbackFonts (bool bOK) |
Normally, we cannot cache glyphs when doing font fallback, because the font fallbacks can cache during the lifetime of the cache, and they are not included in the cache key. More... | |
SalLayoutGlyphsCache (int size) | |
Static Public Member Functions | |
static SalLayoutGlyphsCache * | self () |
Private Types | |
typedef o3tl::lru_map< CachedGlyphsKey, SalLayoutGlyphs, CachedGlyphsHash, std::equal_to< CachedGlyphsKey >, GlyphsCost > | GlyphsCache |
Private Member Functions | |
SalLayoutGlyphsCache (const SalLayoutGlyphsCache &)=delete | |
SalLayoutGlyphsCache & | operator= (const SalLayoutGlyphsCache &)=delete |
Private Attributes | |
GlyphsCache | mCachedGlyphs |
std::optional< CachedGlyphsKey > | mLastTemporaryKey |
SalLayoutGlyphs | mLastTemporaryGlyphs |
std::optional< CachedGlyphsKey > | mLastSubstringKey |
bool | mbCacheGlyphsWhenDoingFallbackFonts = false |
A cache for SalLayoutGlyphs objects.
Allows caching for OutputDevice::DrawText() and similar calls. Pass the text and the output device for the call to OutputDevice::ImplLayout(). Items are cached per output device and its font. If something more changes, call clear().
Definition at line 43 of file glyphitemcache.hxx.
|
private |
Definition at line 104 of file glyphitemcache.hxx.
|
inline |
Definition at line 67 of file glyphitemcache.hxx.
References size.
|
privatedelete |
void SalLayoutGlyphsCache::clear | ( | ) |
Definition at line 233 of file impglyphitem.cxx.
References o3tl::lru_map< typename Key, typename Value, class KeyHash, class KeyEqual, class ValueSize >::clear(), and mCachedGlyphs.
Referenced by SetCacheGlyphsWhenDoingFallbackFonts().
|
inline |
Definition at line 48 of file glyphitemcache.hxx.
References text().
Referenced by GetLayoutGlyphs().
const SalLayoutGlyphs * SalLayoutGlyphsCache::GetLayoutGlyphs | ( | VclPtr< const OutputDevice > | outputDevice, |
const OUString & | text, | ||
sal_Int32 | nIndex, | ||
sal_Int32 | nLen, | ||
tools::Long | nLogicWidth = 0 , |
||
const vcl::text::TextLayoutCache * | layoutCache = nullptr |
||
) |
Definition at line 326 of file impglyphitem.cxx.
References o3tl::lru_map< typename Key, typename Value, class KeyHash, class KeyEqual, class ValueSize >::begin(), vcl::text::BiDiStrong, checkGlyphsEqual(), vcl::text::TextLayoutCache::Create(), o3tl::lru_map< typename Key, typename Value, class KeyHash, class KeyEqual, class ValueSize >::end(), o3tl::lru_map< typename Key, typename Value, class KeyHash, class KeyEqual, class ValueSize >::find(), GetLayoutGlyphs(), OutputDevice::GetLayoutMode(), GlyphItemsOnly, SalLayoutGlyphs::Impl(), OutputDevice::ImplLayout(), o3tl::lru_map< typename Key, typename Value, class KeyHash, class KeyEqual, class ValueSize >::insert(), SalLayoutGlyphs::IsValid(), makeGlyphsSubset(), mbCacheGlyphsWhenDoingFallbackFonts, mCachedGlyphs, mLastSubstringKey, mLastTemporaryGlyphs, mLastTemporaryKey, nIndex, pos, and text().
|
privatedelete |
|
static |
Definition at line 235 of file impglyphitem.cxx.
References vcl::DeleteOnDeinit< T >::get(), and utl::ConfigManager::IsFuzzing().
Referenced by vcl::PDFWriterImpl::drawStretchText(), vcl::PDFWriterImpl::drawText(), vcl::PDFWriterImpl::drawTextArray(), and StatusBar::SetItemText().
void SalLayoutGlyphsCache::SetCacheGlyphsWhenDoingFallbackFonts | ( | bool | bOK | ) |
Normally, we cannot cache glyphs when doing font fallback, because the font fallbacks can cache during the lifetime of the cache, and they are not included in the cache key.
But during some processes, we can turn this on, as long as we remember to turn it off at the end.
Definition at line 471 of file impglyphitem.cxx.
References clear(), and mbCacheGlyphsWhenDoingFallbackFonts.
|
private |
Definition at line 111 of file glyphitemcache.hxx.
Referenced by GetLayoutGlyphs(), and SetCacheGlyphsWhenDoingFallbackFonts().
|
private |
Definition at line 105 of file glyphitemcache.hxx.
Referenced by clear(), and GetLayoutGlyphs().
|
private |
Definition at line 110 of file glyphitemcache.hxx.
Referenced by GetLayoutGlyphs().
|
private |
Definition at line 108 of file glyphitemcache.hxx.
Referenced by GetLayoutGlyphs().
|
private |
Definition at line 107 of file glyphitemcache.hxx.
Referenced by GetLayoutGlyphs().