[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/opengl vcl/quartz vcl/source vcl/unx vcl/win

Jan-Marek Glogowski glogow at fbihome.de
Mon Oct 30 20:21:00 UTC 2017


 vcl/headless/svpgdi.cxx                        |    2 
 vcl/headless/svptext.cxx                       |    2 
 vcl/inc/PhysicalFontFace.hxx                   |    2 
 vcl/inc/headless/svpgdi.hxx                    |    4 -
 vcl/inc/openglgdiimpl.hxx                      |    2 
 vcl/inc/quartz/salgdi.h                        |    6 -
 vcl/inc/salgdi.hxx                             |    4 -
 vcl/inc/salgdiimpl.hxx                         |    2 
 vcl/inc/textrender.hxx                         |    2 
 vcl/inc/unx/cairotextrender.hxx                |    2 
 vcl/inc/unx/freetype_glyphcache.hxx            |    2 
 vcl/inc/unx/genpspgraphics.h                   |    4 -
 vcl/inc/unx/salgdi.h                           |    4 -
 vcl/inc/win/salgdi.h                           |    6 -
 vcl/opengl/gdiimpl.cxx                         |    2 
 vcl/quartz/ctfonts.cxx                         |    2 
 vcl/quartz/salgdi.cxx                          |    2 
 vcl/quartz/salgdicommon.cxx                    |    2 
 vcl/source/gdi/pdfwriter_impl.cxx              |    2 
 vcl/source/gdi/pdfwriter_impl.hxx              |    2 
 vcl/unx/generic/gdi/cairotextrender.cxx        |    2 
 vcl/unx/generic/gdi/font.cxx                   |    2 
 vcl/unx/generic/gdi/gdiimpl.cxx                |    2 
 vcl/unx/generic/gdi/gdiimpl.hxx                |    2 
 vcl/unx/generic/gdi/salgdi.cxx                 |    2 
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |    2 
 vcl/unx/generic/print/genpspgraphics.cxx       |   12 +--
 vcl/win/gdi/gdiimpl.cxx                        |   99 ++++---------------------
 vcl/win/gdi/gdiimpl.hxx                        |    3 
 vcl/win/gdi/salfont.cxx                        |    2 
 vcl/win/gdi/salgdi.cxx                         |    2 
 vcl/win/gdi/winlayout.cxx                      |    2 
 32 files changed, 63 insertions(+), 125 deletions(-)

New commits:
commit 620492ca19d1e5c34312b49f3d4fef24a928412a
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Oct 27 10:14:42 2017 +0200

    Constify some VCL interface functions
    
    This drops the bPaintEnd optimization for vertical and horizontal
    lines on Windows, where Polyline and LineTo exclude painting the
    last pixel of the line. Instead we just always set the last pixel.
    
    It also merges the various "SetPixel" call sites into a common
    drawPixelImpl function.
    
    Change-Id: I01cc3c01c908ba74f7978fa90eaaf8d88f923ae3
    Reviewed-on: https://gerrit.libreoffice.org/43939
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 9032ec5e97fa..b9c7ba9a11f5 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -577,7 +577,7 @@ void SvpSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight )
     m_aLineColor = aOrigLineColor;
 }
 
-void SvpSalGraphics::drawPolyLine(sal_uInt32 nPoints, SalPoint* pPtAry)
+void SvpSalGraphics::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry)
 {
     basegfx::B2DPolygon aPoly;
     aPoly.append(basegfx::B2DPoint(pPtAry->mnX, pPtAry->mnY), nPoints);
diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 376b32c7cbb6..1149e5ca1b49 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -25,7 +25,7 @@
 #include <impfontmetricdata.hxx>
 #include <CommonSalLayout.hxx>
 
-void SvpSalGraphics::SetFont( FontSelectPattern* pIFSD, int nFallbackLevel )
+void SvpSalGraphics::SetFont( const FontSelectPattern* pIFSD, int nFallbackLevel )
 {
     m_aTextRenderImpl.SetFont(pIFSD, nFallbackLevel);
 }
diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx
index 051ffcb6c288..94d7eb5ebc44 100644
--- a/vcl/inc/PhysicalFontFace.hxx
+++ b/vcl/inc/PhysicalFontFace.hxx
@@ -72,7 +72,7 @@ public:
     // by using an PhysicalFontFace object as a factory for its corresponding
     // LogicalFontInstance can be extended to cache device and font instance
     // specific data
-    virtual LogicalFontInstance*  CreateFontInstance( FontSelectPattern& ) const = 0;
+    virtual LogicalFontInstance*  CreateFontInstance( const FontSelectPattern& ) const = 0;
     virtual PhysicalFontFace* Clone() const = 0;
 
     int                     GetHeight() const           { return mnHeight; }
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 16b45fff3c8a..6fe1b07a2af9 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -141,7 +141,7 @@ public:
     virtual void            SetROPFillColor( SalROPColor nROPColor ) override;
 
     virtual void            SetTextColor( SalColor nSalColor ) override;
-    virtual void            SetFont( FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void            SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
     virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     virtual const FontCharMapRef GetFontCharMap() const override;
     virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
@@ -178,7 +178,7 @@ public:
                                           basegfx::B2DLineJoin,
                                           css::drawing::LineCap,
                                           double fMiterMinimumAngle) override;
-    virtual void            drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) override;
+    virtual void            drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
     virtual void            drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
     virtual void            drawPolyPolygon( sal_uInt32 nPoly,
                                              const sal_uInt32* pPoints,
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 67efca02924e..7bc6644fdc48 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -244,7 +244,7 @@ public:
 
     virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override;
 
-    virtual void drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) override;
+    virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
 
     virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
 
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 9c952d69be20..47d53e7fdcdb 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -63,7 +63,7 @@ public:
     virtual                         ~CoreTextFontFace() override;
 
     PhysicalFontFace*               Clone() const override;
-    LogicalFontInstance*            CreateFontInstance( FontSelectPattern& ) const override;
+    LogicalFontInstance*            CreateFontInstance( const FontSelectPattern& ) const override;
     sal_IntPtr                      GetFontId() const override;
 
     int                             GetFontTable( const char pTagName[5], unsigned char* ) const;
@@ -228,7 +228,7 @@ public:
     virtual void            drawPixel( long nX, long nY, SalColor nSalColor ) override;
     virtual void            drawLine( long nX1, long nY1, long nX2, long nY2 ) override;
     virtual void            drawRect( long nX, long nY, long nWidth, long nHeight ) override;
-    virtual void            drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) override;
+    virtual void            drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
     virtual void            drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
     virtual void            drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) override;
     virtual bool            drawPolyPolygon( const basegfx::B2DPolyPolygon&, double fTransparency ) override;
@@ -330,7 +330,7 @@ public:
     // set the text color to a specific color
     virtual void            SetTextColor( SalColor nSalColor ) override;
     // set the font
-    virtual void            SetFont( FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void            SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
     // get the current font's metrics
     virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     // get the repertoire of the current font
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 61f8bb3539cc..675e131451a7 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -124,7 +124,7 @@ public:
     virtual void                SetTextColor( SalColor nSalColor ) = 0;
 
     // set the font
-    virtual void                SetFont( FontSelectPattern*, int nFallbackLevel ) = 0;
+    virtual void                SetFont( const FontSelectPattern*, int nFallbackLevel ) = 0;
 
     // release the fonts
     void                        ReleaseFonts() { SetFont( nullptr, 0 ); }
@@ -447,7 +447,7 @@ protected:
 
     virtual void                drawRect( long nX, long nY, long nWidth, long nHeight ) = 0;
 
-    virtual void                drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) = 0;
+    virtual void                drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0;
 
     virtual void                drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0;
 
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index bf81e394976a..1771afaeaee8 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -94,7 +94,7 @@ public:
 
     virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) = 0;
 
-    virtual void drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) = 0;
+    virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0;
 
     virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0;
 
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index ebcb7a081f7c..ca21add07484 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -35,7 +35,7 @@ public:
     virtual ~TextRenderImpl() {}
 
     virtual void                    SetTextColor( SalColor nSalColor ) = 0;
-    virtual void                    SetFont( FontSelectPattern*, int nFallbackLevel ) = 0;
+    virtual void                    SetFont( const FontSelectPattern*, int nFallbackLevel ) = 0;
     virtual void                    GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) = 0;
     virtual const FontCharMapRef    GetFontCharMap() const = 0;
     virtual bool                    GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0;
diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index 7acf3ac74e62..4670a6e61bae 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -51,7 +51,7 @@ public:
 
 
     virtual void                SetTextColor( SalColor nSalColor ) override;
-    virtual void                SetFont( FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void                SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
     virtual void                GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     virtual const FontCharMapRef GetFontCharMap() const override;
     virtual bool                GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx
index 00f003aff975..0a4b7459e8e8 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -113,7 +113,7 @@ private:
 public:
                             FreetypeFontFace( FreetypeFontInfo*, const FontAttributes& );
 
-    virtual LogicalFontInstance* CreateFontInstance( FontSelectPattern& ) const override;
+    virtual LogicalFontInstance* CreateFontInstance( const FontSelectPattern& ) const override;
     virtual PhysicalFontFace* Clone() const override   { return new FreetypeFontFace( *this ); }
     virtual sal_IntPtr      GetFontId() const override { return mpFreetypeFontInfo->GetFontId(); }
 };
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index 245ae1906a8d..6e9511d49906 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -83,7 +83,7 @@ public:
     virtual void            SetROPFillColor( SalROPColor nROPColor ) override;
 
     virtual void            SetTextColor( SalColor nSalColor ) override;
-    virtual void            SetFont( FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void            SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
     virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     virtual const FontCharMapRef GetFontCharMap() const override;
     virtual bool            GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
@@ -120,7 +120,7 @@ public:
     virtual void            drawPixel( long nX, long nY, SalColor nSalColor ) override;
     virtual void            drawLine( long nX1, long nY1, long nX2, long nY2 ) override;
     virtual void            drawRect( long nX, long nY, long nWidth, long nHeight ) override;
-    virtual void            drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) override;
+    virtual void            drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
     virtual void            drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
     virtual void            drawPolyPolygon( sal_uInt32 nPoly,
                                              const sal_uInt32* pPoints,
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index aacc8cb2c1f5..4c5406354bdc 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -115,7 +115,7 @@ public:
     virtual void                    SetROPFillColor( SalROPColor nROPColor ) override;
 
     virtual void                    SetTextColor( SalColor nSalColor ) override;
-    virtual void                    SetFont( FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void                    SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
     virtual void                    GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     virtual const FontCharMapRef    GetFontCharMap() const override;
     virtual bool                    GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
@@ -151,7 +151,7 @@ public:
     virtual void                    drawPixel( long nX, long nY, SalColor nSalColor ) override;
     virtual void                    drawLine( long nX1, long nY1, long nX2, long nY2 ) override;
     virtual void                    drawRect( long nX, long nY, long nWidth, long nHeight ) override;
-    virtual void                    drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) override;
+    virtual void                    drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
     virtual void                    drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
 
     virtual void                    drawPolyPolygon(
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 6d92b48de9e5..caaa3f802631 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -65,7 +65,7 @@ public:
     virtual                 ~WinFontFace() override;
 
     virtual PhysicalFontFace* Clone() const override;
-    virtual LogicalFontInstance* CreateFontInstance( FontSelectPattern& ) const override;
+    virtual LogicalFontInstance* CreateFontInstance( const FontSelectPattern& ) const override;
     virtual sal_IntPtr      GetFontId() const override;
     void                    SetFontId( sal_IntPtr nId ) { mnId = nId; }
     void                    UpdateFromHDC( HDC ) const;
@@ -227,7 +227,7 @@ protected:
     virtual void        drawPixel( long nX, long nY, SalColor nSalColor ) override;
     virtual void        drawLine( long nX1, long nY1, long nX2, long nY2 ) override;
     virtual void        drawRect( long nX, long nY, long nWidth, long nHeight ) override;
-    virtual void        drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) override;
+    virtual void        drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
     virtual void        drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
     virtual void        drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) override;
     virtual bool        drawPolyPolygon( const basegfx::B2DPolyPolygon&, double fTransparency ) override;
@@ -332,7 +332,7 @@ public:
     // set the text color to a specific color
     virtual void            SetTextColor( SalColor nSalColor ) override;
     // set the font
-    virtual void            SetFont( FontSelectPattern*, int nFallbackLevel ) override;
+    virtual void            SetFont( const FontSelectPattern*, int nFallbackLevel ) override;
     // get the current font's metrics
     virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
     // get the repertoire of the current font
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 3afc2069b05e..110071042519 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1544,7 +1544,7 @@ void OpenGLSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeigh
     PostBatchDraw();
 }
 
-void OpenGLSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry )
+void OpenGLSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry )
 {
     VCL_GL_INFO("::drawPolyLine legacy -> redirecting to drawPolyLine");
     basegfx::B2DPolygon aPoly;
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index f9e7bc2bacbf..c31dcc329e2b 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -268,7 +268,7 @@ PhysicalFontFace* CoreTextFontFace::Clone() const
     return new CoreTextFontFace( *this);
 }
 
-LogicalFontInstance* CoreTextFontFace::CreateFontInstance( /*const*/ FontSelectPattern& rFSD ) const
+LogicalFontInstance* CoreTextFontFace::CreateFontInstance( const FontSelectPattern& rFSD ) const
 {
     return new LogicalFontInstance( rFSD);
 }
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index e84702eabb12..89b92e6bc0c5 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -477,7 +477,7 @@ void AquaSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout)
     CGContextRestoreGState(mrContext);
 }
 
-void AquaSalGraphics::SetFont(FontSelectPattern* pReqFont, int nFallbackLevel)
+void AquaSalGraphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLevel)
 {
     // release the text style
     for (int i = nFallbackLevel; i < MAX_FALLBACK; ++i)
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 5022a93c70f0..192bdc5aa47e 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -1393,7 +1393,7 @@ void AquaSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight )
     DBG_DRAW_OPERATION_EXIT("drawRect");
 }
 
-void AquaSalGraphics::drawPolyLine( sal_uInt32 nPoints, SalPoint *pPtAry )
+void AquaSalGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint *pPtAry )
 {
     DBG_DRAW_OPERATION("drawPolyLine",);
 
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 16994f2f5866..3592ae115504 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2230,7 +2230,7 @@ PdfBuiltinFontFace::PdfBuiltinFontFace( const PDFWriterImpl::BuiltinFont& rBuilt
     mrBuiltin( rBuiltin )
 {}
 
-LogicalFontInstance* PdfBuiltinFontFace::CreateFontInstance( FontSelectPattern& rFSD ) const
+LogicalFontInstance* PdfBuiltinFontFace::CreateFontInstance( const FontSelectPattern& rFSD ) const
 {
     LogicalFontInstance* pEntry = new LogicalFontInstance( rFSD );
     return pEntry;
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 0b754310fa7d..b9e02ee0a69d 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -1300,7 +1300,7 @@ public:
     const PDFWriterImpl::BuiltinFont&   GetBuiltinFont() const  { return mrBuiltin; }
 
     virtual PhysicalFontFace*           Clone() const override { return new PdfBuiltinFontFace(*this); }
-    virtual LogicalFontInstance*        CreateFontInstance( FontSelectPattern& ) const override;
+    virtual LogicalFontInstance*        CreateFontInstance( const FontSelectPattern& ) const override;
     virtual sal_IntPtr                  GetFontId() const override { return reinterpret_cast<sal_IntPtr>(&mrBuiltin); }
 };
 
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 77a3539cc81b..5b03eda92eef 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -337,7 +337,7 @@ bool CairoTextRender::GetFontCapabilities(vcl::FontCapabilities &rGetImplFontCap
 
 // SalGraphics
 
-void CairoTextRender::SetFont( FontSelectPattern *pEntry, int nFallbackLevel )
+void CairoTextRender::SetFont( const FontSelectPattern *pEntry, int nFallbackLevel )
 {
     setFont(pEntry, nFallbackLevel);
 }
diff --git a/vcl/unx/generic/gdi/font.cxx b/vcl/unx/generic/gdi/font.cxx
index c872963d159c..bae13f646037 100644
--- a/vcl/unx/generic/gdi/font.cxx
+++ b/vcl/unx/generic/gdi/font.cxx
@@ -70,7 +70,7 @@ bool X11SalGraphics::GetFontCapabilities(vcl::FontCapabilities &rGetImplFontCapa
 
 // SalGraphics
 
-void X11SalGraphics::SetFont( FontSelectPattern *pEntry, int nFallbackLevel )
+void X11SalGraphics::SetFont( const FontSelectPattern *pEntry, int nFallbackLevel )
 {
     mxTextRenderImpl->SetFont(pEntry, nFallbackLevel);
 }
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index fea1b60c9870..84dfdff69e07 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -1240,7 +1240,7 @@ void X11SalGraphicsImpl::drawRect( long nX, long nY, long nDX, long nDY )
                         nX, nY, nDX-1, nDY-1 );
 }
 
-void X11SalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, SalPoint *pPtAry )
+void X11SalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint *pPtAry )
 {
     drawPolyLine( nPoints, pPtAry, false );
 }
diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx
index 42fe5b6c9ee2..fe4f47e51a94 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -152,7 +152,7 @@ public:
 
     virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override;
 
-    virtual void drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) override;
+    virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
 
     virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
 
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 652cb41b7a7e..1ac940050077 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -431,7 +431,7 @@ void X11SalGraphics::drawRect( long nX, long nY, long nDX, long nDY )
     mxImpl->drawRect( nX, nY, nDX, nDY );
 }
 
-void X11SalGraphics::drawPolyLine( sal_uInt32 nPoints, SalPoint *pPtAry )
+void X11SalGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint *pPtAry )
 {
     mxImpl->drawPolyLine( nPoints, pPtAry );
 }
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 0b4f49c9b5fa..57393255bcee 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -354,7 +354,7 @@ FreetypeFontFace::FreetypeFontFace( FreetypeFontInfo* pFI, const FontAttributes&
 {
 }
 
-LogicalFontInstance* FreetypeFontFace::CreateFontInstance( FontSelectPattern& rFSD ) const
+LogicalFontInstance* FreetypeFontFace::CreateFontInstance( const FontSelectPattern& rFSD ) const
 {
     FreetypeFontInstance* pEntry = new FreetypeFontInstance( rFSD );
     return pEntry;
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index dea5b28f4082..c835b2d5922c 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -396,15 +396,15 @@ void GenPspGraphics::drawRect( long nX, long nY, long nDX, long nDY )
     m_pPrinterGfx->DrawRect (tools::Rectangle(Point(nX, nY), Size(nDX, nDY)));
 }
 
-void GenPspGraphics::drawPolyLine( sal_uInt32 nPoints, SalPoint *pPtAry )
+void GenPspGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint *pPtAry )
 {
-    m_pPrinterGfx->DrawPolyLine (nPoints, reinterpret_cast<Point *>(pPtAry));
+    m_pPrinterGfx->DrawPolyLine (nPoints, reinterpret_cast<const Point *>(pPtAry));
 }
 
 void GenPspGraphics::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry )
 {
     // Point must be equal to SalPoint! see include/vcl/salgtype.hxx
-    m_pPrinterGfx->DrawPolygon (nPoints, reinterpret_cast<Point const *>(pPtAry));
+    m_pPrinterGfx->DrawPolygon (nPoints, reinterpret_cast<const Point *>(pPtAry));
 }
 
 void GenPspGraphics::drawPolyPolygon( sal_uInt32           nPoly,
@@ -532,7 +532,7 @@ public:
     explicit ImplPspFontData( const psp::FastPrintFontInfo& );
     virtual sal_IntPtr      GetFontId() const override { return mnFontId; }
     virtual PhysicalFontFace*   Clone() const override { return new ImplPspFontData( *this ); }
-    virtual LogicalFontInstance*  CreateFontInstance( FontSelectPattern& ) const override;
+    virtual LogicalFontInstance*  CreateFontInstance( const FontSelectPattern& ) const override;
 };
 
 ImplPspFontData::ImplPspFontData( const psp::FastPrintFontInfo& rInfo )
@@ -540,7 +540,7 @@ ImplPspFontData::ImplPspFontData( const psp::FastPrintFontInfo& rInfo )
     mnFontId( rInfo.m_nID )
 {}
 
-LogicalFontInstance* ImplPspFontData::CreateFontInstance( FontSelectPattern& rFSD ) const
+LogicalFontInstance* ImplPspFontData::CreateFontInstance( const FontSelectPattern& rFSD ) const
 {
     FreetypeFontInstance* pEntry = new FreetypeFontInstance( rFSD );
     return pEntry;
@@ -610,7 +610,7 @@ bool GenPspGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilitie
     return m_pFreetypeFont[0]->GetFontCapabilities(rFontCapabilities);
 }
 
-void GenPspGraphics::SetFont( FontSelectPattern *pEntry, int nFallbackLevel )
+void GenPspGraphics::SetFont( const FontSelectPattern *pEntry, int nFallbackLevel )
 {
     // release all fonts that are to be overridden
     for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 4d3d382c97f7..314d4a769d41 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1563,18 +1563,23 @@ void WinSalGraphicsImpl::SetROPFillColor( SalROPColor nROPColor )
     SetFillColor( ImplGetROPSalColor( nROPColor ) );
 }
 
-void WinSalGraphicsImpl::drawPixel( long nX, long nY )
+void WinSalGraphicsImpl::drawPixelImpl( long nX, long nY, COLORREF crColor )
 {
     if ( mbXORMode )
     {
-        HBRUSH  hBrush = CreateSolidBrush( mnPenColor );
-        HBRUSH  hOldBrush = SelectBrush( mrParent.getHDC(), hBrush );
+        HBRUSH hBrush = CreateSolidBrush( crColor );
+        HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), hBrush );
         PatBlt( mrParent.getHDC(), (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
         SelectBrush( mrParent.getHDC(), hOldBrush );
         DeleteBrush( hBrush );
     }
     else
-        SetPixel( mrParent.getHDC(), (int)nX, (int)nY, mnPenColor );
+        SetPixel( mrParent.getHDC(), (int)nX, (int)nY, crColor );
+}
+
+void WinSalGraphicsImpl::drawPixel( long nX, long nY )
+{
+    drawPixelImpl( nX, nY, mnPenColor );
 }
 
 void WinSalGraphicsImpl::drawPixel( long nX, long nY, SalColor nSalColor )
@@ -1588,56 +1593,18 @@ void WinSalGraphicsImpl::drawPixel( long nX, long nY, SalColor nSalColor )
          ImplIsSysColorEntry( nSalColor ) )
         nCol = PALRGB_TO_RGB( nCol );
 
-    if ( mbXORMode )
-    {
-        HBRUSH  hBrush = CreateSolidBrush( nCol );
-        HBRUSH  hOldBrush = SelectBrush( mrParent.getHDC(), hBrush );
-        PatBlt( mrParent.getHDC(), (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
-        SelectBrush( mrParent.getHDC(), hOldBrush );
-        DeleteBrush( hBrush );
-    }
-    else
-        ::SetPixel( mrParent.getHDC(), (int)nX, (int)nY, nCol );
+    drawPixelImpl( nX, nY, nCol );
 }
 
 void WinSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 )
 {
     MoveToEx( mrParent.getHDC(), (int)nX1, (int)nY1, nullptr );
 
-    // we must paint the endpoint
-    int bPaintEnd = TRUE;
-    if ( nX1 == nX2 )
-    {
-        bPaintEnd = FALSE;
-        if ( nY1 <= nY2 )
-            nY2++;
-        else
-            nY2--;
-    }
-    if ( nY1 == nY2 )
-    {
-        bPaintEnd = FALSE;
-        if ( nX1 <= nX2 )
-            nX2++;
-        else
-            nX2--;
-    }
-
     LineTo( mrParent.getHDC(), (int)nX2, (int)nY2 );
 
-    if ( bPaintEnd && !mrParent.isPrinter() )
-    {
-        if ( mbXORMode )
-        {
-            HBRUSH  hBrush = CreateSolidBrush( mnPenColor );
-            HBRUSH  hOldBrush = SelectBrush( mrParent.getHDC(), hBrush );
-            PatBlt( mrParent.getHDC(), (int)nX2, (int)nY2, (int)1, (int)1, PATINVERT );
-            SelectBrush( mrParent.getHDC(), hOldBrush );
-            DeleteBrush( hBrush );
-        }
-        else
-            SetPixel( mrParent.getHDC(), (int)nX2, (int)nY2, mnPenColor );
-    }
+    // LineTo doesn't draw the last pixel
+    if ( !mrParent.isPrinter() )
+        drawPixelImpl( nX2, nY2, mnPenColor );
 }
 
 void WinSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight )
@@ -1663,50 +1630,20 @@ void WinSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight )
         Rectangle( mrParent.getHDC(), (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) );
 }
 
-void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry )
+void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry )
 {
     // for NT, we can handover the array directly
     static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
 
-    POINT* pWinPtAry = reinterpret_cast<POINT*>(pPtAry);
-
-    // we assume there are at least 2 points (Polyline requires at least 2 point, see MSDN)
-    // we must paint the endpoint for last line
-    BOOL bPaintEnd = TRUE;
-    if ( pWinPtAry[nPoints-2].x == pWinPtAry[nPoints-1].x )
-    {
-        bPaintEnd = FALSE;
-        if ( pWinPtAry[nPoints-2].y <=  pWinPtAry[nPoints-1].y )
-            pWinPtAry[nPoints-1].y++;
-        else
-            pWinPtAry[nPoints-1].y--;
-    }
-    if ( pWinPtAry[nPoints-2].y == pWinPtAry[nPoints-1].y )
-    {
-        bPaintEnd = FALSE;
-        if ( pWinPtAry[nPoints-2].x <= pWinPtAry[nPoints-1].x )
-            pWinPtAry[nPoints-1].x++;
-        else
-            pWinPtAry[nPoints-1].x--;
-    }
+    POINT const * pWinPtAry = reinterpret_cast<POINT const *>(pPtAry);
 
     // for Windows 95 and its maximum number of points
     if ( !Polyline( mrParent.getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
         Polyline( mrParent.getHDC(), pWinPtAry, MAX_64KSALPOINTS );
 
-    if ( bPaintEnd && !mrParent.isPrinter() )
-    {
-        if ( mbXORMode )
-        {
-            HBRUSH     hBrush = CreateSolidBrush( mnPenColor );
-            HBRUSH     hOldBrush = SelectBrush( mrParent.getHDC(), hBrush );
-            PatBlt( mrParent.getHDC(), (int)(pWinPtAry[nPoints-1].x), (int)(pWinPtAry[nPoints-1].y), (int)1, (int)1, PATINVERT );
-            SelectBrush( mrParent.getHDC(), hOldBrush );
-            DeleteBrush( hBrush );
-        }
-        else
-            SetPixel( mrParent.getHDC(), (int)(pWinPtAry[nPoints-1].x), (int)(pWinPtAry[nPoints-1].y), mnPenColor );
-    }
+    // Polyline seems to uses LineTo, which doesn't paint the last pixel (see 87eb8f8ee)
+    if ( !mrParent.isPrinter() )
+        drawPixelImpl( pWinPtAry[nPoints-1].x, pWinPtAry[nPoints-1].y, mnPenColor );
 }
 
 void WinSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry )
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index 9409a75a3fa4..350882198b32 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -47,6 +47,7 @@ private:
     SalColor                maFillColor;
 
     bool tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBitmap& rSrcBitmap);
+    void drawPixelImpl( long nX, long nY, COLORREF crColor );
 
 public:
 
@@ -100,7 +101,7 @@ public:
 
     virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override;
 
-    virtual void drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry ) override;
+    virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
 
     virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
 
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index f1f7dfeffb87..20bcce07d47e 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -871,7 +871,7 @@ HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const * i_pFont, HFONT& o_
     return hNewFont;
 }
 
-void WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel )
+void WinSalGraphics::SetFont( const FontSelectPattern* pFont, int nFallbackLevel )
 {
     // return early if there is no new font
     if( !pFont )
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 474abf69df4b..9d6dcd55ec2b 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -780,7 +780,7 @@ void WinSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight )
     mpImpl->drawRect( nX, nY, nWidth, nHeight );
 }
 
-void WinSalGraphics::drawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry )
+void WinSalGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry )
 {
     mpImpl->drawPolyLine( nPoints, pPtAry );
 }
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 5561657fbf5a..f157f7b81772 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -318,7 +318,7 @@ PhysicalFontFace* WinFontFace::Clone() const
     return pClone;
 }
 
-LogicalFontInstance* WinFontFace::CreateFontInstance( FontSelectPattern& rFSD ) const
+LogicalFontInstance* WinFontFace::CreateFontInstance( const FontSelectPattern& rFSD ) const
 {
     LogicalFontInstance* pFontInstance = new WinFontInstance( rFSD );
     return pFontInstance;


More information about the Libreoffice-commits mailing list