vcl/quartz/ctlayout.cxx | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-)
New commits: commit 3edcdd43f94e605c08314ab61f64c418b01f8dde Author: Herbert Dürr <h...@apache.org> Date: Thu Feb 20 13:52:52 2014 +0000 fdo#64957: #i124233# prevent the accumulation of rounding errors in CTLayout::FillDXArry() Change-Id: I8ee83068d71275874e4af364df253251dfb41c8c diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index 152c1b2..1cb8c48 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -368,9 +368,8 @@ long CTLayout::FillDXArray( sal_Int32* pDXArray ) const long nPixWidth = GetTextWidth(); if( pDXArray ) { - // initialize the result array - for( int i = 0; i < mnCharCount; ++i) - pDXArray[i] = 0; + // prepare the sub-pixel accurate logical-width array + ::std::vector<float> aWidthVector( mnCharCount ); // handle each glyph run CFArrayRef aGlyphRuns = CTLineGetGlyphRuns( mpCTLine ); const int nRunCount = CFArrayGetCount( aGlyphRuns ); @@ -388,9 +387,18 @@ long CTLayout::FillDXArray( sal_Int32* pDXArray ) const CTRunGetStringIndices( pGlyphRun, aFullRange, &aIndexVec[0] ); for( int i = 0; i != nGlyphCount; ++i ) { const int nRelIdx = aIndexVec[i]; - pDXArray[ nRelIdx ] += lrint(aSizeVec[i].width); + aWidthVector[nRelIdx] += aSizeVec[i].width; } } + + // convert the sub-pixel accurate array into classic pDXArray integers + float fWidthSum = 0.0; + sal_Int32 nOldDX = 0; + for( int i = 0; i < mnCharCount; ++i) { + const sal_Int32 nNewDX = rint( fWidthSum += aWidthVector[i]); + pDXArray[i] = nNewDX - nOldDX; + nOldDX = nNewDX; + } } return nPixWidth; commit fe93c38a38a54a479170c1012862518687552c1a Author: Tor Lillqvist <t...@collabora.com> Date: Wed Feb 26 12:22:56 2014 +0200 Use SAL_OVERRIDE consistently in CTLayout When adding SAL_OVERRIDE to the member functions marked virtual, I found one that was not an override of anything, and actually not used at all: GetGlyphOutlines(). Change-Id: I3e56caa6262b2f21f7f47e3851ab0e07bbc4b642 diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index 9dfa7f6..152c1b2 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -28,25 +28,24 @@ public: explicit CTLayout( const CoreTextStyle* ); virtual ~CTLayout( void ); - virtual bool LayoutText( ImplLayoutArgs& ); - virtual void AdjustLayout( ImplLayoutArgs& ); - virtual void DrawText( SalGraphics& ) const; + virtual bool LayoutText( ImplLayoutArgs& ) SAL_OVERRIDE; + virtual void AdjustLayout( ImplLayoutArgs& ) SAL_OVERRIDE; + virtual void DrawText( SalGraphics& ) const SAL_OVERRIDE; virtual int GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, int&, sal_Int32* pGlyphAdvances, int* pCharIndexes, - const PhysicalFontFace** pFallbackFonts ) const; + const PhysicalFontFace** pFallbackFonts ) const SAL_OVERRIDE; - virtual long GetTextWidth() const; - virtual long FillDXArray( sal_Int32* pDXArray ) const; + virtual long GetTextWidth() const SAL_OVERRIDE; + virtual long FillDXArray( sal_Int32* pDXArray ) const SAL_OVERRIDE; virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra, int nFactor) const SAL_OVERRIDE; - virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const; - virtual bool GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const; - virtual bool GetBoundRect( SalGraphics&, Rectangle& ) const; + virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const SAL_OVERRIDE; + virtual bool GetBoundRect( SalGraphics&, Rectangle& ) const SAL_OVERRIDE; - virtual void InitFont( void) const; - virtual void MoveGlyph( int nStart, long nNewXPos ); - virtual void DropGlyph( int nStart ); - virtual void Simplify( bool bIsBase ); + virtual void InitFont( void) const SAL_OVERRIDE; + virtual void MoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE; + virtual void DropGlyph( int nStart ) SAL_OVERRIDE; + virtual void Simplify( bool bIsBase ) SAL_OVERRIDE; private: CGPoint GetTextDrawPosition(void) const; @@ -487,7 +486,6 @@ bool CTLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rVCLRect ) const // glyph fallback is supported directly by Aqua // so methods used only by MultiSalLayout can be dummy implementated -bool CTLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const { return false; } void CTLayout::InitFont() const {} void CTLayout::MoveGlyph( int /*nStart*/, long /*nNewXPos*/ ) {} void CTLayout::DropGlyph( int /*nStart*/ ) {}
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits