vcl/headless/svpgdi.cxx         |    7 +++----
 vcl/inc/headless/svpgdi.hxx     |    2 +-
 vcl/inc/quartz/salgdi.h         |    2 +-
 vcl/inc/salgdi.hxx              |    2 +-
 vcl/quartz/salgdi.cxx           |    7 +++----
 vcl/source/gdi/salgdilayout.cxx |    5 ++---
 vcl/source/image/ImplImage.cxx  |    4 ++--
 vcl/source/outdev/bitmap.cxx    |    2 +-
 8 files changed, 14 insertions(+), 17 deletions(-)

New commits:
commit 686b968ec3565c004d2d3e47dcf1370158b3dd90
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Oct 22 15:39:42 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Oct 22 19:31:28 2024 +0200

    pass by reference for ShouldDownscaleIconsAtSurface
    
    because the param is never null
    
    Change-Id: I58660a9e4e6c25def2a70099bffce322b477b702
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175415
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 81a35471dcc7..5542fd7c1da6 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -46,12 +46,11 @@ void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, 
sal_Int32& rDPIY )
     rDPIX = rDPIY = 96;
 }
 
-bool SvpSalGraphics::ShouldDownscaleIconsAtSurface(double* pScaleOut) const
+bool SvpSalGraphics::ShouldDownscaleIconsAtSurface(double& rScaleOut) const
 {
     if (comphelper::LibreOfficeKit::isActive())
-        return SalGraphics::ShouldDownscaleIconsAtSurface(pScaleOut);
-    if (pScaleOut)
-        *pScaleOut = m_aCairoCommon.m_fScale;
+        return SalGraphics::ShouldDownscaleIconsAtSurface(rScaleOut);
+    rScaleOut = m_aCairoCommon.m_fScale;
     return true;
 }
 
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 0c4476e9aa5b..89370154b014 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -80,7 +80,7 @@ public:
     virtual void            DrawTextLayout( const GenericSalLayout& ) override;
     virtual void DrawSalLayout(const GenericSalLayout& rLayout, void* 
pSurface, const basegfx::BColor& rTextColor, bool bAntiAliased) const override;
 
-    virtual bool            ShouldDownscaleIconsAtSurface(double* pScaleOut) 
const override;
+    virtual bool            ShouldDownscaleIconsAtSurface(double& rScaleOut) 
const override;
 
     virtual SystemGraphicsData GetGraphicsData() const override;
 
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index b7fb674f7553..f29f35948d5b 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -474,7 +474,7 @@ public:
     virtual void            DrawTextLayout( const GenericSalLayout& ) override;
 
 #ifdef MACOSX
-    virtual bool            ShouldDownscaleIconsAtSurface(double* pScaleOut) 
const override;
+    virtual bool            ShouldDownscaleIconsAtSurface(double& rScaleOut) 
const override;
 #endif
 
     virtual SystemGraphicsData
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 6fd58da78172..5a8a932ca559 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -399,7 +399,7 @@ public:
     // surface is hidpi then pScaleOut contains the scaling factor. So we can
     // create larger hires bitmaps which we know will be logically scaled down
     // by this factor but physically just copied
-    virtual bool ShouldDownscaleIconsAtSurface(double* pScaleOut) const;
+    virtual bool ShouldDownscaleIconsAtSurface(double& rScaleOut) const;
 
 
 #if ENABLE_CAIRO_CANVAS
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 115ca04b8f30..6673a6fd6824 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -331,12 +331,11 @@ void AquaSalGraphics::DrawTextLayout(const 
GenericSalLayout& rLayout)
 
 #ifdef MACOSX
 
-bool AquaSalGraphics::ShouldDownscaleIconsAtSurface(double* pScaleOut) const
+bool AquaSalGraphics::ShouldDownscaleIconsAtSurface(double& rScaleOut) const
 {
     if (comphelper::LibreOfficeKit::isActive())
-        return SalGraphics::ShouldDownscaleIconsAtSurface(pScaleOut);
-    if (pScaleOut)
-        *pScaleOut = sal::aqua::getWindowScaling();
+        return SalGraphics::ShouldDownscaleIconsAtSurface(rScaleOut);
+    rScaleOut = sal::aqua::getWindowScaling();
     return true;
 }
 
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 2654b211a2ac..14dd62104fe3 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -917,10 +917,9 @@ OUString SalGraphics::getRenderBackendName() const
     return OUString();
 }
 
-bool SalGraphics::ShouldDownscaleIconsAtSurface(double* pScaleOut) const
+bool SalGraphics::ShouldDownscaleIconsAtSurface(double& rScaleOut) const
 {
-    if (pScaleOut)
-        *pScaleOut = comphelper::LibreOfficeKit::getDPIScale();
+    rScaleOut = comphelper::LibreOfficeKit::getDPIScale();
     return comphelper::LibreOfficeKit::isActive();
 }
 
diff --git a/vcl/source/image/ImplImage.cxx b/vcl/source/image/ImplImage.cxx
index fa469bc20e69..08bc9c64a836 100644
--- a/vcl/source/image/ImplImage.cxx
+++ b/vcl/source/image/ImplImage.cxx
@@ -68,7 +68,7 @@ bool ImplImage::loadStockAtScale(SalGraphics* pGraphics, 
BitmapEx &rBitmapEx)
     if (aIconTheme.endsWith("_svg"))
     {
 #endif
-        if (pGraphics && pGraphics->ShouldDownscaleIconsAtSurface(&fScale)) // 
scale at the surface
+        if (pGraphics && pGraphics->ShouldDownscaleIconsAtSurface(fScale)) // 
scale at the surface
         {
             nScalePercentage = fScale * 100.0;
             eScalingFlags = ImageLoadFlags::IgnoreScalingFactor;
@@ -164,7 +164,7 @@ BitmapEx const & ImplImage::getBitmapExForHiDPI(bool 
bDisabled, SalGraphics* pGr
     if ((isStock() || mxMetaFile) && pGraphics)
     {   // check we have the right bitmap cached.
         double fScale = 1.0;
-        pGraphics->ShouldDownscaleIconsAtSurface(&fScale);
+        pGraphics->ShouldDownscaleIconsAtSurface(fScale);
         Size aTarget(maSizePixel.Width()*fScale,
                      maSizePixel.Height()*fScale);
         if (maBitmapEx.GetSizePixel() != aTarget)
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index f54f231f5700..1a23db131a77 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -162,7 +162,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const 
Size& rDestSize,
                     // but hidpi surfaces like the cairo one have their own 
scale, so don't downscale
                     // past the surface scaling which can retain the extra 
detail
                     double fScale(1.0);
-                    if (mpGraphics->ShouldDownscaleIconsAtSurface(&fScale))
+                    if (mpGraphics->ShouldDownscaleIconsAtSurface(fScale))
                     {
                         nScaleX *= fScale;
                         nScaleY *= fScale;

Reply via email to