diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2012-07-22 16:34:10 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2012-07-23 18:05:31 +0200 |
commit | f9e000361a29c4894d64c0b0a03622323a19b6a0 (patch) | |
tree | cddbcbcc1b37f506a3c0af99d28bb8f6e139bb11 | |
parent | aeebb0d20c6163ecbea47bb84fc83dd34b1438fa (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: Iaeda228afed4799e6d54c5a7b1764b39f7b77c81
Signed-off-by: Jan Holesovsky <kendy@suse.cz>
Signed-off-by: Michael Meeks <michael.meeks@suse.com>
Signed-off-by: Norbert Thiebaud <nthiebaud@gmail.com>
-rw-r--r-- | vcl/aqua/source/gdi/salatslayout.cxx | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index a8fc7c51a7c1..8dcd70f8d7e8 100644 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/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 ); |