include/vcl/filter/SvmWriter.hxx | 1 + vcl/source/filter/svm/SvmWriter.cxx | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+)
New commits: commit 86fcdf240ccdbecd051498d0b1e76a698aab5e89 Author: panoskorovesis <panoskorove...@outlook.com> AuthorDate: Sat Jul 31 14:11:52 2021 +0300 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Aug 2 15:52:22 2021 +0200 Add Handler for Polygon Write The handler separates MetaPolygonHandler::Write from metaact.hxx Write implementation is now in SvmWriter.hxx Change-Id: Iffc665603db1bf1eea6b201e8975900a65f28a33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119738 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/vcl/filter/SvmWriter.hxx b/include/vcl/filter/SvmWriter.hxx index 891c3853e1ba..393fb19f672f 100644 --- a/include/vcl/filter/SvmWriter.hxx +++ b/include/vcl/filter/SvmWriter.hxx @@ -49,4 +49,5 @@ public: void PieHandler(MetaPieAction* pAction); void ChordHandler(MetaChordAction* pAction); void PolyLineHandler(MetaPolyLineAction* pAction); + void PolygonHandler(MetaPolygonAction* pAction); }; \ No newline at end of file diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx index eb64c40e7fdd..6a3a88f78b79 100644 --- a/vcl/source/filter/svm/SvmWriter.cxx +++ b/vcl/source/filter/svm/SvmWriter.cxx @@ -148,6 +148,13 @@ void SvmWriter::MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData) } break; + case MetaActionType::POLYGON: + { + auto* pMetaAction = static_cast<MetaPolygonAction*>(pAction); + PolygonHandler(pMetaAction); + } + break; + /* default case prevents test failure and will be removed once all the handlers are completed */ default: @@ -269,4 +276,20 @@ void SvmWriter::PolyLineHandler(MetaPolyLineAction* pAction) if (bHasPolyFlags) pAction->GetPolygon().Write(mrStream); } + +void SvmWriter::PolygonHandler(MetaPolygonAction* pAction) +{ + mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType())); + + VersionCompatWrite aCompat(mrStream, 2); + + tools::Polygon aSimplePoly; // Version 1 + pAction->GetPolygon().AdaptiveSubdivide(aSimplePoly); + WritePolygon(mrStream, aSimplePoly); + + bool bHasPolyFlags = pAction->GetPolygon().HasFlags(); // Version 2 + mrStream.WriteBool(bHasPolyFlags); + if (bHasPolyFlags) + pAction->GetPolygon().Write(mrStream); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */