summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2012-07-22 16:34:10 +0200
committerPetr Mladek <pmladek@suse.cz>2012-07-23 18:05:31 +0200
commitf9e000361a29c4894d64c0b0a03622323a19b6a0 (patch)
treecddbcbcc1b37f506a3c0af99d28bb8f6e139bb11
parentaeebb0d20c6163ecbea47bb84fc83dd34b1438fa (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.cxx29
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 );