diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-04 15:54:53 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-06 18:30:15 +0200 |
commit | 2f182faaf08542e381a1aee4544b47c4cd7c0b92 (patch) | |
tree | e7212480971dcd587f650b365eb7d748df559fcf | |
parent | 16a338e173083954a9932a3a4005f172309c784e (diff) |
OSX use font cache based glyph rect cache
Change-Id: Ia9bf718f1158c68971511688fe5af3e335d841ba
Reviewed-on: https://gerrit.libreoffice.org/61386
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 2 | ||||
-rw-r--r-- | vcl/quartz/ctfonts.cxx | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 24b5268493de..0fb20bb490cc 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -85,7 +85,7 @@ public: ~CoreTextStyle() override; void GetFontMetric( ImplFontMetricDataRef const & ); - bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) const; + bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&); bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) const; CFMutableDictionaryRef GetStyleDict( void ) const { return mpStyleDict; } diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 6ceec8a0295d..65b3a85f5a43 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -137,8 +137,11 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) rxFontMetric->SetMinKashida(GetKashidaWidth()); } -bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect ) const +bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect ) { + if (GetCachedGlyphBoundRect(rGlyph.maGlyphId, rRect)) + return true; + CGGlyph nCGGlyph = rGlyph.maGlyphId; CTFontRef aCTFontRef = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); @@ -156,6 +159,7 @@ bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& long xMax = ceil(aCGRect.origin.x + aCGRect.size.width); long yMax = ceil(aCGRect.origin.y + aCGRect.size.height); rRect = tools::Rectangle(xMin, -yMax, xMax, -yMin); + CacheGlyphBoundRect(rGlyph.maGlyphId, rRect); return true; } |