diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-27 15:37:39 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-30 11:42:49 +0100 |
commit | 7b0f2ee441b0cbcb88f3020df40c49e7cd6f9fb1 (patch) | |
tree | 2382b66e9a92907934e891cded6497c8ea7186ef /vcl/unx/generic | |
parent | a4b60b78ea36d55a2abf0e5efccd8530568d2209 (diff) |
Rely on the font instance of the glyph
The FreetypeFont might already have released the font instance of
the glyph, but the glyphs font instance must still be valid, so
use this instead to cache glyph bound rect.
For whatever reason the Windows compiler doesn't accept inline
functions in the GlyphItem struct and wants to export them in
the DLL, even when declared VCL_DLLPRIVATE, so this just uses
static inlines as a workaround.
Change-Id: I4539d91a846a54a05f9648638494e1e99f704b0a
Reviewed-on: https://gerrit.libreoffice.org/62425
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 74bbd7093411..ce04e4f68b55 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -24,6 +24,7 @@ #include <vcl/svapp.hxx> #include <fontinstance.hxx> +#include <impglyphitem.hxx> #include <impfont.hxx> #include <fontattributes.hxx> @@ -590,8 +591,7 @@ void FreetypeFont::ApplyGlyphTransform(bool bVertical, FT_Glyph pGlyphFT ) const bool FreetypeFont::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect) { - assert(mpFontInstance.is()); - if (mpFontInstance.is() && mpFontInstance->GetCachedGlyphBoundRect(rGlyph.m_aGlyphId, rRect)) + if (::GetCachedGlyphBoundRect(rGlyph, rRect)) return true; FT_Activate_Size( maSizeFT ); @@ -613,13 +613,10 @@ bool FreetypeFont::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& FT_BBox aBbox; FT_Glyph_Get_CBox( pGlyphFT, FT_GLYPH_BBOX_PIXELS, &aBbox ); - - rRect = tools::Rectangle(aBbox.xMin, -aBbox.yMax, aBbox.xMax, -aBbox.yMin); - if (mpFontInstance.is()) - mpFontInstance->CacheGlyphBoundRect(rGlyph.m_aGlyphId, rRect); - FT_Done_Glyph( pGlyphFT ); + rRect = tools::Rectangle(aBbox.xMin, -aBbox.yMax, aBbox.xMax, -aBbox.yMin); + ::CacheGlyphBoundRect(rGlyph, rRect); return true; } |