summaryrefslogtreecommitdiff
path: root/cppcanvas
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-11-29 20:31:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-02 15:20:07 +0000
commitf9395a123e8c85134bdd6e471bc93b2745e22a9d (patch)
treefd64e75a7ea36f28e9b993ae0c00480c480803df /cppcanvas
parent1e222575a3b637398b5b2d8e3172f12538ff34e3 (diff)
tdf#152094 retain more accuracy from RefDevMode::MSO1
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 <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/inc/implrenderer.hxx2
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx13
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.cxx11
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.hxx2
4 files changed, 13 insertions, 15 deletions
diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
index 44a168ee9225..edf4fcf9efba 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -194,7 +194,7 @@ namespace cppcanvas::internal
const OUString& rString,
int nIndex,
int nLength,
- o3tl::span<const sal_Int32> pCharWidths,
+ KernArraySpan pCharWidths,
const ActionFactoryParameters& rParms,
bool bSubsettable );
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 3046d880125e..130d19af95f7 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -846,7 +846,7 @@ namespace cppcanvas::internal
const OUString& rString,
int nIndex,
int nLength,
- o3tl::span<const sal_Int32> pCharWidths,
+ KernArraySpan pCharWidths,
const ActionFactoryParameters& rParms,
bool bSubsettableActions )
{
@@ -984,16 +984,16 @@ namespace cppcanvas::internal
{
::tools::Long nInterval = ( nWidth - nStrikeoutWidth * nLen ) / nLen;
nStrikeoutWidth += nInterval;
- std::vector<sal_Int32> aStrikeoutCharWidths(nLen);
+ KernArray aStrikeoutCharWidths;
for ( int i = 0;i<nLen; i++)
{
- aStrikeoutCharWidths[i] = nStrikeoutWidth;
+ aStrikeoutCharWidths.push_back(nStrikeoutWidth);
}
for ( int i = 1;i< nLen; i++ )
{
- aStrikeoutCharWidths[ i ] += aStrikeoutCharWidths[ i-1 ];
+ aStrikeoutCharWidths.adjust(i, aStrikeoutCharWidths[i - 1]);
}
pStrikeoutTextAction =
@@ -2554,7 +2554,7 @@ namespace cppcanvas::internal
// generating a DX array, and uniformly
// distributing the excess/insufficient width
// to every logical character.
- std::vector<sal_Int32> aDXArray;
+ KernArray aDXArray;
rVDev.GetTextArray( pAct->GetText(), &aDXArray,
pAct->GetIndex(), pAct->GetLen() );
@@ -2562,7 +2562,6 @@ namespace cppcanvas::internal
const sal_Int32 nWidthDifference( pAct->GetWidth() - aDXArray[ nLen-1 ] );
// Last entry of pDXArray contains total width of the text
- sal_Int32* p = aDXArray.data();
for (sal_Int32 i = 1; i <= nLen; ++i)
{
// calc ratio for every array entry, to
@@ -2571,7 +2570,7 @@ namespace cppcanvas::internal
// entry represents the 'end' position of
// the corresponding character, thus, we
// let i run from 1 to nLen.
- *p++ += i * nWidthDifference / nLen;
+ aDXArray.adjust(i - 1, i * nWidthDifference / nLen);
}
createTextAction(
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index f7844c802452..4b945c2f2ce3 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -158,7 +158,7 @@ namespace cppcanvas::internal
rLayoutWidth = *(std::max_element(rOffsets.begin(), rOffsets.end()));
}
- uno::Sequence< double > setupDXArray( o3tl::span<const sal_Int32> rCharWidths,
+ uno::Sequence< double > setupDXArray( KernArraySpan rCharWidths,
sal_Int32 nLen,
const OutDevState& rState )
{
@@ -170,11 +170,10 @@ namespace cppcanvas::internal
// array, by circumventing integer-based
// OutDev-mapping
const double nScale( rState.mapModeTransform.get(0,0) );
- sal_Int32 const * pCharWidths = rCharWidths.data();
for( int i = 0; i < nLen; ++i )
{
// TODO(F2): use correct scale direction
- *pOutputWidths++ = *pCharWidths++ * nScale;
+ *pOutputWidths++ = rCharWidths[i] * nScale;
}
return aCharWidthSeq;
@@ -188,7 +187,7 @@ namespace cppcanvas::internal
{
// no external DX array given, create one from given
// string
- std::vector<sal_Int32> aCharWidths;
+ KernArray aCharWidths;
rVDev.GetTextArray( rText, &aCharWidths, nStartPos, nLen );
@@ -1967,7 +1966,7 @@ namespace cppcanvas::internal
const OUString& rText,
sal_Int32 nStartPos,
sal_Int32 nLen,
- o3tl::span<const sal_Int32> pDXArray,
+ KernArraySpan pDXArray,
VirtualDevice& rVDev,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState,
@@ -2097,7 +2096,7 @@ namespace cppcanvas::internal
const OUString& rText,
sal_Int32 nStartPos,
sal_Int32 nLen,
- o3tl::span<const sal_Int32> pDXArray,
+ KernArraySpan pDXArray,
VirtualDevice& rVDev,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState,
diff --git a/cppcanvas/source/mtfrenderer/textaction.hxx b/cppcanvas/source/mtfrenderer/textaction.hxx
index f59ed4115c76..66d08ca8cfa2 100644
--- a/cppcanvas/source/mtfrenderer/textaction.hxx
+++ b/cppcanvas/source/mtfrenderer/textaction.hxx
@@ -68,7 +68,7 @@ namespace cppcanvas::internal
const OUString& rText,
sal_Int32 nStartPos,
sal_Int32 nLen,
- o3tl::span<const sal_Int32> pDXArray,
+ KernArraySpan pDXArray,
VirtualDevice& rVDev,
const CanvasSharedPtr& rCanvas,
const OutDevState& rState,