diff options
author | Adrien Ollier <adr.ollier@hotmail.fr> | 2019-06-20 18:58:39 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-07-02 09:18:09 +0200 |
commit | c5e7cba6fe712aecc7131be550de37b93db27b18 (patch) | |
tree | 19688304a6f9cf1996e20a084324b461a4ee4696 | |
parent | d00ee2cb0dce84173c035cf89f332c150dd02d00 (diff) |
tdf#74702: cleans OutputDevice::DrawHatchLine up
Change-Id: Ie90e0f75018edee178f1f02056e59b35956c4142
Signed-off-by: Adrien Ollier <adr.ollier@hotmail.fr>
Reviewed-on: https://gerrit.libreoffice.org/74464
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | include/vcl/outdev.hxx | 3 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl2.cxx | 5 | ||||
-rw-r--r-- | vcl/source/outdev/hatch.cxx | 17 |
4 files changed, 16 insertions, 10 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index e23e3552fe0c..959a8ccdc036 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -729,6 +729,9 @@ public: void DrawLine( const Point& rStartPt, const Point& rEndPt, const LineInfo& rLineInfo ); +protected: + virtual void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint); + private: /** Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area) diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index b615ac24feb9..c728b16c21f4 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -596,6 +596,7 @@ public: protected: void ImplClearFontData(bool bNewFontLists) override; void ClipRegionIntersectRectangle(vcl::Region&) override; + void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint) override; private: MapMode m_aMapMode; // PDFWriterImpl scaled units diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index a1bc6472fbfd..bf24fd2978dc 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -2001,6 +2001,11 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess const * i_pBitmap ) } } +void PDFWriterImpl::DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint) +{ + drawLine(rStartPoint, rEndPoint); +} + static bool lcl_canUsePDFAxialShading(const Gradient& rGradient) { switch (rGradient.GetStyle()) { diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index 89319393c8b7..5fba38ad5c25 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -394,18 +394,15 @@ void OutputDevice::DrawHatchLine( const tools::Line& rLine, const tools::PolyPol else { for( long i = 0; i < nPCounter; i += 2 ) - { - if (GetOutDevType() == OUTDEV_PDF) - static_cast<vcl::PDFWriterImpl*>(this)->drawLine(pPtBuffer[ i ], pPtBuffer[ i+1 ]); - else - { - const Point aPt1( ImplLogicToDevicePixel( pPtBuffer[ i ] ) ); - const Point aPt2( ImplLogicToDevicePixel( pPtBuffer[ i + 1 ] ) ); - mpGraphics->DrawLine( aPt1.X(), aPt1.Y(), aPt2.X(), aPt2.Y(), this ); - } - } + DrawHatchLine_DrawLine(pPtBuffer[i], pPtBuffer[i+1]); } } } +void OutputDevice::DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& rEndPoint) +{ + Point aPt1{ImplLogicToDevicePixel(rStartPoint)}, aPt2{ImplLogicToDevicePixel(rEndPoint)}; + mpGraphics->DrawLine(aPt1.X(), aPt1.Y(), aPt2.X(), aPt2.Y(), this); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |