From 212fba1c1871f1d4b81cb21169e2451bba004888 Mon Sep 17 00:00:00 2001 From: panoskorovesis Date: Mon, 26 Jul 2021 10:23:00 +0300 Subject: Simplify SvmWriter Code There is no need to call ActionHandler for each metaact derived class. Change-Id: Ieaf6834c246e674845cb52fe4025ccbe827fa0a4 --- include/vcl/filter/SvmWriter.hxx | 8 ++++---- 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(pAct->GetType()); + MetaActionType nType = static_cast(pAction->GetType()); switch (nType) { case MetaActionType::NONE: { - ActionHandler(pAct->GetType()); + auto* pMetaAction = static_cast(pAction); + ActionHandler(pMetaAction); } break; case MetaActionType::PIXEL: { - auto* pMetaAction = static_cast(pAct); + auto* pMetaAction = static_cast(pAction); PixelHandler(pMetaAction); } break; case MetaActionType::POINT: { - auto pMetaAction = static_cast(pAct); + auto pMetaAction = static_cast(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(nType)); + mrStream.WriteUInt16(static_cast(pAction->GetType())); } -void SvmWriter::PixelHandler(MetaPixelAction* pAct) +void SvmWriter::PixelHandler(MetaPixelAction* pAction) { - ActionHandler(pAct->GetType()); + mrStream.WriteUInt16(static_cast(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(pAct->GetType())); VersionCompatWrite aCompat(mrStream, 1); TypeSerializer aSerializer(mrStream); aSerializer.writePoint(pAct->GetPoint()); -- cgit v1.2.3