summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-01-04 20:02:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2023-01-05 10:50:25 +0000
commit39038ed8dac3d896d261a76e11f9004f7d68f989 (patch)
tree2d5cbaf0e6344632daf4c43b01a2375882f10623 /vcl/unx
parentd6ded494dbb781d5539ab44fa8765eaf16275688 (diff)
move drawPixel into CairoCommon and reuse from X11CairoSalGraphicsImpl
Change-Id: I0638403ab54039793e851583937b09674f05c36d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145051 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx15
-rw-r--r--vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx3
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.cxx32
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.hxx6
4 files changed, 21 insertions, 35 deletions
diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx
index 13156fc13295..f1b7f172150b 100644
--- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx
+++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx
@@ -125,6 +125,21 @@ bool X11CairoSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObje
return true;
}
+void X11CairoSalGraphicsImpl::drawPixel(tools::Long nX, tools::Long nY)
+{
+ drawPixel(nX, nY, mnPenColor);
+}
+
+void X11CairoSalGraphicsImpl::drawPixel(tools::Long nX, tools::Long nY, Color nColor)
+{
+ cairo_t* cr = mrX11Common.getCairoContext();
+ clipRegion(cr);
+
+ CairoCommon::drawPixel(cr, nullptr, nColor, nX, nY);
+
+ X11Common::releaseCairoContext(cr);
+}
+
void X11CairoSalGraphicsImpl::drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2,
tools::Long nY2)
{
diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx
index 0b7bb51e2333..7462089ab29f 100644
--- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx
+++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx
@@ -76,6 +76,9 @@ public:
void clipRegion(cairo_t* cr) { CairoCommon::clipRegion(cr, maClipRegion); }
+ void drawPixel(tools::Long nX, tools::Long nY) override;
+ void drawPixel(tools::Long nX, tools::Long nY, Color nColor) override;
+
void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) override;
bool drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index b75a78fc002f..68d44afdb684 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -1087,40 +1087,12 @@ void X11SalGraphicsImpl::SetXORMode( bool bSet, bool )
}
}
-void X11SalGraphicsImpl::drawPixel( tools::Long nX, tools::Long nY )
+void X11SalGraphicsImpl::internalDrawPixel( tools::Long nX, tools::Long nY )
{
if( mnPenColor != SALCOLOR_NONE )
XDrawPoint( mrParent.GetXDisplay(), mrParent.GetDrawable(), SelectPen(), nX, nY );
}
-void X11SalGraphicsImpl::drawPixel( tools::Long nX, tools::Long nY, Color nColor )
-{
- if( nColor == SALCOLOR_NONE )
- return;
-
- Display *pDisplay = mrParent.GetXDisplay();
-
- if( (mnPenColor == SALCOLOR_NONE) && !mbPenGC )
- {
- SetLineColor( nColor );
- XDrawPoint( pDisplay, mrParent.GetDrawable(), SelectPen(), nX, nY );
- mnPenColor = SALCOLOR_NONE;
- mbPenGC = False;
- }
- else
- {
- GC pGC = SelectPen();
-
- if( nColor != mnPenColor )
- XSetForeground( pDisplay, pGC, mrParent.GetPixel( nColor ) );
-
- XDrawPoint( pDisplay, mrParent.GetDrawable(), pGC, nX, nY );
-
- if( nColor != mnPenColor )
- XSetForeground( pDisplay, pGC, mnPenPixel );
- }
-}
-
void X11SalGraphicsImpl::internalDrawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 )
{
if( mnPenColor != SALCOLOR_NONE )
@@ -1172,7 +1144,7 @@ void X11SalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const Point* pPtAry )
if( !mbXORMode )
{
if( 1 == nPoints )
- drawPixel( pPtAry[0].getX(), pPtAry[0].getY() );
+ internalDrawPixel( pPtAry[0].getX(), pPtAry[0].getY() );
else
internalDrawLine( pPtAry[0].getX(), pPtAry[0].getY(),
pPtAry[1].getX(), pPtAry[1].getY() );
diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx
index 033247685beb..0963a85892cd 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -102,7 +102,7 @@ private:
const SalBitmap& rTransparentBitmap );
void internalDrawPolyLine( sal_uInt32 nPoints, const Point* pPtAry, bool bClose );
-
+ void internalDrawPixel( tools::Long nX, tools::Long nY );
void internalDrawLine( tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 );
public:
@@ -149,10 +149,6 @@ public:
// set fill color for raster operations
virtual void SetROPFillColor( SalROPColor nROPColor ) override;
- // draw --> LineColor and FillColor and RasterOp and ClipRegion
- virtual void drawPixel( tools::Long nX, tools::Long nY ) override;
- virtual void drawPixel( tools::Long nX, tools::Long nY, Color nColor ) 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;