vcl/source/outdev/map.cxx | 3 +-- vcl/source/outdev/text.cxx | 17 +++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-)
New commits: commit f523c854a50358fe3434d8e65bd47f76ccc77b90 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Jan 11 16:26:26 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Jan 11 20:35:39 2022 +0100 make VCL_FLOAT_DEVICE_PIXEL compile Change-Id: I0673b77a24085a8f06471d67c4cfdec43047c226 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128290 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 112fd5322557..73badc74bcfc 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -1824,9 +1824,8 @@ DeviceCoordinate OutputDevice::LogicWidthToDeviceCoordinate( tools::Long nWidth return static_cast<DeviceCoordinate>(nWidth); #if VCL_FLOAT_DEVICE_PIXEL - return (double)nWidth * maMapRes.mfScaleX * mnDPIX; + return ImplLogicToPixel(static_cast<double>(nWidth), mnDPIX, maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX); #else - return ImplLogicToPixel(nWidth, mnDPIX, maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX); #endif } diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index a28dc49e5ebd..9a9e3d9f5399 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -986,12 +986,13 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<sal_In } #if VCL_FLOAT_DEVICE_PIXEL - std::unique_ptr<DeviceCoordinate[]> pDXPixelArray; + std::unique_ptr<std::vector<DeviceCoordinate>> xDXPixelArray; if(pDXAry) { - pDXPixelArray.reset(new DeviceCoordinate[nLen]); + xDXPixelArray.reset(new std::vector<DeviceCoordinate>(nLen)); } - DeviceCoordinate nWidth = pSalLayout->FillDXArray( pDXPixelArray.get() ); + std::vector<DeviceCoordinate>* pDXPixelArray = xDXPixelArray.get(); + DeviceCoordinate nWidth = pSalLayout->FillDXArray(pDXPixelArray); int nWidthFactor = pSalLayout->GetUnitsPerPixel(); // convert virtual char widths to virtual absolute positions @@ -999,7 +1000,7 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<sal_In { for( int i = 1; i < nLen; ++i ) { - pDXPixelArray[ i ] += pDXPixelArray[ i-1 ]; + (*pDXPixelArray)[i] += (*pDXPixelArray)[i - 1]; } } if( mbMap ) @@ -1008,7 +1009,7 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<sal_In { for( int i = 0; i < nLen; ++i ) { - pDXPixelArray[i] = ImplDevicePixelToLogicWidth( pDXPixelArray[i] ); + (*pDXPixelArray)[i] = ImplDevicePixelToLogicWidth((*pDXPixelArray)[i]); } } nWidth = ImplDevicePixelToLogicWidth( nWidth ); @@ -1019,7 +1020,7 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<sal_In { for( int i = 0; i < nLen; ++i ) { - pDXPixelArray[i] /= nWidthFactor; + (*pDXPixelArray)[i] /= nWidthFactor; } } nWidth /= nWidthFactor; @@ -1029,7 +1030,7 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<sal_In pDXAry->resize(nLen); for( int i = 0; i < nLen; ++i ) { - (*pDXAry)[i] = basegfx::fround(pDXPixelArray[i]); + (*pDXAry)[i] = basegfx::fround((*pDXPixelArray)[i]); } } return basegfx::fround(nWidth); @@ -1361,7 +1362,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr, pDXPixelArray = xDXPixelArray.get(); for( int i = 0; i < nLen; ++i ) { - pDXPixelArray[i] = (*pDXArray)[i]; + pDXPixelArray[i] = pDXArray[i]; } #else /* !VCL_FLOAT_DEVICE_PIXEL */ pDXPixelArray = const_cast<DeviceCoordinate*>(pDXArray.data());