diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-28 13:41:10 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-30 20:42:19 +0100 |
commit | 996d7f36ddcd6d518f4b44d132b3c5e3300f0c24 (patch) | |
tree | 5fb211f185c06dac6c2ff620b4c5982dca25dc86 /vcl/quartz | |
parent | 0ea92ad5332ddb6583c82275071c3be3939ebf28 (diff) |
Move SalGraphics glyph functions into FontInstance
As we already rely on the GlyphItem's font instance, consequently
this removes the SalGraphics GlyphItem based functions. Also
unifies the glyph bound rect cache handling.
An interesting aspect is the rotated glyph bounding box handling
moved from CairoTextRender to FreetypeFont. It doesn't look like
an implementation detail for Cairo, so it may have been a bug.
Change-Id: I81bbb5d8ee98fb77a1eee05568c456f9e4553023
Reviewed-on: https://gerrit.libreoffice.org/62503
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/quartz')
-rw-r--r-- | vcl/quartz/ctfonts.cxx | 16 | ||||
-rw-r--r-- | vcl/quartz/salgdi.cxx | 10 |
2 files changed, 5 insertions, 21 deletions
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index fee6a676ac6c..e98fac83b0f6 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -138,13 +138,9 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricDataRef const & rxFontMetric ) rxFontMetric->SetMinKashida(GetKashidaWidth()); } -bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect ) +bool CoreTextStyle::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool bVertical) const { - assert(this == rGlyph.m_pFontInstance); - if (rGlyph.GetCachedGlyphBoundRect(rRect)) - return true; - - CGGlyph nCGGlyph = rGlyph.m_aGlyphId; + CGGlyph nCGGlyph = nId; CTFontRef aCTFontRef = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.11 kCTFontDefaultOrientation @@ -153,7 +149,7 @@ bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& CGRect aCGRect = CTFontGetBoundingRectsForGlyphs(aCTFontRef, aFontOrientation, &nCGGlyph, nullptr, 1); // Apply font rotation to non-vertical glyphs. - if (mfFontRotation && !rGlyph.IsVertical()) + if (mfFontRotation && !bVertical) aCGRect = CGRectApplyAffineTransform(aCGRect, CGAffineTransformMakeRotation(mfFontRotation)); long xMin = floor(aCGRect.origin.x); @@ -161,8 +157,6 @@ 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); - - rGlyph.CacheGlyphBoundRect(rRect); return true; } @@ -218,11 +212,11 @@ static void MyCGPathApplierFunc( void* pData, const CGPathElement* pElement ) } } -bool CoreTextStyle::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rResult) const +bool CoreTextStyle::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rResult, bool) const { rResult.clear(); - CGGlyph nCGGlyph = rGlyph.m_aGlyphId; + CGGlyph nCGGlyph = nId; CTFontRef pCTFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); SAL_WNODEPRECATED_DECLARATIONS_PUSH diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 639f54a74144..d64fc8677ce7 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -370,16 +370,6 @@ bool AquaSalGraphics::AddTempDevFont( PhysicalFontCollection*, return ::AddTempDevFont(rFontFileURL); } -bool AquaSalGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rPolyPoly) -{ - return static_cast<CoreTextStyle*>(rGlyph.m_pFontInstance)->GetGlyphOutline(rGlyph, rPolyPoly); -} - -bool AquaSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect ) -{ - return static_cast<CoreTextStyle*>(rGlyph.m_pFontInstance)->GetGlyphBoundRect(rGlyph, rRect); -} - void AquaSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) { #ifdef IOS |