vcl/inc/win/salgdi.h   |    2 --
 vcl/win/gdi/salgdi.cxx |   39 +++++----------------------------------
 2 files changed, 5 insertions(+), 36 deletions(-)

New commits:
commit 9bfee82eb1c6e9e2effefda5013e256c4c30e658
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Feb 12 09:51:07 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Feb 12 10:16:50 2025 +0100

    simplify WinSalGraphics::setPalette
    
    only called from one place, so inline it and remove dead code
    
    Change-Id: Iffc0f7eb2464f78a109355d94031e82da00a4afd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181466
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index bd82cb387319..c80f78e20569 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -253,8 +253,6 @@ public:
     void setHDC(HDC aNew);
 
     HPALETTE getDefPal() const;
-    // returns the result from RealizePalette, otherwise 0 on success or 
GDI_ERROR
-    UINT setPalette(HPALETTE, BOOL bForceBkgd = TRUE);
 
     HRGN getRegion() const;
 
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 0e6e033d0c4d..634bbb078e38 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -172,7 +172,11 @@ void WinSalGraphics::DeInitGraphics()
         SelectFont( getHDC(), mhDefFont );
         mhDefFont = nullptr;
     }
-    setPalette(nullptr);
+    if (mhDefPal)
+    {
+        SelectPalette(getHDC(), mhDefPal, /*bForceBkgd*/TRUE);
+        mhDefPal = nullptr;
+    }
 
     mpImpl->DeInit();
 }
@@ -383,39 +387,6 @@ HPALETTE WinSalGraphics::getDefPal() const
     return mhDefPal;
 }
 
-UINT WinSalGraphics::setPalette(HPALETTE hNewPal, BOOL bForceBkgd)
-{
-    UINT res = GDI_ERROR;
-
-    if (!getHDC())
-    {
-        assert(!mhDefPal);
-        return res;
-    }
-
-    if (hNewPal)
-    {
-        HPALETTE hOldPal = SelectPalette(getHDC(), hNewPal, bForceBkgd);
-        if (hOldPal)
-        {
-            if (!mhDefPal)
-                mhDefPal = hOldPal;
-            res = RealizePalette(getHDC());
-        }
-    }
-    else
-    {
-        res = 0;
-        if (mhDefPal)
-        {
-            SelectPalette(getHDC(), mhDefPal, bForceBkgd);
-            mhDefPal = nullptr;
-        }
-    }
-
-    return res;
-}
-
 HRGN WinSalGraphics::getRegion() const
 {
     return mhRegion;

Reply via email to