include/vcl/filter/SvmReader.hxx | 2 + include/vcl/metaact.hxx | 5 ++++ vcl/source/filter/svm/SvmReader.cxx | 42 ++++++++++++++++++++++++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-)
New commits: commit 19441313b37eb5d0a11c8a929a38c079fa7ef291 Author: panoskorovesis <panoskorove...@outlook.com> AuthorDate: Fri Jul 9 13:36:54 2021 +0300 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sat Jul 10 00:39:47 2021 +0200 Add Handler for BmpScale Read The handler separates MetaBmpScaleAction::Read from metaact.hxx Read implementation is now in SvmReader.hxx Change-Id: I1641d11d6fbe49d023b758d7e6aaeabbc667030b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118667 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx index c34c7db1df4e..5757abe1c30c 100644 --- a/include/vcl/filter/SvmReader.hxx +++ b/include/vcl/filter/SvmReader.hxx @@ -57,6 +57,7 @@ public: rtl::Reference<MetaAction> TextRectHandler(ImplMetaReadData* pData); rtl::Reference<MetaAction> TextLineHandler(); rtl::Reference<MetaAction> BmpHandler(); + rtl::Reference<MetaAction> BmpScaleHandler(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index 464f2b32777e..f025ae6fac87 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -755,6 +755,9 @@ public: const Bitmap& GetBitmap() const { return maBmp; } const Point& GetPoint() const { return maPt; } const Size& GetSize() const { return maSz; } + void SetBitmap(Bitmap& rBmp) { maBmp = rBmp; } + void SetPoint(Point& rPt) { maPt = rPt; } + void SetSize(Size& rSz) { maSz = rSz; } }; class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaBmpScalePartAction final : public MetaAction diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx index 8f2c503ffc7b..91e4052dab33 100644 --- a/vcl/source/filter/svm/SvmReader.cxx +++ b/vcl/source/filter/svm/SvmReader.cxx @@ -214,7 +214,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData) return BmpHandler(); break; case MetaActionType::BMPSCALE: - pAction = new MetaBmpScaleAction; + return BmpScaleHandler(); break; case MetaActionType::BMPSCALEPART: pAction = new MetaBmpScalePartAction; @@ -852,4 +852,24 @@ rtl::Reference<MetaAction> SvmReader::BmpHandler() return pAction; } + +rtl::Reference<MetaAction> SvmReader::BmpScaleHandler() +{ + auto pAction = new MetaBmpScaleAction(); + + VersionCompatRead aCompat(mrStream); + Bitmap aBmp; + ReadDIB(aBmp, mrStream, true); + TypeSerializer aSerializer(mrStream); + Point aPoint; + aSerializer.readPoint(aPoint); + Size aSz; + aSerializer.readSize(aSz); + + pAction->SetBitmap(aBmp); + pAction->SetPoint(aPoint); + pAction->SetSize(aSz); + + return pAction; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 10d983f57f0bc1ec665d6e2bbfa1d9038446e7f9 Author: panoskorovesis <panoskorove...@outlook.com> AuthorDate: Fri Jul 9 13:28:47 2021 +0300 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sat Jul 10 00:39:32 2021 +0200 Add Handler for Bmp Read The handler separates MetaBmpAction::Read from metaact.hxx Read implementation is now in SvmReader.hxx Change-Id: I60b9c2fbe9c5e23e0f1a05c4aa96565e3d14c403 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118665 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx index fd8d81ce7295..c34c7db1df4e 100644 --- a/include/vcl/filter/SvmReader.hxx +++ b/include/vcl/filter/SvmReader.hxx @@ -56,6 +56,7 @@ public: rtl::Reference<MetaAction> StretchTextHandler(ImplMetaReadData* pData); rtl::Reference<MetaAction> TextRectHandler(ImplMetaReadData* pData); rtl::Reference<MetaAction> TextLineHandler(); + rtl::Reference<MetaAction> BmpHandler(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index 731e901bd622..464f2b32777e 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -720,6 +720,8 @@ public: const Bitmap& GetBitmap() const { return maBmp; } const Point& GetPoint() const { return maPt; } + void SetBitmap(Bitmap& rBmp) { maBmp = rBmp; } + void SetPoint(Point& rPt) { maPt = rPt; } }; class VCL_DLLPUBLIC MetaBmpScaleAction final : public MetaAction diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx index 43cd2e0e354a..8f2c503ffc7b 100644 --- a/vcl/source/filter/svm/SvmReader.cxx +++ b/vcl/source/filter/svm/SvmReader.cxx @@ -21,6 +21,7 @@ #include <sal/log.hxx> #include <tools/stream.hxx> #include <tools/vcompat.hxx> +#include <vcl/dibtools.hxx> #include <vcl/TypeSerializer.hxx> #include <vcl/gdimtf.hxx> #include <vcl/metaact.hxx> @@ -210,7 +211,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData) return TextLineHandler(); break; case MetaActionType::BMP: - pAction = new MetaBmpAction; + return BmpHandler(); break; case MetaActionType::BMPSCALE: pAction = new MetaBmpScaleAction; @@ -834,4 +835,21 @@ rtl::Reference<MetaAction> SvmReader::TextLineHandler() return pAction; } + +rtl::Reference<MetaAction> SvmReader::BmpHandler() +{ + auto pAction = new MetaBmpAction(); + + VersionCompatRead aCompat(mrStream); + Bitmap aBmp; + ReadDIB(aBmp, mrStream, true); + TypeSerializer aSerializer(mrStream); + Point aPoint; + aSerializer.readPoint(aPoint); + + pAction->SetBitmap(aBmp); + pAction->SetPoint(aPoint); + + return pAction; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits