summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/headless/CairoCommon.cxx14
-rw-r--r--vcl/headless/SvpGraphicsBackend.cxx11
-rw-r--r--vcl/inc/headless/CairoCommon.hxx3
-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
7 files changed, 41 insertions, 43 deletions
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 9f890067b7e9..5781eff048e8 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -609,6 +609,20 @@ void CairoCommon::clipRegion(cairo_t* cr, const vcl::Region& rClipRegion)
void CairoCommon::clipRegion(cairo_t* cr) { CairoCommon::clipRegion(cr, m_aClipRegion); }
+void CairoCommon::drawPixel(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor,
+ tools::Long nX, tools::Long nY)
+{
+ if (rLineColor == SALCOLOR_NONE)
+ return;
+
+ cairo_rectangle(cr, nX, nY, 1, 1);
+ CairoCommon::applyColor(cr, rLineColor, 0.0);
+ cairo_fill(cr);
+
+ if (pExtents)
+ *pExtents = getClippedFillDamage(cr);
+}
+
void CairoCommon::drawLine(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor,
bool bAntiAlias, tools::Long nX1, tools::Long nY1, tools::Long nX2,
tools::Long nY2)
diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx
index b1920f576d81..84d6aa1dcd09 100644
--- a/vcl/headless/SvpGraphicsBackend.cxx
+++ b/vcl/headless/SvpGraphicsBackend.cxx
@@ -100,22 +100,17 @@ void SvpGraphicsBackend::SetROPFillColor(SalROPColor nROPColor)
void SvpGraphicsBackend::drawPixel(tools::Long nX, tools::Long nY)
{
- if (m_rCairoCommon.m_aLineColor != SALCOLOR_NONE)
- {
- drawPixel(nX, nY, m_rCairoCommon.m_aLineColor);
- }
+ drawPixel(nX, nY, m_rCairoCommon.m_aLineColor);
}
void SvpGraphicsBackend::drawPixel(tools::Long nX, tools::Long nY, Color aColor)
{
cairo_t* cr = m_rCairoCommon.getCairoContext(true, getAntiAlias());
+ basegfx::B2DRange extents;
m_rCairoCommon.clipRegion(cr);
- cairo_rectangle(cr, nX, nY, 1, 1);
- CairoCommon::applyColor(cr, aColor, 0.0);
- cairo_fill(cr);
+ CairoCommon::drawPixel(cr, &extents, aColor, nX, nY);
- basegfx::B2DRange extents = getClippedFillDamage(cr);
m_rCairoCommon.releaseCairoContext(cr, true, extents);
}
diff --git a/vcl/inc/headless/CairoCommon.hxx b/vcl/inc/headless/CairoCommon.hxx
index 029060c31962..743c962c9423 100644
--- a/vcl/inc/headless/CairoCommon.hxx
+++ b/vcl/inc/headless/CairoCommon.hxx
@@ -152,6 +152,9 @@ struct VCL_DLLPUBLIC CairoCommon
void clipRegion(cairo_t* cr);
static void clipRegion(cairo_t* cr, const vcl::Region& rClipRegion);
+ static void drawPixel(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor,
+ tools::Long nX, tools::Long nY);
+
static void drawLine(cairo_t* cr, basegfx::B2DRange* pExtents, const Color& rLineColor,
bool bAntiAlias, tools::Long nX1, tools::Long nY1, tools::Long nX2,
tools::Long nY2);
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;