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

panoskorovesis (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 14 06:51:09 UTC 2021


 include/vcl/filter/SvmReader.hxx    |    1 +
 include/vcl/metaact.hxx             |    2 ++
 vcl/source/filter/svm/SvmReader.cxx |   20 +++++++++++++++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 1583371d1d39c63940a3f58d3d2e940f903baa88
Author:     panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Tue Jul 13 13:47:48 2021 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jul 14 08:50:28 2021 +0200

    Add Handler for Gradient Read
    
    The handler separates MetaGradientAction::Read from metaact.hxx
    Read implementation is now in SvmReader.hxx
    
    Change-Id: Ib8b6db1362c0ada3491e56d05409b810ac16be89
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118833
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx
index 720480e7fd57..c4c3080b7af6 100644
--- a/include/vcl/filter/SvmReader.hxx
+++ b/include/vcl/filter/SvmReader.hxx
@@ -65,6 +65,7 @@ public:
     rtl::Reference<MetaAction> MaskHandler();
     rtl::Reference<MetaAction> MaskScaleHandler();
     rtl::Reference<MetaAction> MaskScalePartHandler();
+    rtl::Reference<MetaAction> GradientHandler();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index eb9c47c560d2..958807d5126c 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -1067,6 +1067,8 @@ public:
 
     const tools::Rectangle&    GetRect() const { return maRect; }
     const Gradient&     GetGradient() const { return maGradient; }
+    void                SetGradient(Gradient& rGradient) { maGradient = rGradient; }
+    void                SetRect(tools::Rectangle& rRect) { maRect = rRect; }
 };
 
 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaGradientExAction final : public MetaAction
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index 077c7834c086..70105cf517a9 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -238,7 +238,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData)
             return MaskScalePartHandler();
             break;
         case MetaActionType::GRADIENT:
-            pAction = new MetaGradientAction;
+            return GradientHandler();
             break;
         case MetaActionType::GRADIENTEX:
             pAction = new MetaGradientExAction;
@@ -1025,4 +1025,22 @@ rtl::Reference<MetaAction> SvmReader::MaskScalePartHandler()
 
     return pAction;
 }
+
+rtl::Reference<MetaAction> SvmReader::GradientHandler()
+{
+    auto pAction = new MetaGradientAction();
+
+    VersionCompatRead aCompat(mrStream);
+    TypeSerializer aSerializer(mrStream);
+
+    tools::Rectangle aRect;
+    aSerializer.readRectangle(aRect);
+    Gradient aGradient;
+    aSerializer.readGradient(aGradient);
+
+    pAction->SetRect(aRect);
+    pAction->SetGradient(aGradient);
+
+    return pAction;
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list