diff options
author | panoskorovesis <panoskorovesis@outlook.com> | 2021-08-02 19:57:11 +0300 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-08-03 04:48:59 +0200 |
commit | a3848e4e6b433e251c5e51f1e29d3c28d54a257c (patch) | |
tree | 896b58e53926bb3bd59584ef0ce2a3c216c9f967 /vcl | |
parent | cd3289e3878f35ba66e0f0b7d62e3cbcb6e53f4b (diff) |
Add Handler for PolyPolygon Write
The handler separates MetaPolyPolygonAction::Write from metaact.hxx
Write implementation is now in SvmWriter.hxx
Change-Id: I95b68a4ea561bf80fbe83363743ea91e3f973f7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119898
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/svm/SvmWriter.cxx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx index 6a3a88f78b79..fc4945274d6e 100644 --- a/vcl/source/filter/svm/SvmWriter.cxx +++ b/vcl/source/filter/svm/SvmWriter.cxx @@ -155,6 +155,13 @@ void SvmWriter::MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData) } break; + case MetaActionType::POLYPOLYGON: + { + auto* pMetaAction = static_cast<MetaPolyPolygonAction*>(pAction); + PolyPolygonHandler(pMetaAction); + } + break; + /* default case prevents test failure and will be removed once all the handlers are completed */ default: @@ -292,4 +299,38 @@ void SvmWriter::PolygonHandler(MetaPolygonAction* pAction) if (bHasPolyFlags) pAction->GetPolygon().Write(mrStream); } + +void SvmWriter::PolyPolygonHandler(MetaPolyPolygonAction* pAction) +{ + mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType())); + + VersionCompatWrite aCompat(mrStream, 2); + + sal_uInt16 nNumberOfComplexPolygons = 0; + sal_uInt16 i, nPolyCount = pAction->GetPolyPolygon().Count(); + + tools::Polygon aSimplePoly; // Version 1 + mrStream.WriteUInt16(nPolyCount); + for (i = 0; i < nPolyCount; i++) + { + const tools::Polygon& rPoly = pAction->GetPolyPolygon().GetObject(i); + if (rPoly.HasFlags()) + nNumberOfComplexPolygons++; + rPoly.AdaptiveSubdivide(aSimplePoly); + WritePolygon(mrStream, aSimplePoly); + } + + mrStream.WriteUInt16(nNumberOfComplexPolygons); // Version 2 + for (i = 0; nNumberOfComplexPolygons && (i < nPolyCount); i++) + { + const tools::Polygon& rPoly = pAction->GetPolyPolygon().GetObject(i); + if (rPoly.HasFlags()) + { + mrStream.WriteUInt16(i); + rPoly.Write(mrStream); + + nNumberOfComplexPolygons--; + } + } +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |