diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-28 09:27:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-29 12:38:51 +0200 |
commit | 894b4911ffb96ff667fdeb3aec7922316ab7230a (patch) | |
tree | 3942ed8088c058b70bb79984b186c5156284abf4 /filter/source | |
parent | 5b0ae3b59cd2cccfb72d991657366eb2a69bff49 (diff) |
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 'filter/source')
-rw-r--r-- | filter/source/svg/svgwriter.cxx | 16 | ||||
-rw-r--r-- | filter/source/svg/svgwriter.hxx | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index addf2897799c..a2eb3eccf065 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -2536,7 +2536,7 @@ void SVGActionWriter::ImplWriteMask(GDIMetaFile& rMtf, const Point& rDestPt, con void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, - const tools::Long* pDXArray, tools::Long nWidth ) + o3tl::span<const tools::Long> pDXArray, tools::Long nWidth ) { const FontMetric aMetric( mpVDev->GetFontMetric() ); @@ -2627,7 +2627,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, - const tools::Long* pDXArray, tools::Long nWidth, + o3tl::span<const tools::Long> pDXArray, tools::Long nWidth, Color aTextColor ) { sal_Int32 nLen = rText.getLength(); @@ -2646,10 +2646,10 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, std::vector<tools::Long> aTmpArray(nLen); // get text sizes - if( pDXArray ) + if( !pDXArray.empty() ) { aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 ); - memcpy(aTmpArray.data(), pDXArray, nLen * sizeof(tools::Long)); + memcpy(aTmpArray.data(), pDXArray.data(), nLen * sizeof(tools::Long)); } else { @@ -3764,7 +3764,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, { vcl::Font aFont = ImplSetCorrectFontHeight(); maAttributeWriter.SetFontAttr( aFont ); - ImplWriteText( pA->GetPoint(), aText, nullptr, 0 ); + ImplWriteText( pA->GetPoint(), aText, {}, 0 ); } else { @@ -3787,7 +3787,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, { vcl::Font aFont = ImplSetCorrectFontHeight(); maAttributeWriter.SetFontAttr( aFont ); - ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), nullptr, 0 ); + ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), {}, 0 ); } maTextWriter.writeTextPortion( pA->GetRect().TopLeft(), pA->GetText() ); } @@ -3809,7 +3809,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, { vcl::Font aFont = ImplSetCorrectFontHeight(); maAttributeWriter.SetFontAttr( aFont ); - ImplWriteText( pA->GetPoint(), aText, pA->GetDXArray(), 0 ); + ImplWriteText( pA->GetPoint(), aText, { pA->GetDXArray().data(), pA->GetDXArray().size() }, 0 ); } else { @@ -3834,7 +3834,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, { vcl::Font aFont = ImplSetCorrectFontHeight(); maAttributeWriter.SetFontAttr( aFont ); - ImplWriteText( pA->GetPoint(), aText, nullptr, pA->GetWidth() ); + ImplWriteText( pA->GetPoint(), aText, {}, pA->GetWidth() ); } else { diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx index 2dd32bacca26..81c71e5cd149 100644 --- a/filter/source/svg/svgwriter.hxx +++ b/filter/source/svg/svgwriter.hxx @@ -345,8 +345,8 @@ private: static Color ImplGetColorWithIntensity( const Color& rColor, sal_uInt16 nIntensity ); static Color ImplGetGradientColor( const Color& rStartColor, const Color& rEndColor, double fOffset ); void ImplWriteMask( GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient, sal_uInt32 nWriteFlags ); - void ImplWriteText( const Point& rPos, const OUString& rText, const tools::Long* pDXArray, tools::Long nWidth ); - void ImplWriteText( const Point& rPos, const OUString& rText, const tools::Long* pDXArray, tools::Long nWidth, Color aTextColor ); + void ImplWriteText( const Point& rPos, const OUString& rText, o3tl::span<const tools::Long> pDXArray, tools::Long nWidth ); + void ImplWriteText( const Point& rPos, const OUString& rText, o3tl::span<const tools::Long> pDXArray, tools::Long nWidth, Color aTextColor ); void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const css::uno::Reference<css::drawing::XShape>* pShape); void ImplWriteActions( const GDIMetaFile& rMtf, |