diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2012-07-22 16:43:11 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2012-07-22 16:43:50 +0200 |
commit | 4f5a9171ef2093fdae595674dc1b3ab2868cc8c8 (patch) | |
tree | f318ce6e9c8a0e7d0cf3252614da479a554b598c /vcl/aqua | |
parent | 1bdb0801eb9315a3f844aa0200f001e667953483 (diff) |
Fix fdo#50631 - have GetTextBoundRect() properly rotate bounds
Earlier fixes to AquaSalGraphics::GetGlyphBoundRect() are
ineffective, since this method is not even called from ATSLayout.
Change-Id: I877fe5711167f6e28ac7a8153826878359f8ed42
Diffstat (limited to 'vcl/aqua')
-rw-r--r-- | vcl/aqua/source/gdi/atsui/salatslayout.cxx | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/vcl/aqua/source/gdi/atsui/salatslayout.cxx b/vcl/aqua/source/gdi/atsui/salatslayout.cxx index 093b29634cfd..3969bf9f3332 100644 --- a/vcl/aqua/source/gdi/atsui/salatslayout.cxx +++ b/vcl/aqua/source/gdi/atsui/salatslayout.cxx @@ -852,12 +852,39 @@ void ATSLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) const * * @return : measurement valid **/ -bool ATSLayout::GetBoundRect( SalGraphics&, Rectangle& rVCLRect ) const +bool ATSLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rVCLRect ) const { + AquaSalGraphics& rAquaGraphics = static_cast<AquaSalGraphics&>(rGraphics); + const Point aPos = GetDrawPosition( Point(mnBaseAdv, 0) ); const Fixed nFixedX = Vcl2Fixed( +aPos.X() ); const Fixed nFixedY = Vcl2Fixed( +aPos.Y() ); + // prepare ATSUI drawing attributes + static const ItemCount nMaxControls = 8; + ATSUAttributeTag theTags[ nMaxControls ]; + ByteCount theSizes[ nMaxControls]; + ATSUAttributeValuePtr theValues[ nMaxControls ]; + ItemCount numcontrols = 0; + + // Tell ATSUI to use CoreGraphics + theTags[numcontrols] = kATSUCGContextTag; + theSizes[numcontrols] = sizeof( CGContextRef ); + theValues[numcontrols++] = &rAquaGraphics.mrContext; + + // Rotate if necessary + if( rAquaGraphics.mnATSUIRotation != 0 ) + { + Fixed theAngle = rAquaGraphics.mnATSUIRotation; + theTags[numcontrols] = kATSULineRotationTag; + theSizes[numcontrols] = sizeof( Fixed ); + theValues[numcontrols++] = &theAngle; + } + + DBG_ASSERT( (numcontrols <= nMaxControls), "ATSLayout::GetBoundRect() numcontrols overflow" ); + OSStatus theErr = ATSUSetLayoutControls (maATSULayout, numcontrols, theTags, theSizes, theValues); + DBG_ASSERT( (theErr==noErr), "ATSLayout::GetBoundRect ATSUSetLayoutControls failed!\n" ); + Rect aMacRect; OSStatus eStatus = ATSUMeasureTextImage( maATSULayout, mnMinCharPos, mnCharCount, nFixedX, nFixedY, &aMacRect ); |