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

panoskorovesis (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 6 08:49:58 UTC 2021


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

New commits:
commit 9eae429060cd968026834943f26f04a567f33e04
Author:     panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Wed Aug 4 10:21:39 2021 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Aug 6 10:49:23 2021 +0200

    Add Handler for Transparent Write
    
    The handler separates MetaTransparentAction::Write from metaact.hxx
    Write implementation is now in SvmWriter.hxx
    
    Change-Id: I8ae0e9341f2319126afc64cb633a0199d2496976
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119966
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/include/vcl/filter/SvmWriter.hxx b/include/vcl/filter/SvmWriter.hxx
index 79c0eec8c94c..ff26899cfaa5 100644
--- a/include/vcl/filter/SvmWriter.hxx
+++ b/include/vcl/filter/SvmWriter.hxx
@@ -63,4 +63,5 @@ public:
     void PushHandler(MetaPushAction* pAction);
     void PopHandler(MetaPopAction* pAction);
     void RasterOpHandler(MetaRasterOpAction* pAction);
+    void TransparentHandler(MetaTransparentAction* pAction);
 };
\ No newline at end of file
diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx
index 3648e5672c73..f6e4ad425e24 100644
--- a/vcl/source/filter/svm/SvmWriter.cxx
+++ b/vcl/source/filter/svm/SvmWriter.cxx
@@ -248,6 +248,13 @@ void SvmWriter::MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData)
         }
         break;
 
+        case MetaActionType::Transparent:
+        {
+            auto* pMetaAction = static_cast<MetaTransparentAction*>(pAction);
+            TransparentHandler(pMetaAction);
+        }
+        break;
+
         /* default case prevents test failure and will be
         removed once all the handlers are completed */
         default:
@@ -552,4 +559,25 @@ void SvmWriter::RasterOpHandler(MetaRasterOpAction* pAction)
     VersionCompatWrite aCompat(mrStream, 1);
     mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetRasterOp()));
 }
+
+void SvmWriter::TransparentHandler(MetaTransparentAction* pAction)
+{
+    mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
+    VersionCompatWrite aCompat(mrStream, 1);
+
+    // #i105373# The tools::PolyPolygon in this action may be a curve; this
+    // was ignored until now what is an error. To make older office
+    // versions work with MetaFiles, i opt for applying AdaptiveSubdivide
+    // to the PolyPolygon.
+    // The alternative would be to really write the curve information
+    // like in MetaPolyPolygonAction::Write (where someone extended it
+    // correctly, but not here :-( ).
+    // The golden solution would be to combine both, but i think it's
+    // not necessary; a good subdivision will be sufficient.
+    tools::PolyPolygon aNoCurvePolyPolygon;
+    pAction->GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon);
+
+    WritePolyPolygon(mrStream, aNoCurvePolyPolygon);
+    mrStream.WriteUInt16(pAction->GetTransparence());
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list