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

panoskorovesis (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 9 22:40:43 UTC 2021


 include/vcl/filter/SvmReader.hxx    |    1 +
 include/vcl/metaact.hxx             |    5 +++++
 vcl/source/filter/svm/SvmReader.cxx |   28 +++++++++++++++++++++++++++-
 3 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 83b3c793144a1ef39edb72e8d4c438dbec13c179
Author:     panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Fri Jul 9 13:55:14 2021 +0300
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat Jul 10 00:40:11 2021 +0200

    Add Handler for BmpScalePart Read
    
    The handler separates MetaBmpScalePartAction::Read from metaact.hxx
    Read implementation is now in SvmReader.hxx
    
    Change-Id: I0c8585ca18f3904a798a51081257c238b27297e0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118672
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx
index 5757abe1c30c..fedaf58b9692 100644
--- a/include/vcl/filter/SvmReader.hxx
+++ b/include/vcl/filter/SvmReader.hxx
@@ -58,6 +58,7 @@ public:
     rtl::Reference<MetaAction> TextLineHandler();
     rtl::Reference<MetaAction> BmpHandler();
     rtl::Reference<MetaAction> BmpScaleHandler();
+    rtl::Reference<MetaAction> BmpScalePartHandler();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index f025ae6fac87..4c531977100f 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -796,6 +796,11 @@ public:
     const Size&         GetDestSize() const { return maDstSz; }
     const Point&        GetSrcPoint() const { return maSrcPt; }
     const Size&         GetSrcSize() const { return maSrcSz; }
+    void                SetBitmap(Bitmap& rBmp) { maBmp = rBmp; }
+    void                SetDestPoint(Point& rPt) { maDstPt = rPt; }
+    void                SetDestSize(Size& rSz) { maDstSz = rSz; }
+    void                SetSrcPoint(Point& rPt) { maSrcPt = rPt; }
+    void                SetSrcSize(Size& rSz) { maSrcSz = rSz; }
 };
 
 class VCL_DLLPUBLIC MetaBmpExAction final : public MetaAction
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index 91e4052dab33..ed75eb27893e 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -217,7 +217,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData)
             return BmpScaleHandler();
             break;
         case MetaActionType::BMPSCALEPART:
-            pAction = new MetaBmpScalePartAction;
+            return BmpScalePartHandler();
             break;
         case MetaActionType::BMPEX:
             pAction = new MetaBmpExAction;
@@ -872,4 +872,30 @@ rtl::Reference<MetaAction> SvmReader::BmpScaleHandler()
 
     return pAction;
 }
+
+rtl::Reference<MetaAction> SvmReader::BmpScalePartHandler()
+{
+    auto pAction = new MetaBmpScalePartAction();
+
+    VersionCompatRead aCompat(mrStream);
+    Bitmap aBmp;
+    ReadDIB(aBmp, mrStream, true);
+    TypeSerializer aSerializer(mrStream);
+    Point aDestPoint;
+    aSerializer.readPoint(aDestPoint);
+    Size aDestSize;
+    aSerializer.readSize(aDestSize);
+    Point aSrcPoint;
+    aSerializer.readPoint(aSrcPoint);
+    Size aSrcSize;
+    aSerializer.readSize(aSrcSize);
+
+    pAction->SetBitmap(aBmp);
+    pAction->SetDestPoint(aDestPoint);
+    pAction->SetDestSize(aDestSize);
+    pAction->SetSrcPoint(aSrcPoint);
+    pAction->SetSrcSize(aSrcSize);
+
+    return pAction;
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list