diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-07-10 11:52:30 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-07-10 13:52:56 +0200 |
commit | fa61e8b220aa1f34b022b9af485f0209b2cb25d1 (patch) | |
tree | 5f91a5b0f214633895454452368dde057395c75d /svgio | |
parent | f8c15850dbfaa46605e1e353ae1f49e69184e8a1 (diff) |
tdf#99562: Do not ignore last column from matrix
Change-Id: I1dff65963e2c414d1771a1592159930150c513e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154241
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgtools.hxx | 3 | ||||
-rw-r--r-- | svgio/source/svgreader/svgfecolormatrixnode.cxx | 4 | ||||
-rw-r--r-- | svgio/source/svgreader/svgtools.cxx | 26 |
3 files changed, 10 insertions, 23 deletions
diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx index f556ed6cde02..c395702e5998 100644 --- a/svgio/inc/svgtools.hxx +++ b/svgio/inc/svgtools.hxx @@ -20,7 +20,6 @@ #pragma once #include <basegfx/color/bcolor.hxx> -#include <basegfx/range/b3drange.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/vector/b2ivector.hxx> #include <rtl/ustrbuf.hxx> @@ -110,7 +109,7 @@ namespace svgio::svgreader bool match_colorKeyword(basegfx::BColor& rColor, const OUString& rName); bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, SvgNumber& rOpacity); basegfx::B2DRange readViewBox(std::u16string_view rCandidate, InfoProvider const & rInfoProvider); - basegfx::B3DHomMatrix readFilterMatrix(std::u16string_view rCandidate, InfoProvider const & rInfoProvider); + std::vector<double> readFilterMatrix(std::u16string_view rCandidate, InfoProvider const & rInfoProvider); basegfx::B2DHomMatrix readTransform(std::u16string_view rCandidate, InfoProvider const & rInfoProvider); bool readSingleNumber(std::u16string_view rCandidate, SvgNumber& aNum); bool readLocalLink(std::u16string_view rCandidate, OUString& rURL); diff --git a/svgio/source/svgreader/svgfecolormatrixnode.cxx b/svgio/source/svgreader/svgfecolormatrixnode.cxx index 0fed49ea6ca2..d08c5ea44280 100644 --- a/svgio/source/svgreader/svgfecolormatrixnode.cxx +++ b/svgio/source/svgreader/svgfecolormatrixnode.cxx @@ -105,11 +105,11 @@ void SvgFeColorMatrixNode::apply(drawinglayer::primitive2d::Primitive2DContainer } else if (maType == ColorType::Matrix) { - basegfx::B3DHomMatrix aMatrix = readFilterMatrix(maValuesContent, *this); + std::vector<double> aVector = readFilterMatrix(maValuesContent, *this); const drawinglayer::primitive2d::Primitive2DReference xRef( new drawinglayer::primitive2d::ModifiedColorPrimitive2D( - std::move(rTarget), std::make_shared<basegfx::BColorModifier_matrix>(aMatrix))); + std::move(rTarget), std::make_shared<basegfx::BColorModifier_matrix>(aVector))); rTarget = drawinglayer::primitive2d::Primitive2DContainer{ xRef }; } } diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index f7bc5b951f97..ce8b4f99bd62 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -846,9 +846,9 @@ namespace svgio::svgreader return basegfx::B2DRange(); } - basegfx::B3DHomMatrix readFilterMatrix(std::u16string_view rCandidate, InfoProvider const & rInfoProvider) + std::vector<double> readFilterMatrix(std::u16string_view rCandidate, InfoProvider const & rInfoProvider) { - basegfx::B3DHomMatrix aMatrix; + std::vector<double> aVector; const sal_Int32 nLen(rCandidate.size()); sal_Int32 nPos(0); @@ -856,28 +856,16 @@ namespace svgio::svgreader SvgNumber aVal; - // create a 4x4 matrix from the list of 20 matrix values. - for (sal_uInt16 nRow = 0; nRow < 4; ++nRow) + while (nPos < nLen) { - for (sal_uInt16 nColumn = 0; nColumn < 5; ++nColumn) + if(readNumberAndUnit(rCandidate, nPos, aVal, nLen)) { - // return earlier if there are not enough values - if (nPos >= nLen) - { - return basegfx::B3DHomMatrix(); - } - - if(readNumberAndUnit(rCandidate, nPos, aVal, nLen)) - { - // ignore the last column - if (nColumn < 4) - aMatrix.set(nRow, nColumn, aVal.solve(rInfoProvider)); - skip_char(rCandidate, ' ', ',', nPos, nLen); - } + aVector.push_back(aVal.solve(rInfoProvider)); + skip_char(rCandidate, ' ', ',', nPos, nLen); } } - return aMatrix; + return aVector; } basegfx::B2DHomMatrix readTransform(std::u16string_view rCandidate, InfoProvider const & rInfoProvider) |