diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-06-04 09:30:10 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-06-04 09:32:15 -0500 |
commit | 1802271ac4aef34a7957a1fac492daa788d1d984 (patch) | |
tree | 481fb446e0209a0c605689a5c601eca505432b11 /vcl/aqua/source | |
parent | 2195b65c2106b529af833eca2c0f59674a299415 (diff) |
fdo#50631: Fix the bounding box of rotated glyphs on MacOSX.
Similarly to Ifb04d4a8e485182c5ef2771025b06832bfd75ae0 (commit
ac25f124858b79e302adcc533d6a658d5c529394), we need to rotate the bounding
box of glyphs on MacOSX too.
Additionally, round the position up, and convert the size more
straight-forward way.
Change-Id: Idf7a077836e65072795c6d98d61925ce62ee35b7
Diffstat (limited to 'vcl/aqua/source')
-rw-r--r-- | vcl/aqua/source/gdi/salgdi.cxx | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 0fccd6d663bc..e21c30aa8a6c 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -1860,11 +1860,27 @@ sal_Bool AquaSalGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphId, Rectangle& rR if( eStatus != noErr ) return false; - const long nMinX = (long)(+aGlyphMetrics.topLeft.x * mfFontScale - 0.5); - const long nMaxX = (long)(aGlyphMetrics.width * mfFontScale + 0.5) + nMinX; - const long nMinY = (long)(-aGlyphMetrics.topLeft.y * mfFontScale - 0.5); - const long nMaxY = (long)(aGlyphMetrics.height * mfFontScale + 0.5) + nMinY; - rRect = Rectangle( nMinX, nMinY, nMaxX, nMaxY ); + const long nMinX = (long)(+aGlyphMetrics.topLeft.x * mfFontScale + 0.5); + const long nMinY = (long)(-aGlyphMetrics.topLeft.y * mfFontScale + 0.5); + const long nWidth = (long)(aGlyphMetrics.width * mfFontScale + 0.5); + const long nHeight = (long)(aGlyphMetrics.height * mfFontScale + 0.5); + Rectangle aRect(Point(nMinX, nMinY), Size(nWidth, nHeight)); + + if ( mnATSUIRotation == 0 ) + rRect = aRect; + else + { + const double fRadians = mnATSUIRotation * (M_PI/0xB40000); + const double nSin = sin( fRadians ); + const double nCos = cos( fRadians ); + + rRect.Left() = nCos*aRect.Left() + nSin*aRect.Top(); + rRect.Top() = -nSin*aRect.Left() - nCos*aRect.Top(); + + rRect.Right() = nCos*aRect.Right() + nSin*aRect.Bottom(); + rRect.Bottom() = -nSin*aRect.Right() - nCos*aRect.Bottom(); + } + return true; } |