diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-01-04 19:43:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-01-05 10:50:07 +0000 |
commit | d6ded494dbb781d5539ab44fa8765eaf16275688 (patch) | |
tree | 955cd5e72fb7e837de9fc805a03282892d808b94 /vcl/unx/generic | |
parent | 4818e7d8d5b99cc9f74985572c113a10f0bbae3b (diff) |
move drawLine into CairoCommon and reuse from X11CairoSalGraphicsImpl
Change-Id: I6c667b4aa64c49ad18b7e9a2cd6cc43228369bd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145050
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx | 11 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.hxx | 4 |
4 files changed, 18 insertions, 5 deletions
diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx index 799327684e85..13156fc13295 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx @@ -125,6 +125,17 @@ bool X11CairoSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObje return true; } +void X11CairoSalGraphicsImpl::drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, + tools::Long nY2) +{ + cairo_t* cr = mrX11Common.getCairoContext(); + clipRegion(cr); + + CairoCommon::drawLine(cr, nullptr, mnPenColor, getAntiAlias(), nX1, nY1, nX2, nY2); + + X11Common::releaseCairoContext(cr); +} + bool X11CairoSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolygon& rPolyLine, double fTransparency, double fLineWidth, diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index d450b919d551..0b7bb51e2333 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -76,6 +76,8 @@ public: void clipRegion(cairo_t* cr) { CairoCommon::clipRegion(cr, maClipRegion); } + void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) override; + bool drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency) override; diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index d95d65f8d98e..b75a78fc002f 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -437,7 +437,7 @@ void X11SalGraphicsImpl::DrawLines(sal_uInt32 nPoints, if( bClose ) { if( rPoints[nPoints-1].x != rPoints[0].x || rPoints[nPoints-1].y != rPoints[0].y ) - drawLine( rPoints[nPoints-1].x, rPoints[nPoints-1].y, rPoints[0].x, rPoints[0].y ); + internalDrawLine( rPoints[nPoints-1].x, rPoints[nPoints-1].y, rPoints[0].x, rPoints[0].y ); } } @@ -1121,7 +1121,7 @@ void X11SalGraphicsImpl::drawPixel( tools::Long nX, tools::Long nY, Color nColor } } -void X11SalGraphicsImpl::drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) +void X11SalGraphicsImpl::internalDrawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) { if( mnPenColor != SALCOLOR_NONE ) { @@ -1174,7 +1174,7 @@ void X11SalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const Point* pPtAry ) if( 1 == nPoints ) drawPixel( pPtAry[0].getX(), pPtAry[0].getY() ); else - drawLine( pPtAry[0].getX(), pPtAry[0].getY(), + internalDrawLine( pPtAry[0].getX(), pPtAry[0].getY(), pPtAry[1].getX(), pPtAry[1].getY() ); } return; diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index 6858f582b1bf..033247685beb 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -103,6 +103,8 @@ private: void internalDrawPolyLine( sal_uInt32 nPoints, const Point* pPtAry, bool bClose ); + void internalDrawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ); + public: explicit X11SalGraphicsImpl(X11SalGraphics& rParent); @@ -151,8 +153,6 @@ public: virtual void drawPixel( tools::Long nX, tools::Long nY ) override; virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) override; - virtual void drawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 ) override; - virtual void drawRect( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; virtual void drawPolyLine( sal_uInt32 nPoints, const Point* pPtAry ) override; |