LibreOffice Module vcl (master) 1
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
SalLayoutGlyphsCache Class Referencefinal

A cache for SalLayoutGlyphs objects. More...

#include <glyphitemcache.hxx>

Collaboration diagram for SalLayoutGlyphsCache:
[legend]

Classes

struct  CachedGlyphsHash
 
struct  CachedGlyphsKey
 
struct  GlyphsCost
 

Public Member Functions

const SalLayoutGlyphsGetLayoutGlyphs (VclPtr< const OutputDevice > outputDevice, const OUString &text, const vcl::text::TextLayoutCache *layoutCache=nullptr)
 
const SalLayoutGlyphsGetLayoutGlyphs (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 SalLayoutGlyphsCacheself ()
 

Private Types

typedef o3tl::lru_map< CachedGlyphsKey, SalLayoutGlyphs, CachedGlyphsHash, std::equal_to< CachedGlyphsKey >, GlyphsCostGlyphsCache
 

Private Member Functions

 SalLayoutGlyphsCache (const SalLayoutGlyphsCache &)=delete
 
SalLayoutGlyphsCacheoperator= (const SalLayoutGlyphsCache &)=delete
 

Private Attributes

GlyphsCache mCachedGlyphs
 
std::optional< CachedGlyphsKeymLastTemporaryKey
 
SalLayoutGlyphs mLastTemporaryGlyphs
 
std::optional< CachedGlyphsKeymLastSubstringKey
 
bool mbCacheGlyphsWhenDoingFallbackFonts = false
 

Detailed Description

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.

Member Typedef Documentation

◆ GlyphsCache

Definition at line 104 of file glyphitemcache.hxx.

Constructor & Destructor Documentation

◆ SalLayoutGlyphsCache() [1/2]

SalLayoutGlyphsCache::SalLayoutGlyphsCache ( int  size)
inline

Definition at line 67 of file glyphitemcache.hxx.

References size.

◆ SalLayoutGlyphsCache() [2/2]

SalLayoutGlyphsCache::SalLayoutGlyphsCache ( const SalLayoutGlyphsCache )
privatedelete

Member Function Documentation

◆ clear()

void SalLayoutGlyphsCache::clear ( )

◆ GetLayoutGlyphs() [1/2]

const SalLayoutGlyphs * SalLayoutGlyphsCache::GetLayoutGlyphs ( VclPtr< const OutputDevice outputDevice,
const OUString &  text,
const vcl::text::TextLayoutCache layoutCache = nullptr 
)
inline

Definition at line 48 of file glyphitemcache.hxx.

References text().

Referenced by GetLayoutGlyphs().

◆ GetLayoutGlyphs() [2/2]

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 
)

◆ operator=()

SalLayoutGlyphsCache & SalLayoutGlyphsCache::operator= ( const SalLayoutGlyphsCache )
privatedelete

◆ self()

SalLayoutGlyphsCache * SalLayoutGlyphsCache::self ( )
static

◆ SetCacheGlyphsWhenDoingFallbackFonts()

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.

Member Data Documentation

◆ mbCacheGlyphsWhenDoingFallbackFonts

bool SalLayoutGlyphsCache::mbCacheGlyphsWhenDoingFallbackFonts = false
private

Definition at line 111 of file glyphitemcache.hxx.

Referenced by GetLayoutGlyphs(), and SetCacheGlyphsWhenDoingFallbackFonts().

◆ mCachedGlyphs

GlyphsCache SalLayoutGlyphsCache::mCachedGlyphs
private

Definition at line 105 of file glyphitemcache.hxx.

Referenced by clear(), and GetLayoutGlyphs().

◆ mLastSubstringKey

std::optional<CachedGlyphsKey> SalLayoutGlyphsCache::mLastSubstringKey
private

Definition at line 110 of file glyphitemcache.hxx.

Referenced by GetLayoutGlyphs().

◆ mLastTemporaryGlyphs

SalLayoutGlyphs SalLayoutGlyphsCache::mLastTemporaryGlyphs
private

Definition at line 108 of file glyphitemcache.hxx.

Referenced by GetLayoutGlyphs().

◆ mLastTemporaryKey

std::optional<CachedGlyphsKey> SalLayoutGlyphsCache::mLastTemporaryKey
private

Definition at line 107 of file glyphitemcache.hxx.

Referenced by GetLayoutGlyphs().


The documentation for this class was generated from the following files: