From cd3d26b7edbce67805259a71e4118223e02ebdd4 Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Fri, 18 Jul 2014 18:21:12 +0200 Subject: vcl consitent use of long for corrdinate most of length in vcl are calculated in 'long' but array of X position tend to be in sal_Int32. As a prep work to be able to support 'double' as the base type of Device Coordinate, harmonize the use of 'long' for non-float coordinate. Change-Id: I7cb33301ff6a5e2c62247b36a4e07e168a58a323 --- toolkit/source/awt/vclxfont.cxx | 7 ++++++- toolkit/source/awt/vclxgraphics.cxx | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx index 14174f25b5d7..139defbc1af4 100644 --- a/toolkit/source/awt/vclxfont.cxx +++ b/toolkit/source/awt/vclxfont.cxx @@ -176,8 +176,13 @@ sal_Int32 VCLXFont::getStringWidthArray( const OUString& str, ::com::sun::star:: { Font aOldFont = pOutDev->GetFont(); pOutDev->SetFont( maFont ); + long* pDXA = (long*)alloca(str.getLength() * sizeof(long)); + nRet = pOutDev->GetTextArray( str, pDXA ); rDXArray = ::com::sun::star::uno::Sequence( str.getLength() ); - nRet = pOutDev->GetTextArray( str, rDXArray.getArray() ); + for(int i = 0; i < str.getLength(); i++) + { + rDXArray[i] = pDXA[i]; + } pOutDev->SetFont( aOldFont ); } return nRet; diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx index 6a3a479a44dc..98b4d022e6ab 100644 --- a/toolkit/source/awt/vclxgraphics.cxx +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -540,7 +540,12 @@ void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rTex if( mpOutputDevice ) { InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS|INITOUTDEV_FONT ); - mpOutputDevice->DrawTextArray( Point( x, y ), rText, rLongs.getConstArray() ); + long* pDXA = (long*)alloca(rText.getLength() * sizeof(long)); + for(int i = 0; i < rText.getLength(); i++) + { + pDXA[i] = rLongs[i]; + } + mpOutputDevice->DrawTextArray( Point( x, y ), rText, pDXA ); } } -- cgit