summaryrefslogtreecommitdiffstats
path: root/drawinglayer
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-10-28 09:27:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-10-29 12:38:51 +0200
commit894b4911ffb96ff667fdeb3aec7922316ab7230a (patch)
tree3942ed8088c058b70bb79984b186c5156284abf4 /drawinglayer
parentPrepare for removal of non-const operator[] from Sequence in chart2 (diff)
downloadcore-894b4911ffb96ff667fdeb3aec7922316ab7230a.tar.gz
core-894b4911ffb96ff667fdeb3aec7922316ab7230a.zip
pass DX array around using o3tl::span instead of pointer
so we get bounds checking in debug mode Note that I cannot just pass around the std::vectors involved because there is a place in editeng which calls with a subset of a vector. Change-Id: I5088a139593c27bf9cbe5d843ab4b0048ac6d508 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124330 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx12
-rw-r--r--drawinglayer/source/tools/wmfemfhelper.cxx6
3 files changed, 9 insertions, 11 deletions
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index c36c73658a08..11e903027122 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -239,7 +239,7 @@ void TextLayouterDevice::getTextOutlines(basegfx::B2DPolyPolygonVector& rB2DPoly
}
mrDevice.GetTextOutlines(rB2DPolyPolyVector, rText, nIndex, nIndex, nLength, 0,
- aIntegerDXArray.data());
+ { aIntegerDXArray.data(), aIntegerDXArray.size() });
}
else
{
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 16bf6a78b878..034e82e1f50e 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -286,9 +286,6 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
sal_Int32 nPos = rTextCandidate.getTextPosition();
sal_Int32 nLen = rTextCandidate.getTextLength();
- std::vector<tools::Long>* pDXArray
- = !aTransformedDXArray.empty() ? &aTransformedDXArray : nullptr;
-
if (rTextCandidate.isFilled())
{
basegfx::B2DVector aOldFontScaling, aOldTranslate;
@@ -299,8 +296,8 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
tools::Long nWidthToFill = static_cast<tools::Long>(
rTextCandidate.getWidthToFill() * aFontScaling.getX() / aOldFontScaling.getX());
- tools::Long nWidth
- = mpOutputDevice->GetTextArray(rTextCandidate.getText(), pDXArray, 0, 1);
+ tools::Long nWidth = mpOutputDevice->GetTextArray(rTextCandidate.getText(),
+ &aTransformedDXArray, 0, 1);
tools::Long nChars = 2;
if (nWidth)
nChars = nWidthToFill / nWidth;
@@ -314,8 +311,9 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
if (!aTransformedDXArray.empty())
{
- mpOutputDevice->DrawTextArray(aStartPoint, aText,
- pDXArray ? pDXArray->data() : nullptr, nPos, nLen);
+ mpOutputDevice->DrawTextArray(
+ aStartPoint, aText, { aTransformedDXArray.data(), aTransformedDXArray.size() },
+ nPos, nLen);
}
else
{
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index 042bd8a77037..78b178355fbd 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -1828,15 +1828,15 @@ namespace wmfemfhelper
{
// prepare DXArray (if used)
std::vector< double > aDXArray;
- tools::Long* pDXArray = pA->GetDXArray();
+ const std::vector<tools::Long> & rDXArray = pA->GetDXArray();
- if(pDXArray)
+ if(!rDXArray.empty())
{
aDXArray.reserve(nTextLength);
for(sal_uInt32 a(0); a < nTextLength; a++)
{
- aDXArray.push_back(static_cast<double>(*(pDXArray + a)));
+ aDXArray.push_back(static_cast<double>(rDXArray[a]));
}
}