diff options
author | Dr. David Alan Gilbert <dave@treblig.org> | 2024-08-28 22:01:08 +0100 |
---|---|---|
committer | David Gilbert <freedesktop@treblig.org> | 2024-10-18 00:50:06 +0200 |
commit | 84cc3180c8d42eb8528840d68fe52055f884120b (patch) | |
tree | 2a2cce44fe0dba8b822e85e19eb63ca14ab36def /sdext | |
parent | 53d5b3119feff3fe6653a38d13e21e6674055211 (diff) |
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 <freedesktop@treblig.org>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/qa/unit/pdfimport.cxx | 4 | ||||
-rw-r--r-- | sdext/source/pdfimport/inc/contentsink.hxx | 3 | ||||
-rw-r--r-- | sdext/source/pdfimport/inc/pdfihelper.hxx | 12 | ||||
-rw-r--r-- | sdext/source/pdfimport/inc/pdfiprocessor.hxx | 3 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/pdfiprocessor.cxx | 3 | ||||
-rw-r--r-- | 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 <basegfx/vector/b2enums.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/rendering/ARGBColor.hpp> @@ -117,7 +118,7 @@ namespace pdfi virtual void setTransformation( const css::geometry::AffineMatrix2D& rMatrix ) = 0; virtual void setLineDash( const css::uno::Sequence<double>& 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 <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/vector/b2enums.hxx> #include <com/sun/star/rendering/PathCapType.hpp> -#include <com/sun/star/rendering/PathJoinType.hpp> #include <unordered_map> #include <vector> @@ -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 <com/sun/star/drawing/LineJoint.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/geometry/RealSize2D.hpp> @@ -100,7 +101,7 @@ namespace pdfi virtual void setTransformation( const css::geometry::AffineMatrix2D& rMatrix ) override; virtual void setLineDash( const css::uno::Sequence<double>& 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 <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygoncutter.hxx> #include <basegfx/utils/canvastools.hxx> +#include <basegfx/vector/b2enums.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <i18nutil/unicode.hxx> #include <o3tl/string_view.hxx> @@ -114,7 +115,7 @@ void PDFIProcessor::setLineDash( const uno::Sequence<double>& 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 <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/rendering/PathCapType.hpp> -#include <com/sun/star/rendering/PathJoinType.hpp> #include <com/sun/star/rendering/XPolyPolygon2D.hpp> #include <com/sun/star/geometry/Matrix2D.hpp> #include <com/sun/star/geometry/AffineMatrix2D.hpp> @@ -52,6 +51,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/utils/unopolypolygon.hxx> +#include <basegfx/vector/b2enums.hxx> #include <vcl/metric.hxx> #include <vcl/font.hxx> @@ -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); } |