vcl/headless/svptext.cxx | 8 ++++---- vcl/inc/headless/svpgdi.hxx | 4 ++-- vcl/inc/quartz/salgdi.h | 8 ++++---- vcl/inc/salgdi.hxx | 4 ++-- vcl/inc/textrender.hxx | 4 ++-- vcl/inc/unx/cairotextrender.hxx | 4 ++-- vcl/inc/unx/genpspgraphics.h | 4 ++-- vcl/inc/unx/glyphcache.hxx | 6 +++--- vcl/inc/unx/salgdi.h | 4 ++-- vcl/inc/win/salgdi.h | 4 ++-- vcl/quartz/ctfonts.cxx | 10 +++++----- vcl/quartz/salgdi.cxx | 12 ++++++------ vcl/source/gdi/sallayout.cxx | 4 ++-- vcl/source/outdev/font.cxx | 2 +- vcl/unx/generic/gdi/cairotextrender.cxx | 14 ++++++-------- vcl/unx/generic/gdi/font.cxx | 8 ++++---- vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 20 ++++++-------------- vcl/unx/generic/glyphs/glyphcache.cxx | 8 ++++---- vcl/unx/generic/print/genpspgraphics.cxx | 14 ++++++-------- vcl/win/gdi/salfont.cxx | 12 +++++------- 20 files changed, 70 insertions(+), 84 deletions(-)
New commits: commit bebee55d197176f009668628de0d9945c26af8ad Author: Khaled Hosny <khaledho...@eglug.org> Date: Thu Dec 8 03:01:14 2016 +0200 Use GlyphItem in more places Change-Id: Ic0dd8c0311161271817eb9a3f454d00a319e43a8 Reviewed-on: https://gerrit.libreoffice.org/31814 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Khaled Hosny <khaledho...@eglug.org> diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index 63a10f5..bdb97a9 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -91,14 +91,14 @@ void SvpSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, m_aTextRenderImpl.GetGlyphWidths(pFont, bVertical, rWidths, rUnicodeEnc); } -bool SvpSalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) +bool SvpSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect) { - return m_aTextRenderImpl.GetGlyphBoundRect(aGlyphId, rRect); + return m_aTextRenderImpl.GetGlyphBoundRect(rGlyph, rRect); } -bool SvpSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolygon& rPolyPoly ) +bool SvpSalGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rPolyPoly) { - return m_aTextRenderImpl.GetGlyphOutline(aGlyphId, rPolyPoly); + return m_aTextRenderImpl.GetGlyphOutline(rGlyph, rPolyPoly); } SalLayout* SvpSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel ) diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index a8f3362..8083474 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -159,8 +159,8 @@ public: bool bVertical, std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) override; - virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) override; - virtual bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) override; + virtual bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) override; + virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; virtual void DrawTextLayout( const CommonSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 6ea5bf3..086266d 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -89,8 +89,8 @@ public: ~CoreTextStyle( void ); void GetFontMetric( ImplFontMetricDataRef& ) const; - bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const; - bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const; + bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) const; + bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) const; hb_font_t* GetHbFont() const { return mpHbFont; } void SetHbFont(hb_font_t* pHbFont) const { mpHbFont = pHbFont; } @@ -375,8 +375,8 @@ public: std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) override; - virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) override; - virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) override; + virtual bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) override; + virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; virtual void DrawTextLayout( const CommonSalLayout& ) override; diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index ef228fa..9ca2433 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -191,8 +191,8 @@ public: std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) = 0; - virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) = 0; - virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) = 0; + virtual bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) = 0; + virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) = 0; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; virtual void DrawTextLayout( const CommonSalLayout& ) = 0; diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx index 9417345..1b04725 100644 --- a/vcl/inc/textrender.hxx +++ b/vcl/inc/textrender.hxx @@ -59,8 +59,8 @@ public: std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) = 0; - virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) = 0; - virtual bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) = 0; + virtual bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) = 0; + virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) = 0; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; virtual void DrawTextLayout(const CommonSalLayout&) = 0; #if ENABLE_CAIRO_CANVAS diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx index 5fab64a..1cdf405 100644 --- a/vcl/inc/unx/cairotextrender.hxx +++ b/vcl/inc/unx/cairotextrender.hxx @@ -75,8 +75,8 @@ public: std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) override; - virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) override; - virtual bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) override; + virtual bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) override; + virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; virtual void DrawTextLayout(const CommonSalLayout&) override; #if ENABLE_CAIRO_CANVAS diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h index 1dcb7ab..721efd5 100644 --- a/vcl/inc/unx/genpspgraphics.h +++ b/vcl/inc/unx/genpspgraphics.h @@ -115,8 +115,8 @@ public: bool bVertical, std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) override; - virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) override; - virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) override; + virtual bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) override; + virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; virtual void DrawTextLayout( const CommonSalLayout& ) override; virtual bool supportsOperation( OutDevSupportType ) const override; diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index 65afd4b..bf9cf3c 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -157,9 +157,9 @@ public: const FontCharMapRef GetFontCharMap() const; bool GetFontCapabilities(vcl::FontCapabilities &) const; - const GlyphMetric& GetGlyphMetric(sal_GlyphId aGlyphId); + const GlyphMetric& GetGlyphMetric(const GlyphItem& rGlyph); - bool GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolygon& ) const; + bool GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon&) const; bool GetAntialiasAdvice() const; hb_font_t* GetHbFont() { return mpHbFont; } void SetHbFont( hb_font_t* pHbFont ) { mpHbFont = pHbFont; } @@ -175,7 +175,7 @@ private: long Release() const; sal_uLong GetByteCount() const { return mnBytesUsed; } - void InitGlyphData( sal_GlyphId, GlyphData& ) const; + void InitGlyphData(const GlyphItem&, GlyphData&) const; void GarbageCollect( long ); void ReleaseFromGarbageCollect(); diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index b3de804..5eb9172 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -140,8 +140,8 @@ public: std::vector< sal_Int32 >& rWidths, Ucs2UIntMap& rUnicodeEnc ) override; - virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) override; - virtual bool GetGlyphOutline( sal_GlyphId nIndex, basegfx::B2DPolyPolygon& ) override; + virtual bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) override; + virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; virtual void DrawTextLayout( const CommonSalLayout& ) override; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 198c61c..8a493d7 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -377,8 +377,8 @@ public: Ucs2UIntMap& rUnicodeEnc ) override; int GetMinKashidaWidth(); - virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) override; - virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) override; + virtual bool GetGlyphBoundRect(const GlyphItem&, Rectangle&) override; + virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; virtual void DrawTextLayout( const CommonSalLayout& ) override; diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 7677a04..300ee4d 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -152,9 +152,9 @@ SAL_WNODEPRECATED_DECLARATIONS_POP } } -bool CoreTextStyle::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) const +bool CoreTextStyle::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect ) const { - CGGlyph nCGGlyph = aGlyphId & GF_IDXMASK; + CGGlyph nCGGlyph = rGlyph.maGlyphId & GF_IDXMASK; CTFontRef aCTFontRef = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.11 kCTFontDefaultOrientation @@ -163,7 +163,7 @@ bool CoreTextStyle::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) CGRect aCGRect = CTFontGetBoundingRectsForGlyphs(aCTFontRef, aFontOrientation, &nCGGlyph, nullptr, 1); // Apply font rotation to non-upright glyphs. - if (mfFontRotation && !(aGlyphId & GF_ROTMASK)) + if (mfFontRotation && !(rGlyph.maGlyphId & GF_ROTMASK)) aCGRect = CGRectApplyAffineTransform(aCGRect, CGAffineTransformMakeRotation(mfFontRotation)); rRect.Left() = lrint( aCGRect.origin.x ); @@ -225,11 +225,11 @@ static void MyCGPathApplierFunc( void* pData, const CGPathElement* pElement ) } } -bool CoreTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolygon& rResult ) const +bool CoreTextStyle::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rResult) const { rResult.clear(); - CGGlyph nCGGlyph = aGlyphId & GF_IDXMASK; + CGGlyph nCGGlyph = rGlyph.maGlyphId & GF_IDXMASK; CTFontRef pCTFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName )); CGPathRef xPath = CTFontCreatePathForGlyph( pCTFont, nCGGlyph, nullptr ); if (!xPath) diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 4b3a63a..c593b88 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -382,23 +382,23 @@ bool AquaSalGraphics::AddTempDevFont( PhysicalFontCollection*, return ::AddTempDevFont(rFontFileURL); } -bool AquaSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolygon& rPolyPoly ) +bool AquaSalGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rPolyPoly) { - const int nFallbackLevel = aGlyphId >> GF_FONTSHIFT; + const int nFallbackLevel = rGlyph.maGlyphId >> GF_FONTSHIFT; if (nFallbackLevel < MAX_FALLBACK && mpTextStyle[nFallbackLevel]) { - const bool bRC = mpTextStyle[nFallbackLevel]->GetGlyphOutline(aGlyphId, rPolyPoly); + const bool bRC = mpTextStyle[nFallbackLevel]->GetGlyphOutline(rGlyph, rPolyPoly); return bRC; } return false; } -bool AquaSalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) +bool AquaSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect ) { - const int nFallbackLevel = aGlyphId >> GF_FONTSHIFT; + const int nFallbackLevel = rGlyph.maGlyphId >> GF_FONTSHIFT; if (nFallbackLevel < MAX_FALLBACK && mpTextStyle[nFallbackLevel]) { - const bool bRC = mpTextStyle[nFallbackLevel]->GetGlyphBoundRect(aGlyphId, rRect); + const bool bRC = mpTextStyle[nFallbackLevel]->GetGlyphBoundRect(rGlyph, rRect); return bRC; } return false; diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 25c1600..6f3b082 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -675,7 +675,7 @@ bool SalLayout::GetOutline( SalGraphics& rSalGraphics, while (GetNextGlyphs(1, &pGlyph, aPos, nStart)) { // get outline of individual glyph, ignoring "empty" glyphs - bool bSuccess = rSalGraphics.GetGlyphOutline(pGlyph->maGlyphId, aGlyphOutline); + bool bSuccess = rSalGraphics.GetGlyphOutline(*pGlyph, aGlyphOutline); bAllOk &= bSuccess; bOneOk |= bSuccess; // only add non-empty outlines @@ -707,7 +707,7 @@ bool SalLayout::GetBoundRect( SalGraphics& rSalGraphics, Rectangle& rRect ) cons while (GetNextGlyphs(1, &pGlyph, aPos, nStart)) { // get bounding rectangle of individual glyph - if (rSalGraphics.GetGlyphBoundRect(pGlyph->maGlyphId, aRectangle)) + if (rSalGraphics.GetGlyphBoundRect(*pGlyph, aRectangle)) { // merge rectangle aRectangle += aPos; diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 71d3f21..3820d42 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1300,7 +1300,7 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout ) int nStart = 0; while (rSalLayout.GetNextGlyphs(1, &pGlyph, aOutPoint, nStart)) { - if (!mpGraphics->GetGlyphBoundRect(pGlyph->maGlyphId, aRectangle ) ) + if (!mpGraphics->GetGlyphBoundRect(*pGlyph, aRectangle ) ) continue; if (!SalLayout::IsSpacingGlyph(pGlyph->maGlyphId)) diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 501d399..3d7ca15 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -430,9 +430,9 @@ void CairoTextRender::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nF mpFreetypeFont[nFallbackLevel]->GetFontMetric(rxFontMetric); } -bool CairoTextRender::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) +bool CairoTextRender::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect) { - const int nLevel = aGlyphId >> GF_FONTSHIFT; + const int nLevel = rGlyph.maGlyphId >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) return false; @@ -440,8 +440,7 @@ bool CairoTextRender::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect if( !pSF ) return false; - aGlyphId &= GF_IDXMASK; - const GlyphMetric& rGM = pSF->GetGlyphMetric(aGlyphId); + const GlyphMetric& rGM = pSF->GetGlyphMetric(rGlyph); Rectangle aRect( rGM.GetOffset(), rGM.GetSize() ); if ( pSF->mnCos != 0x10000 && pSF->mnSin != 0 ) @@ -460,10 +459,10 @@ bool CairoTextRender::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect return true; } -bool CairoTextRender::GetGlyphOutline( sal_GlyphId aGlyphId, +bool CairoTextRender::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rPolyPoly ) { - const int nLevel = aGlyphId >> GF_FONTSHIFT; + const int nLevel = rGlyph.maGlyphId >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) return false; @@ -471,8 +470,7 @@ bool CairoTextRender::GetGlyphOutline( sal_GlyphId aGlyphId, if( !pSF ) return false; - aGlyphId &= GF_IDXMASK; - if( pSF->GetGlyphOutline( aGlyphId, rPolyPoly ) ) + if( pSF->GetGlyphOutline(rGlyph, rPolyPoly)) return true; return false; diff --git a/vcl/unx/generic/gdi/font.cxx b/vcl/unx/generic/gdi/font.cxx index 8379c0c..37a3846 100644 --- a/vcl/unx/generic/gdi/font.cxx +++ b/vcl/unx/generic/gdi/font.cxx @@ -106,15 +106,15 @@ X11SalGraphics::GetFontMetric( ImplFontMetricDataRef &rxFontMetric, int nFallbac mxTextRenderImpl->GetFontMetric(rxFontMetric, nFallbackLevel); } -bool X11SalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) +bool X11SalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect) { - return mxTextRenderImpl->GetGlyphBoundRect(aGlyphId, rRect); + return mxTextRenderImpl->GetGlyphBoundRect(rGlyph, rRect); } -bool X11SalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, +bool X11SalGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rPolyPoly ) { - return mxTextRenderImpl->GetGlyphOutline(aGlyphId, rPolyPoly); + return mxTextRenderImpl->GetGlyphOutline(rGlyph, rPolyPoly); } SalLayout* X11SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLevel ) diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 36b262f..2e62abe 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -627,12 +627,6 @@ void FreetypeFont::GetFontMetric(ImplFontMetricDataRef& rxTo) const } -static inline void SplitGlyphFlags(sal_GlyphId& rGlyphId, int& nGlyphFlags) -{ - nGlyphFlags = rGlyphId & GF_FLAGMASK; - rGlyphId &= GF_IDXMASK; -} - void FreetypeFont::ApplyGlyphTransform( int nGlyphFlags, FT_Glyph pGlyphFT ) const { // shortcut most common case @@ -696,14 +690,13 @@ void FreetypeFont::ApplyGlyphTransform( int nGlyphFlags, FT_Glyph pGlyphFT ) con } } -void FreetypeFont::InitGlyphData( sal_GlyphId aGlyphId, GlyphData& rGD ) const +void FreetypeFont::InitGlyphData(const GlyphItem& rGlyph, GlyphData& rGD ) const { FT_Activate_Size( maSizeFT ); - int nGlyphFlags; - SplitGlyphFlags(aGlyphId, nGlyphFlags ); + int nGlyphFlags = rGlyph.maGlyphId & GF_FLAGMASK;; - FT_Error rc = FT_Load_Glyph(maFaceFT, aGlyphId, mnLoadFlags); + FT_Error rc = FT_Load_Glyph(maFaceFT, rGlyph.maGlyphId & GF_IDXMASK, mnLoadFlags); if( rc != FT_Err_Ok ) { @@ -1001,7 +994,7 @@ static int FT_cubic_to( const FT_Vector* p1, const FT_Vector* p2, const FT_Vecto } // extern "C" -bool FreetypeFont::GetGlyphOutline( sal_GlyphId aGlyphId, +bool FreetypeFont::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rB2DPolyPoly ) const { if( maSizeFT ) @@ -1009,8 +1002,7 @@ bool FreetypeFont::GetGlyphOutline( sal_GlyphId aGlyphId, rB2DPolyPoly.clear(); - int nGlyphFlags; - SplitGlyphFlags(aGlyphId, nGlyphFlags); + int nGlyphFlags = rGlyph.maGlyphId & GF_FLAGMASK;; FT_Int nLoadFlags = FT_LOAD_DEFAULT | FT_LOAD_IGNORE_TRANSFORM; @@ -1019,7 +1011,7 @@ bool FreetypeFont::GetGlyphOutline( sal_GlyphId aGlyphId, nLoadFlags |= FT_LOAD_TARGET_LIGHT; #endif - FT_Error rc = FT_Load_Glyph( maFaceFT, aGlyphId, nLoadFlags ); + FT_Error rc = FT_Load_Glyph(maFaceFT, rGlyph.maGlyphId & GF_IDXMASK, nLoadFlags); if( rc != FT_Err_Ok ) return false; diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx index 3cece78..b41f7c0 100644 --- a/vcl/unx/generic/glyphs/glyphcache.cxx +++ b/vcl/unx/generic/glyphs/glyphcache.cxx @@ -304,10 +304,10 @@ long FreetypeFont::Release() const return --mnRefCount; } -const GlyphMetric& FreetypeFont::GetGlyphMetric(sal_GlyphId aGlyphId) +const GlyphMetric& FreetypeFont::GetGlyphMetric(const GlyphItem& rGlyph) { // usually the GlyphData is cached - GlyphList::iterator it = maGlyphList.find( aGlyphId ); + GlyphList::iterator it = maGlyphList.find(rGlyph.maGlyphId & GF_IDXMASK); if( it != maGlyphList.end() ) { GlyphData& rGlyphData = it->second; GlyphCache::GetInstance().UsingGlyph( *this, rGlyphData ); @@ -315,9 +315,9 @@ const GlyphMetric& FreetypeFont::GetGlyphMetric(sal_GlyphId aGlyphId) } // sometimes not => we need to create and initialize it ourselves - GlyphData& rGlyphData = maGlyphList[ aGlyphId ]; + GlyphData& rGlyphData = maGlyphList[rGlyph.maGlyphId & GF_IDXMASK]; mnBytesUsed += sizeof( GlyphData ); - InitGlyphData( aGlyphId, rGlyphData ); + InitGlyphData(rGlyph, rGlyphData); GlyphCache::GetInstance().AddedGlyph( *this, rGlyphData ); return rGlyphData.GetMetric(); } diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index 213874d..f0859eb 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -760,9 +760,9 @@ void GenPspGraphics::GetFontMetric(ImplFontMetricDataRef& rxFontMetric, int nFal m_pFreetypeFont[nFallbackLevel]->GetFontMetric(rxFontMetric); } -bool GenPspGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) +bool GenPspGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect) { - const int nLevel = aGlyphId >> GF_FONTSHIFT; + const int nLevel = rGlyph.maGlyphId >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) return false; @@ -770,16 +770,15 @@ bool GenPspGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) if( !pSF ) return false; - aGlyphId &= GF_IDXMASK; - const GlyphMetric& rGM = pSF->GetGlyphMetric( aGlyphId ); + const GlyphMetric& rGM = pSF->GetGlyphMetric(rGlyph); rRect = Rectangle( rGM.GetOffset(), rGM.GetSize() ); return true; } -bool GenPspGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, +bool GenPspGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rB2DPolyPoly ) { - const int nLevel = aGlyphId >> GF_FONTSHIFT; + const int nLevel = rGlyph.maGlyphId >> GF_FONTSHIFT; if( nLevel >= MAX_FALLBACK ) return false; @@ -787,8 +786,7 @@ bool GenPspGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, if( !pSF ) return false; - aGlyphId &= GF_IDXMASK; - if( pSF->GetGlyphOutline( aGlyphId, rB2DPolyPoly ) ) + if (pSF->GetGlyphOutline(rGlyph, rB2DPolyPoly)) return true; return false; diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index fef9bbf..30f22e6 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1354,7 +1354,7 @@ void WinSalGraphics::ClearDevFontCache() //anything to do here ? } -bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) +bool WinSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect) { HDC hDC = getHDC(); @@ -1365,12 +1365,11 @@ bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) UINT nGGOFlags = GGO_METRICS; nGGOFlags |= GGO_GLYPH_INDEX; - aGlyphId &= GF_IDXMASK; GLYPHMETRICS aGM; aGM.gmptGlyphOrigin.x = aGM.gmptGlyphOrigin.y = 0; aGM.gmBlackBoxX = aGM.gmBlackBoxY = 0; - DWORD nSize = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags, &aGM, 0, nullptr, &aMat ); + DWORD nSize = ::GetGlyphOutlineW(hDC, rGlyph.maGlyphId & GF_IDXMASK, nGGOFlags, &aGM, 0, nullptr, &aMat); if( nSize == GDI_ERROR ) return false; @@ -1383,7 +1382,7 @@ bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) return true; } -bool WinSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, +bool WinSalGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rB2DPolyPoly ) { rB2DPolyPoly.clear(); @@ -1397,17 +1396,16 @@ bool WinSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId, UINT nGGOFlags = GGO_NATIVE; nGGOFlags |= GGO_GLYPH_INDEX; - aGlyphId &= GF_IDXMASK; GLYPHMETRICS aGlyphMetrics; - const DWORD nSize1 = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags, &aGlyphMetrics, 0, nullptr, &aMat ); + const DWORD nSize1 = ::GetGlyphOutlineW(hDC, rGlyph.maGlyphId & GF_IDXMASK, nGGOFlags, &aGlyphMetrics, 0, nullptr, &aMat); if( !nSize1 ) // blank glyphs are ok return true; else if( nSize1 == GDI_ERROR ) return false; BYTE* pData = new BYTE[ nSize1 ]; - const DWORD nSize2 = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags, + const DWORD nSize2 = ::GetGlyphOutlineW(hDC, rGlyph.maGlyphId & GF_IDXMASK, nGGOFlags, &aGlyphMetrics, nSize1, pData, &aMat ); if( nSize1 != nSize2 ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits