From f9395a123e8c85134bdd6e471bc93b2745e22a9d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 29 Nov 2022 20:31:27 +0000 Subject: tdf#152094 retain more accuracy from RefDevMode::MSO1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit do it like this to avoid adding another mapmode and to keep things "the same" as much as possible Change-Id: I1965aa545646f2d27b950d6335b2f608c3e4e04b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143475 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- drawinglayer/source/primitive2d/textlayoutdevice.cxx | 15 ++++++++------- drawinglayer/source/processor2d/vclprocessor2d.cxx | 5 +++-- drawinglayer/source/tools/wmfemfhelper.cxx | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index fcc9b401fa48..ea9fed02a20f 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -231,12 +232,11 @@ void TextLayouterDevice::getTextOutlines(basegfx::B2DPolyPolygonVector& rB2DPoly { OSL_ENSURE(nDXArrayCount == nTextLength, "DXArray size does not correspond to text portion size (!)"); - std::vector aIntegerDXArray(nDXArrayCount); + KernArray aIntegerDXArray; + aIntegerDXArray.reserve(nDXArrayCount); for (sal_uInt32 a(0); a < nDXArrayCount; a++) - { - aIntegerDXArray[a] = basegfx::fround(rDXArray[a]); - } + aIntegerDXArray.push_back(basegfx::fround(rDXArray[a])); mrDevice.GetTextOutlines(rB2DPolyPolyVector, rText, nIndex, nIndex, nLength, 0, aIntegerDXArray, rKashidaArray); @@ -307,10 +307,11 @@ std::vector TextLayouterDevice::getTextArray(const OUString& rText, sal_ if (nTextLength) { - aRetval.reserve(nTextLength); - std::vector aArray; + KernArray aArray; mrDevice.GetTextArray(rText, &aArray, nIndex, nTextLength); - aRetval.assign(aArray.begin(), aArray.end()); + aRetval.reserve(aArray.size()); + for (size_t i = 0, nEnd = aArray.size(); i < nEnd; ++i) + aRetval.push_back(aArray[i]); } return aRetval; diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index e1d56f4da9b1..bd92921396ae 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -282,7 +283,7 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( } // create integer DXArray - std::vector aDXArray; + KernArray aDXArray; if (!rTextCandidate.getDXArray().empty()) { @@ -335,7 +336,7 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( sal_Int32 nDX = aDXArray[0]; aDXArray.resize(nLen); for (sal_Int32 i = 1; i < nLen; ++i) - aDXArray[i] = aDXArray[i - 1] + nDX; + aDXArray.set(i, aDXArray[i - 1] + nDX); } } diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index 7b1f83b43195..4790465a7366 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -1797,7 +1797,7 @@ namespace wmfemfhelper { // prepare DXArray (if used) std::vector< double > aDXArray; - const std::vector & rDXArray = pA->GetDXArray(); + const KernArray& rDXArray = pA->GetDXArray(); std::vector< sal_Bool > aKashidaArray = pA->GetKashidaArray(); if(!rDXArray.empty()) -- cgit