vcl/headless/svpvd.cxx              |    5 ---
 vcl/inc/headless/svpvd.hxx          |    1 
 vcl/inc/qt5/QtGraphics_Controls.hxx |    3 +-
 vcl/inc/qt5/QtSvpVirtualDevice.hxx  |    2 -
 vcl/inc/qt5/QtVirtualDevice.hxx     |    1 
 vcl/inc/salvd.hxx                   |    2 -
 vcl/inc/skia/x11/salvd.hxx          |    2 -
 vcl/inc/unx/salvd.h                 |    1 
 vcl/qt5/QtGraphics.cxx              |   10 ++++---
 vcl/qt5/QtGraphics_Controls.cxx     |   14 +++++-----
 vcl/qt5/QtSvpGraphics.cxx           |   27 +++++++++++--------
 vcl/qt5/QtSvpVirtualDevice.cxx      |   10 ++++---
 vcl/qt5/QtVirtualDevice.cxx         |    8 -----
 vcl/qt5/QtWidget.cxx                |    8 ++++-
 vcl/skia/x11/salvd.cxx              |    4 --
 vcl/source/image/ImplImage.cxx      |    2 -
 vcl/source/window/window.cxx        |    4 +-
 vcl/unx/generic/gdi/gdiimpl.cxx     |   29 +--------------------
 vcl/unx/generic/gdi/gdiimpl.hxx     |    6 ----
 vcl/unx/generic/gdi/salgdi.cxx      |    4 ++
 vcl/unx/generic/gdi/salvd.cxx       |    9 +-----
 vcl/unx/generic/window/salframe.cxx |   49 +-----------------------------------
 22 files changed, 56 insertions(+), 145 deletions(-)

New commits:
commit a45277a271b943cfa929670223ddf0447c968269
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Thu Apr 28 18:53:47 2022 +0200
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Thu Apr 28 18:53:47 2022 +0200

    Todys work, actully working correctly

diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index c27ff3baa917..bf02c6ac7e44 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -64,11 +64,6 @@ void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* 
pGraphics )
     delete pGraphics;
 }
 
-void SvpSalVirtualDevice::SetScalePercentage(sal_Int32 nScale)
-{
-    CreateSurface(0, 0, nullptr, nScale);
-}
-
 void SvpSalVirtualDevice::CreateSurface(sal_Int32 nNewDX, sal_Int32 nNewDY, 
sal_uInt8 *const pBuffer, sal_Int32 nScalePercentage)
 {
     double fXScale, fYScale;
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index 7c4f1024d536..c1b68a138e69 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -54,7 +54,6 @@ public:
     virtual bool        SetSizeUsingBuffer( sal_Int32 nNewDX, sal_Int32 nNewDY,
                                             sal_uInt8 * pBuffer, sal_Int32 
nScale = 100
                                           ) override;
-    virtual void SetScalePercentage(sal_Int32) override;
 
     cairo_surface_t* GetSurface() const { return m_pSurface; }
 
diff --git a/vcl/inc/qt5/QtGraphics_Controls.hxx 
b/vcl/inc/qt5/QtGraphics_Controls.hxx
index 15931d6d18ba..5611706a4b76 100644
--- a/vcl/inc/qt5/QtGraphics_Controls.hxx
+++ b/vcl/inc/qt5/QtGraphics_Controls.hxx
@@ -38,9 +38,10 @@ class QtGraphics_Controls final : public 
vcl::WidgetDrawInterface
     std::unique_ptr<QImage> m_image;
     QRect m_lastPopupRect;
     SalGraphics const& m_rGraphics;
+    qreal m_fDevicePixelRatio;
 
 public:
-    QtGraphics_Controls(const SalGraphics& rGraphics, sal_Int32 nScale);
+    QtGraphics_Controls(const SalGraphics& rGraphics, sal_Int32 
nScalePercentage);
 
     QImage* getImage() { return m_image.get(); }
 
diff --git a/vcl/inc/qt5/QtSvpVirtualDevice.hxx 
b/vcl/inc/qt5/QtSvpVirtualDevice.hxx
index 5d80ba8c0dbf..9da7c640ee6f 100644
--- a/vcl/inc/qt5/QtSvpVirtualDevice.hxx
+++ b/vcl/inc/qt5/QtSvpVirtualDevice.hxx
@@ -15,7 +15,7 @@ class QtSvpGraphics;
 
 class VCL_DLLPUBLIC QtSvpVirtualDevice final : public SvpSalVirtualDevice
 {
-    QtSvpGraphics& m_rRefGraphics;
+    sal_Int32 m_nScalePercentage;
 
 public:
     QtSvpVirtualDevice(QtSvpGraphics& rGraphics, cairo_surface_t* 
pPreExistingTarget);
diff --git a/vcl/inc/qt5/QtVirtualDevice.hxx b/vcl/inc/qt5/QtVirtualDevice.hxx
index dc5846a57307..9f86dac0938f 100644
--- a/vcl/inc/qt5/QtVirtualDevice.hxx
+++ b/vcl/inc/qt5/QtVirtualDevice.hxx
@@ -47,7 +47,6 @@ public:
 
     // SalGeometryProvider
     virtual sal_Int32 GetSgpMetric(vcl::SGPmetric eMetric) const override;
-    virtual void SetScalePercentage(sal_Int32) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx
index 213cc81c3673..bf3c8cf69c83 100644
--- a/vcl/inc/salvd.hxx
+++ b/vcl/inc/salvd.hxx
@@ -44,8 +44,6 @@ public:
 
     // Set new size using a buffer at the given address
     virtual bool SetSizeUsingBuffer(sal_Int32 nNewDX, sal_Int32 nNewDY, 
sal_uInt8*, sal_Int32 nScale = 100) = 0;
-
-    virtual void SetScalePercentage(sal_Int32 nScale) = 0;
 };
 
 void SalVirtualDevice::FixSetSizeParams(sal_Int32& nDX, sal_Int32& nDY, 
sal_Int32& nScale)
diff --git a/vcl/inc/skia/x11/salvd.hxx b/vcl/inc/skia/x11/salvd.hxx
index b2ce698de77b..7ef6f9dd3a1d 100644
--- a/vcl/inc/skia/x11/salvd.hxx
+++ b/vcl/inc/skia/x11/salvd.hxx
@@ -38,8 +38,6 @@ public:
 
     // Set new size, without saving the old contents
     virtual bool SetSizeUsingBuffer(sal_Int32 nNewDX, sal_Int32 nNewDY, 
sal_uInt8*, sal_Int32 = 100) override;
-
-    virtual void SetScalePercentage(sal_Int32) override;
 };
 
 #endif // INCLUDED_VCL_INC_SKIA_X11_SALVD_H
diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h
index 78734de87d59..bbbed7ce08d3 100644
--- a/vcl/inc/unx/salvd.h
+++ b/vcl/inc/unx/salvd.h
@@ -70,7 +70,6 @@ public:
     virtual bool SetSizeUsingBuffer(sal_Int32 nNewDX, sal_Int32 nNewDY, 
sal_uInt8*, sal_Int32) override;
 
     virtual sal_Int32 GetSgpMetric(vcl::SGPmetric eMetric) const override;
-    virtual void SetScalePercentage(sal_Int32) override;
 };
 
 #endif // INCLUDED_VCL_INC_UNX_SALVD_H
diff --git a/vcl/qt5/QtGraphics.cxx b/vcl/qt5/QtGraphics.cxx
index bc75cbd8115b..18ebf69ea632 100644
--- a/vcl/qt5/QtGraphics.cxx
+++ b/vcl/qt5/QtGraphics.cxx
@@ -40,10 +40,12 @@ QtGraphics::QtGraphics( QtFrame *pFrame, QImage *pQImage )
     if (!initWidgetDrawBackends(false))
     {
         if (!QtData::noNativeControls())
-       {
-            sal_Int32 nScalePercentage = pFrame ? 
pFrame->GetDPIScalePercentage() : round(pQImage->devicePixelRatio() * 100);
-            m_pWidgetDraw.reset(new QtGraphics_Controls(*this, 
nScalePercentage));
-       }
+        {
+            sal_Int32 nScale = m_pFrame ? pFrame->GetDPIScalePercentage()
+                                        : round(pQImage->devicePixelRatio() * 
100);
+            SAL_DEBUG(__func__ << " " << m_pFrame << " " << nScale);
+            m_pWidgetDraw.reset(new QtGraphics_Controls(*this, nScale));
+        }
     }
 }
 
diff --git a/vcl/qt5/QtGraphics_Controls.cxx b/vcl/qt5/QtGraphics_Controls.cxx
index c6319a7649a5..9acd03169abc 100644
--- a/vcl/qt5/QtGraphics_Controls.cxx
+++ b/vcl/qt5/QtGraphics_Controls.cxx
@@ -74,11 +74,11 @@ static void 
lcl_ApplyBackgroundColorToStyleOption(QStyleOption& rOption,
     }
 }
 
-QtGraphics_Controls::QtGraphics_Controls(const SalGraphics& rGraphics, 
sal_Int32 nScale)
-    : m_image(new QImage())
-    , m_rGraphics(rGraphics)
+QtGraphics_Controls::QtGraphics_Controls(const SalGraphics& rGraphics, 
sal_Int32 nScalePercentage)
+    : m_rGraphics(rGraphics)
+    , m_fDevicePixelRatio(nScalePercentage / 100.0f)
 {
-    m_image->setDevicePixelRatio(nScale / 100.0);
+    // can't call setDevicePixelRatio on an empty QImage...
 }
 
 bool QtGraphics_Controls::isNativeControlSupported(ControlType type, 
ControlPart part)
@@ -266,12 +266,12 @@ bool QtGraphics_Controls::drawNativeControl(ControlType 
type, ControlPart part,
     QRect widgetRect = toQRect(rControlRegion);
 
     //if no image, or resized, make a new image
-    if (m_image->size() != widgetRect.size())
+    if (!m_image || m_image->size() != widgetRect.size())
     {
-       qreal fScaleRatio = m_image->devicePixelRatio();
+//     qreal fScaleRatio = m_image->devicePixelRatio();
         m_image.reset(new QImage(widgetRect.width(), widgetRect.height(),
                                  QImage::Format_ARGB32_Premultiplied));
-        m_image->setDevicePixelRatio(fScaleRatio);
+        m_image->setDevicePixelRatio(m_fDevicePixelRatio);
     }
 
     // Default image color - just once
diff --git a/vcl/qt5/QtSvpGraphics.cxx b/vcl/qt5/QtSvpGraphics.cxx
index a5c48aa5457d..01361c113d8c 100644
--- a/vcl/qt5/QtSvpGraphics.cxx
+++ b/vcl/qt5/QtSvpGraphics.cxx
@@ -29,9 +29,9 @@ QtSvpGraphics::QtSvpGraphics(QtFrame* pFrame, sal_Int32 
nScale)
     , m_nScalePercentage(pFrame ? pFrame->GetDPIScalePercentage() : nScale)
 {
     assert(m_nScalePercentage > 0);
-    SAL_DEBUG(__func__ << " " << pFrame << " " << m_nScalePercentage);
+    SAL_DEBUG(__func__ << " " << pFrame << " " << nScale << " " << 
m_nScalePercentage);
     if (!QtData::noNativeControls())
-         m_pWidgetDraw.reset(new QtGraphics_Controls(*this, 
m_nScalePercentage));
+        m_pWidgetDraw.reset(new QtGraphics_Controls(*this, 
m_nScalePercentage));
 }
 
 QtSvpGraphics::~QtSvpGraphics() {}
@@ -48,14 +48,19 @@ void QtSvpGraphics::updateQWidget() const
 void QtSvpGraphics::setSurface(cairo_surface_t* pSurface)
 {
     SvpSalGraphics::setSurface(pSurface);
+#if 0
     if (m_pWidgetDraw && pSurface)
     {
-       sal_Int32 nScale = 
CairoCommon::GetSgpMetricFromSurface(vcl::SGPmetric::ScalePercentage, 
*pSurface);
-       
SAL_DEBUG(static_cast<sal_IntPtr*>(cairo_surface_get_user_data(pSurface, 
CairoCommon::getScalingKey())));
-        SAL_DEBUG(__func__ << " " << GetDPIScalePercentage() << " " << nScale);
-       auto *pWidgetDraw = 
static_cast<QtGraphics_Controls*>(m_pWidgetDraw.get());
-        pWidgetDraw->getImage()->setDevicePixelRatio(GetDPIScalePercentage());
+        sal_Int32 nScale
+            = 
CairoCommon::GetSgpMetricFromSurface(vcl::SGPmetric::ScalePercentage, 
*pSurface);
+        SAL_DEBUG(__func__ << " 1 " << GetDPIScalePercentage() << " " << 
nScale);
+        SAL_DEBUG(__func__ << " 2 "
+                           << 
static_cast<sal_IntPtr*>(cairo_surface_get_user_data(
+                                  pSurface, CairoCommon::getScalingKey())));
+        auto* pWidgetDraw = 
static_cast<QtGraphics_Controls*>(m_pWidgetDraw.get());
+        pWidgetDraw->getImage()->setDevicePixelRatio(GetDPIScaleFactor());
     }
+#endif
 }
 
 #if ENABLE_CAIRO_CANVAS
@@ -114,12 +119,12 @@ sal_Int32 QtSvpGraphics::GetSgpMetric(vcl::SGPmetric 
eMetric) const
     else
     {
         if (m_pWidgetDraw)
-       {
+        {
             QImage* pImage = 
static_cast<QtGraphics_Controls*>(m_pWidgetDraw.get())->getImage();
-           assert(pImage);
+            assert(pImage);
             return GetSgpMetricFromQImage(eMetric, *pImage);
-       }
-       else
+        }
+        else
             return SvpSalGraphics::GetSgpMetric(eMetric);
     }
 }
diff --git a/vcl/qt5/QtSvpVirtualDevice.cxx b/vcl/qt5/QtSvpVirtualDevice.cxx
index 342ac6df3071..b5f29f90b7d9 100644
--- a/vcl/qt5/QtSvpVirtualDevice.cxx
+++ b/vcl/qt5/QtSvpVirtualDevice.cxx
@@ -10,16 +10,18 @@
 #include <QtSvpVirtualDevice.hxx>
 #include <QtSvpGraphics.hxx>
 
-QtSvpVirtualDevice::QtSvpVirtualDevice(QtSvpGraphics& rRefGraphics, 
cairo_surface_t* pPreExistingTarget)
+QtSvpVirtualDevice::QtSvpVirtualDevice(QtSvpGraphics& rRefGraphics,
+                                       cairo_surface_t* pPreExistingTarget)
     : SvpSalVirtualDevice(rRefGraphics.getSurface(), pPreExistingTarget)
-    , m_rRefGraphics(rRefGraphics)
+    , m_nScalePercentage(rRefGraphics.GetDPIScalePercentage())
 {
-    SAL_DEBUG(__func__ << " " << m_rRefGraphics.frame() << 
m_rRefGraphics.GetDPIScalePercentage());
+    // can't store rRefGraphics, as it's released
+    SAL_DEBUG(__func__ << " " << rRefGraphics.frame() << " " << 
m_nScalePercentage);
 }
 
 SalGraphics* QtSvpVirtualDevice::AcquireGraphics()
 {
-    return AddGraphics(new QtSvpGraphics(m_rRefGraphics.frame(), 
m_rRefGraphics.GetDPIScalePercentage())); 
+    return AddGraphics(new QtSvpGraphics(nullptr, m_nScalePercentage));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtVirtualDevice.cxx b/vcl/qt5/QtVirtualDevice.cxx
index 7a67707dd213..882e06c49d17 100644
--- a/vcl/qt5/QtVirtualDevice.cxx
+++ b/vcl/qt5/QtVirtualDevice.cxx
@@ -48,7 +48,6 @@ void QtVirtualDevice::ReleaseGraphics(SalGraphics* pGraphics)
 bool QtVirtualDevice::SetSizeUsingBuffer(sal_Int32 nNewDX, sal_Int32 nNewDY, 
sal_uInt8* pBuffer, sal_Int32 nScale)
 {
     FixSetSizeParams(nNewDX, nNewDY, nScale);
-    SAL_DEBUG(__func__ << " " << nScale);
     if (!pBuffer && m_pImage && m_pImage->width() == nNewDX && 
m_pImage->height() == nNewDY && nScale == GetDPIScalePercentage())
         return true;
 
@@ -79,11 +78,4 @@ sal_Int32 QtVirtualDevice::GetSgpMetric(vcl::SGPmetric 
eMetric) const
     return ::GetSgpMetricFromQImage(eMetric, *m_pImage);
 }
 
-void QtVirtualDevice::SetScalePercentage(sal_Int32 nScale)
-{
-    if (!m_pImage)
-        SetSizeUsingBuffer(1, 1, nullptr);
-    m_pImage->setDevicePixelRatio(nScale / 100.0);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index faa39ed8242c..227665ee7681 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -69,6 +69,7 @@ void QtWidget::paintEvent(QPaintEvent* pEvent)
     if (!m_rFrame.m_bNullRegion)
         p.setClipRegion(m_rFrame.m_aRegion);
 
+    const qreal fRatio = m_rFrame.devicePixelRatioF();
     QImage aImage;
     if (m_rFrame.m_bUseCairo)
     {
@@ -78,12 +79,15 @@ void QtWidget::paintEvent(QPaintEvent* pEvent)
         aImage = QImage(cairo_image_surface_get_data(pSurface),
                         cairo_image_surface_get_width(pSurface),
                         cairo_image_surface_get_height(pSurface), 
Qt_DefaultFormat32);
+        aImage.setDevicePixelRatio(fRatio);
     }
     else
+    {
+       SAL_DEBUG(__func__ << " " << 
round(m_rFrame.m_pQImage->devicePixelRatio() * 100) << " " << 
m_rFrame.GetDPIScalePercentage());
+       assert(round(m_rFrame.m_pQImage->devicePixelRatio() * 100) == 
m_rFrame.GetDPIScalePercentage());
         aImage = *m_rFrame.m_pQImage;
+    }
 
-    const qreal fRatio = m_rFrame.devicePixelRatioF();
-    aImage.setDevicePixelRatio(fRatio);
     QRectF source(pEvent->rect().topLeft() * fRatio, pEvent->rect().size() * 
fRatio);
     p.drawImage(pEvent->rect(), aImage, source);
 }
diff --git a/vcl/skia/x11/salvd.cxx b/vcl/skia/x11/salvd.cxx
index 967b99cb1b5c..fa91b60e2b1f 100644
--- a/vcl/skia/x11/salvd.cxx
+++ b/vcl/skia/x11/salvd.cxx
@@ -93,8 +93,4 @@ bool X11SkiaSalVirtualDevice::SetSizeUsingBuffer(sal_Int32 
nDX, sal_Int32 nDY, s
     return true;
 }
 
-void X11SkiaSalVirtualDevice::SetScalePercentage(sal_Int32)
-{
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/image/ImplImage.cxx b/vcl/source/image/ImplImage.cxx
index 61bec49f7a4c..ce6da35faff2 100644
--- a/vcl/source/image/ImplImage.cxx
+++ b/vcl/source/image/ImplImage.cxx
@@ -156,7 +156,7 @@ void ImplImage::setScalePercentage(sal_Int32 nScale)
     assert(nScale > 0);
     if (m_nScalePercentage == nScale)
        return;
-    SAL_WARN_IF(!maBitmapEx.IsEmpty(), "vcl", "image scale changed after 
loading(" << m_nScalePercentage << "% >> " << nScale << "%); invalidaing 
image!");
+    SAL_WARN_IF(!maBitmapEx.IsEmpty() && m_nScalePercentage > 0, "vcl", "image 
scale changed after loading(" << m_nScalePercentage << "% >> " << nScale << 
"%); invalidaing image!");
     if (m_nScalePercentage > 0 && isStock())
         maBitmapEx.SetEmpty();
     m_nScalePercentage = nScale;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 43bb67c20edf..b45718a38835 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1074,11 +1074,11 @@ void Window::ImplInit( vcl::Window* pParent, WinBits 
nStyle, SystemParentData* p
         else
         {
             OutputDevice *pOutDev = GetOutDev();
-            if ( pOutDev->AcquireGraphics() )
+            if (pOutDev)
             {
                 sal_Int32 nDPIX, nDPIY;
                 mpWindowImpl->mpFrame->GetDPI(nDPIX, nDPIY);
-                GetOutDev()->SetDPI(nDPIX, nDPIY);
+                pOutDev->SetDPI(nDPIX, nDPIY);
             }
         }
 
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 5e6057b1cef6..e6977adfd6dd 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -1419,7 +1419,7 @@ bool X11SalGraphicsImpl::drawPolyPolygon(
         aPolyPolygon = basegfx::utils::snapPointsOfHorizontalOrVerticalEdges( 
aPolyPolygon );
 
     // don't bother with polygons outside of visible area
-    const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), 
GetGraphicsHeight() );
+    const basegfx::B2DRange aViewRange(0, 0, mrParent.GetWidth(), 
mrParent.GetHeight());
     aPolyPolygon = basegfx::utils::clipPolyPolygonOnRange( aPolyPolygon, 
aViewRange, true, false );
     if( !aPolyPolygon.count() )
         return true;
@@ -1434,16 +1434,6 @@ bool X11SalGraphicsImpl::drawPolyPolygon(
     return bDrawn;
 }
 
-tools::Long X11SalGraphicsImpl::GetGraphicsHeight() const
-{
-    if( mrParent.m_pFrame )
-        return mrParent.m_pFrame->maGeometry.nHeight;
-    else if( mrParent.m_pVDev )
-        return static_cast< X11SalVirtualDevice* 
>(mrParent.m_pVDev)->GetHeight();
-    else
-        return 0;
-}
-
 bool X11SalGraphicsImpl::drawFilledTrapezoids( const basegfx::B2DTrapezoid* 
pB2DTraps, int nTrapCount, double fTransparency )
 {
     if( nTrapCount <= 0 )
@@ -1943,7 +1933,7 @@ std::shared_ptr<SalBitmap> X11SalGraphicsImpl::getBitmap( 
tools::Long nX, tools:
     }
 
     std::shared_ptr<X11SalBitmap> pSalBitmap = 
std::make_shared<X11SalBitmap>();
-    sal_uInt16 nBitCount = GetBitCount();
+    sal_uInt16 nBitCount = mrParent.GetBitCount();
     vcl::PixelFormat ePixelFormat = vcl::bitDepthToPixelFormat(nBitCount);
 
     if( &mrParent.GetDisplay()->GetColormap( mrParent.m_nXScreen ) != 
&mrParent.GetColormap() )
@@ -1963,21 +1953,6 @@ std::shared_ptr<SalBitmap> 
X11SalGraphicsImpl::getBitmap( tools::Long nX, tools:
     return pSalBitmap;
 }
 
-sal_uInt16 X11SalGraphicsImpl::GetBitCount() const
-{
-    return mrParent.GetVisual().GetDepth();
-}
-
-tools::Long X11SalGraphicsImpl::GetGraphicsWidth() const
-{
-    if( mrParent.m_pFrame )
-        return mrParent.m_pFrame->maGeometry.nWidth;
-    else if( mrParent.m_pVDev )
-        return static_cast< X11SalVirtualDevice* 
>(mrParent.m_pVDev)->GetWidth();
-    else
-        return 0;
-}
-
 bool X11SalGraphicsImpl::drawGradient(const tools::PolyPolygon& /*rPolygon*/, 
const Gradient& /*rGradient*/)
 {
     return false;
diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx
index f3c564a88b79..ccb68d7ec4f9 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -95,19 +95,13 @@ private:
         const basegfx::triangulator::B2DTriangleVector& rTriangles,
         double fTransparency);
 
-    tools::Long GetGraphicsHeight() const;
-
     void drawMaskedBitmap( const SalTwoRect& rPosAry,
                                               const SalBitmap& rSalBitmap,
                                               const SalBitmap& 
rTransparentBitmap );
 
     void internalDrawPolyLine( sal_uInt32 nPoints, const Point* pPtAry, bool 
bClose );
 
-    sal_uInt16 GetBitCount() const;
-    tools::Long GetGraphicsWidth() const;
-
 public:
-
     explicit X11SalGraphicsImpl(X11SalGraphics& rParent);
 
     virtual void freeResources() override;
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 755bd913416b..91656989d119 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -318,7 +318,9 @@ bool X11SalGraphics::GetDitherPixmap( Color nColor )
 sal_Int32 X11SalGraphics::GetSgpMetric(vcl::SGPmetric eMetric) const
 {
     assert(m_pVDev || m_pFrame);
-    SAL_DEBUG(__func__ << " " << m_pVDev << " " << m_pFrame << " " << 
bWindow_);
+    if (m_pFrame && eMetric == vcl::SGPmetric::BitCount)
+        return GetVisual().GetDepth();
+
     if (m_pVDev)
        return m_pVDev->GetSgpMetric(eMetric);
     else
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index 16a7928942bf..08cdee8b35ae 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -78,6 +78,7 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, 
cairo_surface_t* pPreEx
         maX11Common.m_pColormap = m_pDeleteColormap.get();
     }
 
+    assert(pDevice);
     m_pVDev      = pDevice;
     m_pFrame     = nullptr;
     bWindow_     = pDisplay->IsDisplay();
@@ -233,14 +234,8 @@ sal_Int32 X11SalVirtualDevice::GetSgpMetric(vcl::SGPmetric 
eMetric) const
         case vcl::SGPmetric::ScalePercentage: return 100;
         case vcl::SGPmetric::OffScreen: return true;
         case vcl::SGPmetric::BitCount: return nDepth_;
-        default:
-            return -1;
     }
+    return -1;
 }
 
-void X11SalVirtualDevice::SetScalePercentage(sal_Int32)
-{
-}
-
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/window/salframe.cxx 
b/vcl/unx/generic/window/salframe.cxx
index 9348c8948b17..6d1a0ea52504 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -4133,57 +4133,12 @@ void X11SalFrame::EndSetClipRegion()
                               m_vClipRectangles.data(),
                               m_vClipRectangles.size(),
                               op, ordering );
-
-}
-
-sal_Int32 X11SalFrame::GetDPI() const
-{
-    char* pForceDpi;
-    if ((pForceDpi = getenv("SAL_FORCEDPI")))
-    {
-        OString sForceDPI(pForceDpi);
-        return sForceDPI.toInt32();
-    }
-
-    const SalDisplay *pDisplay = GetDisplay();
-    if (!pDisplay)
-    {
-        SAL_WARN( "vcl", "Null display");
-        return 96;
-    }
-
-    Pair dpi = pDisplay->GetResolution();
-    sal_Int32 rDPIX = dpi.A();
-    sal_Int32 rDPIY = dpi.B();
-
-    if (rDPIY > 200)
-    {
-        rDPIX = Divide(rDPIX * 200, rDPIY);
-        rDPIY = 200;
-    }
-
-    // different x- and y- resolutions are usually artifacts of
-    // a wrongly calculated screen size.
-#ifdef DEBUG
-    SAL_INFO("vcl.gdi", "Forcing Resolution from "
-        << std::hex << rDPIX
-        << std::dec << rDPIX
-        << " to "
-        << std::hex << rDPIY
-        << std::dec << rDPIY);
-#endif
-    return rDPIY; // y-resolution is more trustworthy
 }
 
 sal_Int32 X11SalFrame::GetSgpMetric(vcl::SGPmetric eMetric) const
 {
-    switch (eMetric) {
-    case vcl::SGPmetric::DPIX:
-    case vcl::SGPmetric::DPIY:
-        return GetDPI();
-    default:
-        return SalFrame::GetWindow()->GetOutDev()->GetSgpMetric(eMetric);
-    }
+    assert(eMetric != vcl::SGPmetric::BitCount);
+    return SalFrame::GetWindow()->GetOutDev()->GetSgpMetric(eMetric);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to