From 84cc3180c8d42eb8528840d68fe52055f884120b Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Wed, 28 Aug 2024 22:01:08 +0100 Subject: [PATCH] tdf#148526 sdext,pdfimport: rendering::PathJoinType to B2DLineJoin Pdfimport is one of the few none render pieces of code to use css::rendering::PathJoinType, switch to using basegfx::B2DLineJoin instead. Use that type consistently instead of throwing in sal_Int8's with it. Change-Id: Ie1384a06558925c796ce6c83b458b4c150bcecc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172925 Tested-by: Jenkins Reviewed-by: David Gilbert --- sdext/qa/unit/pdfimport.cxx | 4 ++-- sdext/source/pdfimport/inc/contentsink.hxx | 3 ++- sdext/source/pdfimport/inc/pdfihelper.hxx | 12 ++++++------ sdext/source/pdfimport/inc/pdfiprocessor.hxx | 3 ++- sdext/source/pdfimport/tree/pdfiprocessor.cxx | 3 ++- sdext/source/pdfimport/wrapper/wrapper.cxx | 10 +++++----- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/sdext/qa/unit/pdfimport.cxx b/sdext/qa/unit/pdfimport.cxx index ee3b8b494db2..9c9c49f138a6 100644 --- a/sdext/qa/unit/pdfimport.cxx +++ b/sdext/qa/unit/pdfimport.cxx @@ -170,7 +170,7 @@ namespace getCurrentContext().Flatness = nFlatness; } - virtual void setLineJoin(sal_Int8 nJoin) override + virtual void setLineJoin(basegfx::B2DLineJoin nJoin) override { getCurrentContext().LineJoin = nJoin; } @@ -261,7 +261,7 @@ namespace CPPUNIT_ASSERT_EQUAL_MESSAGE( "Blend mode is normal", rendering::BlendMode::NORMAL, rContext.BlendMode ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Join type is round", - rendering::PathJoinType::ROUND, rContext.LineJoin ); + basegfx::B2DLineJoin::Round, rContext.LineJoin ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Cap type is butt", rendering::PathCapType::BUTT, rContext.LineCap ); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Line miter limit is 10", diff --git a/sdext/source/pdfimport/inc/contentsink.hxx b/sdext/source/pdfimport/inc/contentsink.hxx index d251aef623bc..3dafd7be628c 100644 --- a/sdext/source/pdfimport/inc/contentsink.hxx +++ b/sdext/source/pdfimport/inc/contentsink.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_CONTENTSINK_HXX #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_CONTENTSINK_HXX +#include #include #include #include @@ -117,7 +118,7 @@ namespace pdfi virtual void setTransformation( const css::geometry::AffineMatrix2D& rMatrix ) = 0; virtual void setLineDash( const css::uno::Sequence& dashes, double start ) = 0; - virtual void setLineJoin( sal_Int8 lineJoin ) = 0; + virtual void setLineJoin( basegfx::B2DLineJoin lineJoin ) = 0; virtual void setLineCap( sal_Int8 lineCap ) = 0; virtual void setMiterLimit(double) = 0; virtual void setLineWidth(double) = 0; diff --git a/sdext/source/pdfimport/inc/pdfihelper.hxx b/sdext/source/pdfimport/inc/pdfihelper.hxx index 1b6ba6b0ca04..a4414cd4809d 100644 --- a/sdext/source/pdfimport/inc/pdfihelper.hxx +++ b/sdext/source/pdfimport/inc/pdfihelper.hxx @@ -27,8 +27,8 @@ #include #include #include +#include #include -#include #include #include @@ -98,7 +98,7 @@ namespace pdfi { css::rendering::ARGBColor LineColor; css::rendering::ARGBColor FillColor; - sal_Int8 LineJoin; + basegfx::B2DLineJoin LineJoin; sal_Int8 LineCap; sal_Int8 BlendMode; double Flatness; @@ -113,7 +113,7 @@ namespace pdfi GraphicsContext() : LineColor(), FillColor(), - LineJoin(0), + LineJoin(basegfx::B2DLineJoin::NONE), LineCap(0), BlendMode(0), Flatness(0.0), @@ -154,11 +154,11 @@ namespace pdfi switch (LineJoin) { default: - case css::rendering::PathJoinType::MITER: + case basegfx::B2DLineJoin::Miter: return u"miter"_ustr; - case css::rendering::PathJoinType::ROUND: + case basegfx::B2DLineJoin::Round: return u"round"_ustr; - case css::rendering::PathJoinType::BEVEL: + case basegfx::B2DLineJoin::Bevel: return u"bevel"_ustr; } } diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx b/sdext/source/pdfimport/inc/pdfiprocessor.hxx index 6db7d9d6eb46..93b54f5e8a13 100644 --- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx +++ b/sdext/source/pdfimport/inc/pdfiprocessor.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_PDFIPROCESSOR_HXX #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_PDFIPROCESSOR_HXX +#include #include #include #include @@ -100,7 +101,7 @@ namespace pdfi virtual void setTransformation( const css::geometry::AffineMatrix2D& rMatrix ) override; virtual void setLineDash( const css::uno::Sequence& dashes, double start ) override; - virtual void setLineJoin(sal_Int8) override; + virtual void setLineJoin(basegfx::B2DLineJoin) override; virtual void setLineCap(sal_Int8) override; virtual void setMiterLimit(double) override; virtual void setLineWidth(double) override; diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index cb225560071f..0d0fe733cd05 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -114,7 +115,7 @@ void PDFIProcessor::setLineDash( const uno::Sequence& dashes, comphelper::sequenceToContainer(rContext.DashArray,dashes); } -void PDFIProcessor::setLineJoin(sal_Int8 nJoin) +void PDFIProcessor::setLineJoin(basegfx::B2DLineJoin nJoin) { getCurrentContext().LineJoin = nJoin; } diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 5f5fe296e947..ae9c9b3bf307 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -52,6 +51,7 @@ #include #include #include +#include #include #include @@ -431,13 +431,13 @@ void LineParser::readLineDash() void LineParser::readLineJoin() { - sal_Int8 nJoin(rendering::PathJoinType::MITER); + basegfx::B2DLineJoin nJoin(basegfx::B2DLineJoin::Miter); switch( readInt32() ) { default: - case 0: nJoin = rendering::PathJoinType::MITER; break; - case 1: nJoin = rendering::PathJoinType::ROUND; break; - case 2: nJoin = rendering::PathJoinType::BEVEL; break; + case 0: nJoin = basegfx::B2DLineJoin::Miter; break; + case 1: nJoin = basegfx::B2DLineJoin::Round; break; + case 2: nJoin = basegfx::B2DLineJoin::Bevel; break; } m_parser.m_pSink->setLineJoin(nJoin); }