From 79522b8e63c6435331f3cbf623c25f0849d7fd43 Mon Sep 17 00:00:00 2001 From: panoskorovesis Date: Thu, 5 Aug 2021 09:54:02 +0300 Subject: Add Handler for GradientEx Write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The handler separates MetaGradientExAction::Write from metaact.hxx Write implementation is now in SvmWriter.hxx Change-Id: I984e21b7d4b19b16432cabe9709d41f07187f268 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120263 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- include/vcl/filter/SvmWriter.hxx | 1 + vcl/source/filter/svm/SvmWriter.cxx | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/vcl/filter/SvmWriter.hxx b/include/vcl/filter/SvmWriter.hxx index c1dccf57525b..c52b7387d79a 100644 --- a/include/vcl/filter/SvmWriter.hxx +++ b/include/vcl/filter/SvmWriter.hxx @@ -66,6 +66,7 @@ public: void MaskScaleHandler(MetaMaskScaleAction* pAction); void MaskScalePartHandler(MetaMaskScalePartAction* pAction); void GradientHandler(MetaGradientAction* pAction); + void GradientExHandler(MetaGradientExAction* pAction); void OverlineColorHandler(MetaOverlineColorAction* pAction); void TextAlignHandler(MetaTextAlignAction* pAction); void MapModeHandler(MetaMapModeAction* pAction); diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx index 3296221d6f11..8e9972e08a0d 100644 --- a/vcl/source/filter/svm/SvmWriter.cxx +++ b/vcl/source/filter/svm/SvmWriter.cxx @@ -270,6 +270,13 @@ void SvmWriter::MetaActionHandler(MetaAction* pAction, ImplMetaWriteData* pData) } break; + case MetaActionType::GRADIENTEX: + { + auto* pMetaAction = static_cast(pAction); + GradientExHandler(pMetaAction); + } + break; + case MetaActionType::OVERLINECOLOR: { auto* pMetaAction = static_cast(pAction); @@ -750,6 +757,20 @@ void SvmWriter::GradientHandler(MetaGradientAction* pAction) aSerializer.writeGradient(pAction->GetGradient()); } +void SvmWriter::GradientExHandler(MetaGradientExAction* pAction) +{ + mrStream.WriteUInt16(static_cast(pAction->GetType())); + VersionCompatWrite aCompat(mrStream, 1); + + // #i105373# see comment at MetaTransparentAction::Write + tools::PolyPolygon aNoCurvePolyPolygon; + pAction->GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon); + + WritePolyPolygon(mrStream, aNoCurvePolyPolygon); + TypeSerializer aSerializer(mrStream); + aSerializer.writeGradient(pAction->GetGradient()); +} + void SvmWriter::OverlineColorHandler(MetaOverlineColorAction* pAction) { mrStream.WriteUInt16(static_cast(pAction->GetType())); -- cgit