diff options
author | panoskorovesis <panoskorovesis@outlook.com> | 2021-07-31 14:11:52 +0300 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-08-02 15:52:22 +0200 |
commit | 86fcdf240ccdbecd051498d0b1e76a698aab5e89 (patch) | |
tree | ed97c0db2d3b3abd6d32aaa73f44119199766caa | |
parent | 940ef7d652f0916adf7c3499682e6f81b86404c8 (diff) |
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 <quikee@gmail.com>
-rw-r--r-- | include/vcl/filter/SvmWriter.hxx | 1 | ||||
-rw-r--r-- | vcl/source/filter/svm/SvmWriter.cxx | 23 |
2 files changed, 24 insertions, 0 deletions
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: */ |