[Libreoffice-commits] core.git: Branch 'feature/gsoc-svm-writer' - 2 commits - include/vcl vcl/source
panoskorovesis (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 26 07:29:06 UTC 2021
include/vcl/filter/SvmWriter.hxx | 7 ++++---
vcl/source/filter/svm/SvmWriter.cxx | 35 +++++++++++++++++++++++++----------
2 files changed, 29 insertions(+), 13 deletions(-)
New commits:
commit 212fba1c1871f1d4b81cb21169e2451bba004888
Author: panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Mon Jul 26 10:23:00 2021 +0300
Commit: panoskorovesis <panoskorovesis at outlook.com>
CommitDate: Mon Jul 26 10:24:22 2021 +0300
Simplify SvmWriter Code
There is no need to call ActionHandler for each metaact derived class.
Change-Id: Ieaf6834c246e674845cb52fe4025ccbe827fa0a4
diff --git a/include/vcl/filter/SvmWriter.hxx b/include/vcl/filter/SvmWriter.hxx
index 3ba7553adff5..3273e12e7fe2 100644
--- a/include/vcl/filter/SvmWriter.hxx
+++ b/include/vcl/filter/SvmWriter.hxx
@@ -37,8 +37,8 @@ public:
SvmWriter(SvStream& rIStm);
SvStream& Write(GDIMetaFile& rMetaFile);
- void MetaActionHandler(MetaAction* pAct, ImplMetaWriteData* pData);
- void ActionHandler(MetaActionType nType);
- void PixelHandler(MetaPixelAction* pAct);
- void PointHandler(MetaPointAction* pAct);
+ void MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData);
+ void ActionHandler(MetaAction* pAction);
+ void PixelHandler(MetaPixelAction* pAction);
+ void PointHandler(MetaPointAction* pAction);
};
\ No newline at end of file
diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx
index 8733e493b254..89dbe3dfb3a7 100644
--- a/vcl/source/filter/svm/SvmWriter.cxx
+++ b/vcl/source/filter/svm/SvmWriter.cxx
@@ -68,51 +68,52 @@ SvStream& SvmWriter::Write(GDIMetaFile& rMetaFile)
return mrStream;
}
-void SvmWriter::MetaActionHandler(MetaAction* pAct, ImplMetaWriteData* pData)
+void SvmWriter::MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData)
{
- MetaActionType nType = static_cast<MetaActionType>(pAct->GetType());
+ MetaActionType nType = static_cast<MetaActionType>(pAction->GetType());
switch (nType)
{
case MetaActionType::NONE:
{
- ActionHandler(pAct->GetType());
+ auto* pMetaAction = static_cast<MetaAction*>(pAction);
+ ActionHandler(pMetaAction);
}
break;
case MetaActionType::PIXEL:
{
- auto* pMetaAction = static_cast<MetaPixelAction*>(pAct);
+ auto* pMetaAction = static_cast<MetaPixelAction*>(pAction);
PixelHandler(pMetaAction);
}
break;
case MetaActionType::POINT:
{
- auto pMetaAction = static_cast<MetaPointAction*>(pAct);
+ auto pMetaAction = static_cast<MetaPointAction*>(pAction);
PointHandler(pMetaAction);
}
break;
default:
- pAct->Write(mrStream, pData);
+ pAction->Write(mrStream, pData);
}
}
-void SvmWriter::ActionHandler(MetaActionType nType)
+void SvmWriter::ActionHandler(MetaAction* pAction)
{
- mrStream.WriteUInt16(static_cast<sal_uInt16>(nType));
+ mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
}
-void SvmWriter::PixelHandler(MetaPixelAction* pAct)
+void SvmWriter::PixelHandler(MetaPixelAction* pAction)
{
- ActionHandler(pAct->GetType());
+ mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
VersionCompatWrite aCompat(mrStream, 1);
TypeSerializer aSerializer(mrStream);
- aSerializer.writePoint(pAct->GetPoint());
- WriteColor(pAct->GetColor());
+ aSerializer.writePoint(pAction->GetPoint());
+ WriteColor(pAction->GetColor());
}
void SvmWriter::PointHandler(MetaPointAction* pAct)
{
- ActionHandler(pAct->GetType());
+ mrStream.WriteUInt16(static_cast<sal_uInt16>(pAct->GetType()));
VersionCompatWrite aCompat(mrStream, 1);
TypeSerializer aSerializer(mrStream);
aSerializer.writePoint(pAct->GetPoint());
commit 0d7afd98e1838480f0f922e31f9ed4718209485b
Author: panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Sat Jul 17 12:44:05 2021 +0300
Commit: panoskorovesis <panoskorovesis at outlook.com>
CommitDate: Sat Jul 17 12:44:05 2021 +0300
Add Handler for Point Write
The handler separates MetaPointAction::Read from metaact.hxx
Write implementation is now in SvmWriter.hxx
Change-Id: I805d092e0a932cf1e9d9d7d0c7fac7d9dd9cbd6e
diff --git a/include/vcl/filter/SvmWriter.hxx b/include/vcl/filter/SvmWriter.hxx
index 5b57d969b80b..3ba7553adff5 100644
--- a/include/vcl/filter/SvmWriter.hxx
+++ b/include/vcl/filter/SvmWriter.hxx
@@ -40,4 +40,5 @@ public:
void MetaActionHandler(MetaAction* pAct, ImplMetaWriteData* pData);
void ActionHandler(MetaActionType nType);
void PixelHandler(MetaPixelAction* pAct);
+ void PointHandler(MetaPointAction* pAct);
};
\ No newline at end of file
diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx
index b4c373a16946..8733e493b254 100644
--- a/vcl/source/filter/svm/SvmWriter.cxx
+++ b/vcl/source/filter/svm/SvmWriter.cxx
@@ -85,6 +85,12 @@ void SvmWriter::MetaActionHandler(MetaAction* pAct, ImplMetaWriteData* pData)
PixelHandler(pMetaAction);
}
break;
+ case MetaActionType::POINT:
+ {
+ auto pMetaAction = static_cast<MetaPointAction*>(pAct);
+ PointHandler(pMetaAction);
+ }
+ break;
default:
pAct->Write(mrStream, pData);
}
@@ -103,4 +109,12 @@ void SvmWriter::PixelHandler(MetaPixelAction* pAct)
aSerializer.writePoint(pAct->GetPoint());
WriteColor(pAct->GetColor());
}
+
+void SvmWriter::PointHandler(MetaPointAction* pAct)
+{
+ ActionHandler(pAct->GetType());
+ VersionCompatWrite aCompat(mrStream, 1);
+ TypeSerializer aSerializer(mrStream);
+ aSerializer.writePoint(pAct->GetPoint());
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list