diff options
author | panoskorovesis <panoskorovesis@outlook.com> | 2021-07-26 10:23:00 +0300 |
---|---|---|
committer | panoskorovesis <panoskorovesis@outlook.com> | 2021-07-26 10:24:22 +0300 |
commit | 212fba1c1871f1d4b81cb21169e2451bba004888 (patch) | |
tree | 941871b0e564d9e0a25a73074f527b8edc082c0b | |
parent | Add Handler for Point Write (diff) | |
download | core-feature/gsoc-svm-writer.tar.gz core-feature/gsoc-svm-writer.zip |
Simplify SvmWriter Code
feature/gsoc-svm-writer
There is no need to call ActionHandler for each metaact derived class.
Change-Id: Ieaf6834c246e674845cb52fe4025ccbe827fa0a4
-rw-r--r-- | include/vcl/filter/SvmWriter.hxx | 8 | ||||
-rw-r--r-- | vcl/source/filter/svm/SvmWriter.cxx | 27 |
2 files changed, 18 insertions, 17 deletions
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()); |