[Libreoffice-commits] core.git: include/vcl vcl/source

panoskorovesis (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 3 02:49:35 UTC 2021


 include/vcl/filter/SvmWriter.hxx    |    1 
 vcl/source/filter/svm/SvmWriter.cxx |   41 ++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

New commits:
commit a3848e4e6b433e251c5e51f1e29d3c28d54a257c
Author:     panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Mon Aug 2 19:57:11 2021 +0300
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Tue Aug 3 04:48:59 2021 +0200

    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 at gmail.com>

diff --git a/include/vcl/filter/SvmWriter.hxx b/include/vcl/filter/SvmWriter.hxx
index 393fb19f672f..f4019899c5ce 100644
--- a/include/vcl/filter/SvmWriter.hxx
+++ b/include/vcl/filter/SvmWriter.hxx
@@ -50,4 +50,5 @@ public:
     void ChordHandler(MetaChordAction* pAction);
     void PolyLineHandler(MetaPolyLineAction* pAction);
     void PolygonHandler(MetaPolygonAction* pAction);
+    void PolyPolygonHandler(MetaPolyPolygonAction* pAction);
 };
\ No newline at end of file
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: */


More information about the Libreoffice-commits mailing list