[Libreoffice-commits] .: Branch 'libreoffice-3-6-0' - vcl/aqua

Petr Mladek pmladek at kemper.freedesktop.org
Mon Jul 23 09:06:35 PDT 2012


 vcl/aqua/source/gdi/salatslayout.cxx |   29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

New commits:
commit f9e000361a29c4894d64c0b0a03622323a19b6a0
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Sun Jul 22 16:34:10 2012 +0200

    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 at suse.cz>
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>
    Signed-off-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx
index a8fc7c5..8dcd70f 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 );


More information about the Libreoffice-commits mailing list